Skip to content

Commit b12c4df

Browse files
garmancschleiden
authored andcommitted
update existing tests
1 parent 16482d9 commit b12c4df

3 files changed

Lines changed: 16 additions & 16 deletions

File tree

cmd/eval/eval_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ evaluators:
162162
cfg := command.NewConfig(out, out, client, true, 100)
163163

164164
// Mock a response that returns "4" for the LLM evaluator
165-
client.MockGetChatCompletionStream = func(ctx context.Context, req azuremodels.ChatCompletionOptions) (*azuremodels.ChatCompletionResponse, error) {
165+
client.MockGetChatCompletionStream = func(ctx context.Context, req azuremodels.ChatCompletionOptions, org string) (*azuremodels.ChatCompletionResponse, error) {
166166
reader := sse.NewMockEventReader([]azuremodels.ChatCompletion{
167167
{
168168
Choices: []azuremodels.ChatChoice{
@@ -228,7 +228,7 @@ evaluators:
228228
client := azuremodels.NewMockClient()
229229

230230
// Mock a simple response
231-
client.MockGetChatCompletionStream = func(ctx context.Context, req azuremodels.ChatCompletionOptions) (*azuremodels.ChatCompletionResponse, error) {
231+
client.MockGetChatCompletionStream = func(ctx context.Context, req azuremodels.ChatCompletionOptions, org string) (*azuremodels.ChatCompletionResponse, error) {
232232
// Create a mock reader that returns "test response"
233233
reader := sse.NewMockEventReader([]azuremodels.ChatCompletion{
234234
{
@@ -284,7 +284,7 @@ evaluators:
284284
client := azuremodels.NewMockClient()
285285

286286
// Mock a response that will fail the evaluator
287-
client.MockGetChatCompletionStream = func(ctx context.Context, req azuremodels.ChatCompletionOptions) (*azuremodels.ChatCompletionResponse, error) {
287+
client.MockGetChatCompletionStream = func(ctx context.Context, req azuremodels.ChatCompletionOptions, org string) (*azuremodels.ChatCompletionResponse, error) {
288288
reader := sse.NewMockEventReader([]azuremodels.ChatCompletion{
289289
{
290290
Choices: []azuremodels.ChatChoice{
@@ -346,7 +346,7 @@ evaluators:
346346

347347
// Mock responses for both test cases
348348
callCount := 0
349-
client.MockGetChatCompletionStream = func(ctx context.Context, req azuremodels.ChatCompletionOptions) (*azuremodels.ChatCompletionResponse, error) {
349+
client.MockGetChatCompletionStream = func(ctx context.Context, req azuremodels.ChatCompletionOptions, org string) (*azuremodels.ChatCompletionResponse, error) {
350350
callCount++
351351
var response string
352352
if callCount == 1 {
@@ -444,7 +444,7 @@ evaluators:
444444
require.NoError(t, err)
445445

446446
client := azuremodels.NewMockClient()
447-
client.MockGetChatCompletionStream = func(ctx context.Context, req azuremodels.ChatCompletionOptions) (*azuremodels.ChatCompletionResponse, error) {
447+
client.MockGetChatCompletionStream = func(ctx context.Context, req azuremodels.ChatCompletionOptions, org string) (*azuremodels.ChatCompletionResponse, error) {
448448
response := "hello world"
449449
reader := sse.NewMockEventReader([]azuremodels.ChatCompletion{
450450
{
@@ -526,7 +526,7 @@ evaluators:
526526
require.NoError(t, err)
527527

528528
client := azuremodels.NewMockClient()
529-
client.MockGetChatCompletionStream = func(ctx context.Context, req azuremodels.ChatCompletionOptions) (*azuremodels.ChatCompletionResponse, error) {
529+
client.MockGetChatCompletionStream = func(ctx context.Context, req azuremodels.ChatCompletionOptions, org string) (*azuremodels.ChatCompletionResponse, error) {
530530
response := "hello world"
531531
reader := sse.NewMockEventReader([]azuremodels.ChatCompletion{
532532
{

cmd/run/run_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func TestRun(t *testing.T) {
4545
Reader: sse.NewMockEventReader([]azuremodels.ChatCompletion{chatCompletion}),
4646
}
4747
getChatCompletionCallCount := 0
48-
client.MockGetChatCompletionStream = func(ctx context.Context, opt azuremodels.ChatCompletionOptions) (*azuremodels.ChatCompletionResponse, error) {
48+
client.MockGetChatCompletionStream = func(ctx context.Context, opt azuremodels.ChatCompletionOptions, org string) (*azuremodels.ChatCompletionResponse, error) {
4949
getChatCompletionCallCount++
5050
return chatResp, nil
5151
}
@@ -122,7 +122,7 @@ messages:
122122
},
123123
}},
124124
}
125-
client.MockGetChatCompletionStream = func(ctx context.Context, opt azuremodels.ChatCompletionOptions) (*azuremodels.ChatCompletionResponse, error) {
125+
client.MockGetChatCompletionStream = func(ctx context.Context, opt azuremodels.ChatCompletionOptions, org string) (*azuremodels.ChatCompletionResponse, error) {
126126
capturedReq = opt
127127
return &azuremodels.ChatCompletionResponse{
128128
Reader: sse.NewMockEventReader([]azuremodels.ChatCompletion{chatCompletion}),
@@ -188,7 +188,7 @@ messages:
188188
},
189189
}},
190190
}
191-
client.MockGetChatCompletionStream = func(ctx context.Context, opt azuremodels.ChatCompletionOptions) (*azuremodels.ChatCompletionResponse, error) {
191+
client.MockGetChatCompletionStream = func(ctx context.Context, opt azuremodels.ChatCompletionOptions, org string) (*azuremodels.ChatCompletionResponse, error) {
192192
capturedReq = opt
193193
return &azuremodels.ChatCompletionResponse{
194194
Reader: sse.NewMockEventReader([]azuremodels.ChatCompletion{chatCompletion}),
@@ -278,7 +278,7 @@ messages:
278278
}},
279279
}
280280

281-
client.MockGetChatCompletionStream = func(ctx context.Context, opt azuremodels.ChatCompletionOptions) (*azuremodels.ChatCompletionResponse, error) {
281+
client.MockGetChatCompletionStream = func(ctx context.Context, opt azuremodels.ChatCompletionOptions, org string) (*azuremodels.ChatCompletionResponse, error) {
282282
capturedReq = opt
283283
return &azuremodels.ChatCompletionResponse{
284284
Reader: sse.NewMockEventReader([]azuremodels.ChatCompletion{chatCompletion}),

internal/azuremodels/azure_client_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func TestAzureClient(t *testing.T) {
4949
require.NoError(t, err)
5050
}))
5151
defer testServer.Close()
52-
cfg := &AzureClientConfig{InferenceURL: testServer.URL}
52+
cfg := &AzureClientConfig{InferenceRoot: testServer.URL}
5353
httpClient := testServer.Client()
5454
client := NewAzureClient(httpClient, authToken, cfg)
5555
opts := ChatCompletionOptions{
@@ -63,7 +63,7 @@ func TestAzureClient(t *testing.T) {
6363
},
6464
}
6565

66-
chatCompletionStreamResp, err := client.GetChatCompletionStream(ctx, opts)
66+
chatCompletionStreamResp, err := client.GetChatCompletionStream(ctx, opts, "")
6767

6868
require.NoError(t, err)
6969
require.NotNil(t, chatCompletionStreamResp)
@@ -125,7 +125,7 @@ func TestAzureClient(t *testing.T) {
125125
require.NoError(t, err)
126126
}))
127127
defer testServer.Close()
128-
cfg := &AzureClientConfig{InferenceURL: testServer.URL}
128+
cfg := &AzureClientConfig{InferenceRoot: testServer.URL}
129129
httpClient := testServer.Client()
130130
client := NewAzureClient(httpClient, authToken, cfg)
131131
opts := ChatCompletionOptions{
@@ -139,7 +139,7 @@ func TestAzureClient(t *testing.T) {
139139
},
140140
}
141141

142-
chatCompletionStreamResp, err := client.GetChatCompletionStream(ctx, opts)
142+
chatCompletionStreamResp, err := client.GetChatCompletionStream(ctx, opts, "")
143143

144144
require.NoError(t, err)
145145
require.NotNil(t, chatCompletionStreamResp)
@@ -173,15 +173,15 @@ func TestAzureClient(t *testing.T) {
173173
require.NoError(t, err)
174174
}))
175175
defer testServer.Close()
176-
cfg := &AzureClientConfig{InferenceURL: testServer.URL}
176+
cfg := &AzureClientConfig{InferenceRoot: testServer.URL}
177177
httpClient := testServer.Client()
178178
client := NewAzureClient(httpClient, "fake-token-123abc", cfg)
179179
opts := ChatCompletionOptions{
180180
Model: "some-test-model",
181181
Messages: []ChatMessage{{Role: "user", Content: util.Ptr("Tell me a story, test model.")}},
182182
}
183183

184-
chatCompletionResp, err := client.GetChatCompletionStream(ctx, opts)
184+
chatCompletionResp, err := client.GetChatCompletionStream(ctx, opts, "")
185185

186186
require.Error(t, err)
187187
require.Nil(t, chatCompletionResp)

0 commit comments

Comments
 (0)