[azopenai] non-existing deployments fail in a different way now. (#23747)

This commit is contained in:
Richard Park 2024-11-13 14:46:46 -08:00 коммит произвёл GitHub
Родитель 4d6af6bda8
Коммит 9ebef43f64
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
2 изменённых файлов: 0 добавлений и 32 удалений

Просмотреть файл

@ -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) { func TestClient_GetChatCompletionsStream_Error(t *testing.T) {
if recording.GetRecordMode() == recording.PlaybackMode { if recording.GetRecordMode() == recording.PlaybackMode {
t.Skip() t.Skip()

Просмотреть файл

@ -12,23 +12,10 @@ import (
"testing" "testing"
"github.com/Azure/azure-sdk-for-go/sdk/ai/azopenai" "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/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/stretchr/testify/require" "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) { func TestClient_GetEmbeddings(t *testing.T) {
testFn := func(t *testing.T, epm endpointWithModel) { testFn := func(t *testing.T, epm endpointWithModel) {
client := newTestClient(t, epm.Endpoint) client := newTestClient(t, epm.Endpoint)