Skip to content

Commit

Permalink
[azopenai] non-existing deployments fail in a different way now. (Azu…
Browse files Browse the repository at this point in the history
  • Loading branch information
richardpark-msft authored Nov 13, 2024
1 parent 4d6af6b commit 9ebef43
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 32 deletions.
19 changes: 0 additions & 19 deletions sdk/ai/azopenai/client_chat_completions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,25 +300,6 @@ func TestClient_GetChatCompletionsStream(t *testing.T) {
})
}

func TestClient_GetChatCompletions_InvalidModel(t *testing.T) {
client := newTestClient(t, azureOpenAI.ChatCompletions.Endpoint)

_, err := client.GetChatCompletions(context.Background(), azopenai.ChatCompletionsOptions{
Messages: []azopenai.ChatRequestMessageClassification{
&azopenai.ChatRequestUserMessage{
Content: azopenai.NewChatRequestUserMessageContent("Count to 100, with a comma between each number and no newlines. E.g., 1, 2, 3, ..."),
},
},
MaxTokens: to.Ptr(int32(1024)),
Temperature: to.Ptr(float32(0.0)),
DeploymentName: to.Ptr("invalid model name"),
}, nil)

var respErr *azcore.ResponseError
require.ErrorAs(t, err, &respErr)
require.Equal(t, "DeploymentNotFound", respErr.ErrorCode)
}

func TestClient_GetChatCompletionsStream_Error(t *testing.T) {
if recording.GetRecordMode() == recording.PlaybackMode {
t.Skip()
Expand Down
13 changes: 0 additions & 13 deletions sdk/ai/azopenai/client_embeddings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,10 @@ import (
"testing"

"github.com/Azure/azure-sdk-for-go/sdk/ai/azopenai"
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/stretchr/testify/require"
)

func TestClient_GetEmbeddings_InvalidModel(t *testing.T) {
client := newTestClient(t, azureOpenAI.Embeddings.Endpoint)

_, err := client.GetEmbeddings(context.Background(), azopenai.EmbeddingsOptions{
DeploymentName: to.Ptr("thisdoesntexist"),
}, nil)

var respErr *azcore.ResponseError
require.ErrorAs(t, err, &respErr)
require.Equal(t, "DeploymentNotFound", respErr.ErrorCode)
}

func TestClient_GetEmbeddings(t *testing.T) {
testFn := func(t *testing.T, epm endpointWithModel) {
client := newTestClient(t, epm.Endpoint)
Expand Down

0 comments on commit 9ebef43

Please sign in to comment.