[azopenai] non-existing deployments fail in a different way now. (#23747)
This commit is contained in:
Родитель
4d6af6bda8
Коммит
9ebef43f64
|
@ -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)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче