From 9154f655545f21dfc171e96e0f972ab8901993fd Mon Sep 17 00:00:00 2001 From: Richard Park <51494936+richardpark-msft@users.noreply.github.com> Date: Fri, 28 Jul 2023 10:33:29 -0700 Subject: [PATCH] [azopenai] Rename the DeploymentID field to Deployment to match other Azure OpenAI packages (#21284) --- sdk/ai/azopenai/CHANGELOG.md | 2 ++ sdk/ai/azopenai/autorest.md | 10 +++++----- sdk/ai/azopenai/client.go | 8 ++++---- .../azopenai/client_chat_completions_test.go | 12 +++++------ sdk/ai/azopenai/client_completions_test.go | 8 ++++---- sdk/ai/azopenai/client_embeddings_test.go | 6 +++--- sdk/ai/azopenai/client_functions_test.go | 2 +- sdk/ai/azopenai/client_rai_test.go | 20 +++++++++---------- sdk/ai/azopenai/client_test.go | 2 +- sdk/ai/azopenai/custom_client.go | 8 ++++---- sdk/ai/azopenai/custom_client_test.go | 16 +++++++-------- .../example_client_embeddings_test.go | 4 ++-- .../example_client_getchatcompletions_test.go | 12 +++++------ .../example_client_getcompletions_test.go | 20 +++++++++---------- sdk/ai/azopenai/models.go | 12 +++++------ sdk/ai/azopenai/models_serde.go | 12 +++++------ 16 files changed, 78 insertions(+), 76 deletions(-) diff --git a/sdk/ai/azopenai/CHANGELOG.md b/sdk/ai/azopenai/CHANGELOG.md index 49743f4cef16..6e2a93282af8 100644 --- a/sdk/ai/azopenai/CHANGELOG.md +++ b/sdk/ai/azopenai/CHANGELOG.md @@ -6,6 +6,8 @@ ### Breaking Changes +- ChatCompletionsOptions, CompletionsOptions, EmbeddingsOptions `DeploymentID` field renamed to `Deployment`. + ### Bugs Fixed ### Other Changes diff --git a/sdk/ai/azopenai/autorest.md b/sdk/ai/azopenai/autorest.md index 8d0eb387818f..cbdb62a7807b 100644 --- a/sdk/ai/azopenai/autorest.md +++ b/sdk/ai/azopenai/autorest.md @@ -174,7 +174,7 @@ directive: where: $ transform: | return $ - .replace(/runtime\.JoinPaths\(client.endpoint, urlPath\)/g, "client.formatURL(urlPath, getDeploymentID(body))"); + .replace(/runtime\.JoinPaths\(client.endpoint, urlPath\)/g, "client.formatURL(urlPath, getDeployment(body))"); # Some ImageGenerations hackery to represent the ImageLocation/ImagePayload polymorphism. # - Remove the auto-generated ImageGenerationsDataItem. @@ -280,18 +280,18 @@ directive: transform: return $.replace(/runtime\.NewResponseError/sg, "client.newError"); # - # rename `Model` to `DeploymentID` + # rename `Model` to `Deployment` # - from: models.go where: $ transform: | return $ - .replace(/\/\/ The model name.*?Model \*string/sg, "// REQUIRED: DeploymentID specifies the name of the deployment (for Azure OpenAI) or model (for OpenAI) to use for this request.\nDeploymentID string"); + .replace(/\/\/ The model name.*?Model \*string/sg, "// REQUIRED: Deployment specifies the name of the deployment (for Azure OpenAI) or model (for OpenAI) to use for this request.\nDeployment string"); - from: models_serde.go where: $ transform: | return $ - .replace(/populate\(objectMap, "model", (c|e).Model\)/g, 'populate(objectMap, "model", &$1.DeploymentID)') - .replace(/err = unpopulate\(val, "Model", &(c|e).Model\)/g, 'err = unpopulate(val, "Model", &$1.DeploymentID)'); + .replace(/populate\(objectMap, "model", (c|e).Model\)/g, 'populate(objectMap, "model", &$1.Deployment)') + .replace(/err = unpopulate\(val, "Model", &(c|e).Model\)/g, 'err = unpopulate(val, "Model", &$1.Deployment)'); ``` diff --git a/sdk/ai/azopenai/client.go b/sdk/ai/azopenai/client.go index ad5759b38033..cfdc2c6df79f 100644 --- a/sdk/ai/azopenai/client.go +++ b/sdk/ai/azopenai/client.go @@ -67,7 +67,7 @@ func (client *Client) azureBatchImageGenerationInternal(ctx context.Context, bod // azureBatchImageGenerationInternalCreateRequest creates the AzureBatchImageGenerationInternal request. func (client *Client) azureBatchImageGenerationInternalCreateRequest(ctx context.Context, body ImageGenerationOptions, options *beginAzureBatchImageGenerationOptions) (*policy.Request, error) { urlPath := "/images/generations:submit" - req, err := runtime.NewRequest(ctx, http.MethodPost, client.formatURL(urlPath, getDeploymentID(body))) + req, err := runtime.NewRequest(ctx, http.MethodPost, client.formatURL(urlPath, getDeployment(body))) if err != nil { return nil, err } @@ -108,7 +108,7 @@ func (client *Client) GetChatCompletions(ctx context.Context, body ChatCompletio // getChatCompletionsCreateRequest creates the GetChatCompletions request. func (client *Client) getChatCompletionsCreateRequest(ctx context.Context, body ChatCompletionsOptions, options *GetChatCompletionsOptions) (*policy.Request, error) { urlPath := "chat/completions" - req, err := runtime.NewRequest(ctx, http.MethodPost, client.formatURL(urlPath, getDeploymentID(body))) + req, err := runtime.NewRequest(ctx, http.MethodPost, client.formatURL(urlPath, getDeployment(body))) if err != nil { return nil, err } @@ -158,7 +158,7 @@ func (client *Client) GetCompletions(ctx context.Context, body CompletionsOption // getCompletionsCreateRequest creates the GetCompletions request. func (client *Client) getCompletionsCreateRequest(ctx context.Context, body CompletionsOptions, options *GetCompletionsOptions) (*policy.Request, error) { urlPath := "completions" - req, err := runtime.NewRequest(ctx, http.MethodPost, client.formatURL(urlPath, getDeploymentID(body))) + req, err := runtime.NewRequest(ctx, http.MethodPost, client.formatURL(urlPath, getDeployment(body))) if err != nil { return nil, err } @@ -207,7 +207,7 @@ func (client *Client) GetEmbeddings(ctx context.Context, body EmbeddingsOptions, // getEmbeddingsCreateRequest creates the GetEmbeddings request. func (client *Client) getEmbeddingsCreateRequest(ctx context.Context, body EmbeddingsOptions, options *GetEmbeddingsOptions) (*policy.Request, error) { urlPath := "embeddings" - req, err := runtime.NewRequest(ctx, http.MethodPost, client.formatURL(urlPath, getDeploymentID(body))) + req, err := runtime.NewRequest(ctx, http.MethodPost, client.formatURL(urlPath, getDeployment(body))) if err != nil { return nil, err } diff --git a/sdk/ai/azopenai/client_chat_completions_test.go b/sdk/ai/azopenai/client_chat_completions_test.go index 7dd168950a5b..95758f4dcd69 100644 --- a/sdk/ai/azopenai/client_chat_completions_test.go +++ b/sdk/ai/azopenai/client_chat_completions_test.go @@ -30,9 +30,9 @@ func newTestChatCompletionOptions(tv testVars) azopenai.ChatCompletionsOptions { Content: to.Ptr("Count to 10, with a comma between each number, no newlines and a period at the end. E.g., 1, 2, 3, ..."), }, }, - MaxTokens: to.Ptr(int32(1024)), - Temperature: to.Ptr(float32(0.0)), - DeploymentID: tv.ChatCompletions, + MaxTokens: to.Ptr(int32(1024)), + Temperature: to.Ptr(float32(0.0)), + Deployment: tv.ChatCompletions, } } @@ -202,9 +202,9 @@ func TestClient_GetChatCompletions_InvalidModel(t *testing.T) { Content: to.Ptr("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)), - DeploymentID: "invalid model name", + MaxTokens: to.Ptr(int32(1024)), + Temperature: to.Ptr(float32(0.0)), + Deployment: "invalid model name", }, nil) var respErr *azcore.ResponseError diff --git a/sdk/ai/azopenai/client_completions_test.go b/sdk/ai/azopenai/client_completions_test.go index 41e3191b73d4..315cc6b5ea56 100644 --- a/sdk/ai/azopenai/client_completions_test.go +++ b/sdk/ai/azopenai/client_completions_test.go @@ -42,10 +42,10 @@ func testGetCompletions(t *testing.T, client *azopenai.Client, isAzure bool) { } resp, err := client.GetCompletions(context.Background(), azopenai.CompletionsOptions{ - Prompt: []string{"What is Azure OpenAI?"}, - MaxTokens: to.Ptr(int32(2048 - 127)), - Temperature: to.Ptr(float32(0.0)), - DeploymentID: deploymentID, + Prompt: []string{"What is Azure OpenAI?"}, + MaxTokens: to.Ptr(int32(2048 - 127)), + Temperature: to.Ptr(float32(0.0)), + Deployment: deploymentID, }, nil) require.NoError(t, err) diff --git a/sdk/ai/azopenai/client_embeddings_test.go b/sdk/ai/azopenai/client_embeddings_test.go index b9d70961ce8d..62b34ad1a75c 100644 --- a/sdk/ai/azopenai/client_embeddings_test.go +++ b/sdk/ai/azopenai/client_embeddings_test.go @@ -20,7 +20,7 @@ func TestClient_GetEmbeddings_InvalidModel(t *testing.T) { require.NoError(t, err) _, err = chatClient.GetEmbeddings(context.Background(), azopenai.EmbeddingsOptions{ - DeploymentID: "thisdoesntexist", + Deployment: "thisdoesntexist", }, nil) var respErr *azcore.ResponseError @@ -69,8 +69,8 @@ func testGetEmbeddings(t *testing.T, client *azopenai.Client, modelOrDeploymentI ctx: context.TODO(), deploymentID: modelOrDeploymentID, body: azopenai.EmbeddingsOptions{ - Input: []string{"\"Your text string goes here\""}, - DeploymentID: modelOrDeploymentID, + Input: []string{"\"Your text string goes here\""}, + Deployment: modelOrDeploymentID, }, options: nil, }, diff --git a/sdk/ai/azopenai/client_functions_test.go b/sdk/ai/azopenai/client_functions_test.go index f4203becd538..32096d01e31a 100644 --- a/sdk/ai/azopenai/client_functions_test.go +++ b/sdk/ai/azopenai/client_functions_test.go @@ -41,7 +41,7 @@ func TestGetChatCompletions_usingFunctions(t *testing.T) { func testChatCompletionsFunctions(t *testing.T, chatClient *azopenai.Client, tv testVars) { body := azopenai.ChatCompletionsOptions{ - DeploymentID: tv.ChatCompletions, + Deployment: tv.ChatCompletions, Messages: []azopenai.ChatMessage{ { Role: to.Ptr(azopenai.ChatRoleUser), diff --git a/sdk/ai/azopenai/client_rai_test.go b/sdk/ai/azopenai/client_rai_test.go index 2b11be357cec..1569f7637faa 100644 --- a/sdk/ai/azopenai/client_rai_test.go +++ b/sdk/ai/azopenai/client_rai_test.go @@ -22,10 +22,10 @@ func TestClient_GetCompletions_AzureOpenAI_ContentFilter_Response(t *testing.T) client := newAzureOpenAIClientForTest(t, azureOpenAI) resp, err := client.GetCompletions(context.Background(), azopenai.CompletionsOptions{ - Prompt: []string{"How do I rob a bank?"}, - MaxTokens: to.Ptr(int32(2048 - 127)), - Temperature: to.Ptr(float32(0.0)), - DeploymentID: azureOpenAI.Completions, + Prompt: []string{"How do I rob a bank?"}, + MaxTokens: to.Ptr(int32(2048 - 127)), + Temperature: to.Ptr(float32(0.0)), + Deployment: azureOpenAI.Completions, }, nil) require.Empty(t, resp) @@ -40,9 +40,9 @@ func TestClient_GetChatCompletions_AzureOpenAI_ContentFilterWithError(t *testing {Role: to.Ptr(azopenai.ChatRoleSystem), Content: to.Ptr("You are a helpful assistant.")}, {Role: to.Ptr(azopenai.ChatRoleUser), Content: to.Ptr("How do I rob a bank?")}, }, - MaxTokens: to.Ptr(int32(2048 - 127)), - Temperature: to.Ptr(float32(0.0)), - DeploymentID: azureOpenAICanary.ChatCompletions, + MaxTokens: to.Ptr(int32(2048 - 127)), + Temperature: to.Ptr(float32(0.0)), + Deployment: azureOpenAICanary.ChatCompletions, }, nil) require.Empty(t, resp) assertContentFilterError(t, err, true) @@ -55,9 +55,9 @@ func TestClient_GetChatCompletions_AzureOpenAI_ContentFilter_WithResponse(t *tes Messages: []azopenai.ChatMessage{ {Role: to.Ptr(azopenai.ChatRoleUser), Content: to.Ptr("How do I cook a bell pepper?")}, }, - MaxTokens: to.Ptr(int32(2048 - 127)), - Temperature: to.Ptr(float32(0.0)), - DeploymentID: azureOpenAICanary.ChatCompletions, + MaxTokens: to.Ptr(int32(2048 - 127)), + Temperature: to.Ptr(float32(0.0)), + Deployment: azureOpenAICanary.ChatCompletions, }, nil) require.NoError(t, err) diff --git a/sdk/ai/azopenai/client_test.go b/sdk/ai/azopenai/client_test.go index 08b4658bb35a..64d3122ca3f3 100644 --- a/sdk/ai/azopenai/client_test.go +++ b/sdk/ai/azopenai/client_test.go @@ -32,7 +32,7 @@ func TestClient_OpenAI_InvalidModel(t *testing.T) { Content: to.Ptr("hello"), }, }, - DeploymentID: "non-existent-model", + Deployment: "non-existent-model", }, nil) var respErr *azcore.ResponseError diff --git a/sdk/ai/azopenai/custom_client.go b/sdk/ai/azopenai/custom_client.go index 701fba27797a..9fb7f6df0d2e 100644 --- a/sdk/ai/azopenai/custom_client.go +++ b/sdk/ai/azopenai/custom_client.go @@ -243,14 +243,14 @@ type clientData struct { azure bool } -func getDeploymentID[T ChatCompletionsOptions | CompletionsOptions | EmbeddingsOptions | ImageGenerationOptions](v T) string { +func getDeployment[T ChatCompletionsOptions | CompletionsOptions | EmbeddingsOptions | ImageGenerationOptions](v T) string { switch a := any(v).(type) { case ChatCompletionsOptions: - return a.DeploymentID + return a.Deployment case CompletionsOptions: - return a.DeploymentID + return a.Deployment case EmbeddingsOptions: - return a.DeploymentID + return a.Deployment case ImageGenerationOptions: return "" default: diff --git a/sdk/ai/azopenai/custom_client_test.go b/sdk/ai/azopenai/custom_client_test.go index 8dc93029ae7e..f68e69f8c99f 100644 --- a/sdk/ai/azopenai/custom_client_test.go +++ b/sdk/ai/azopenai/custom_client_test.go @@ -97,10 +97,10 @@ func TestGetCompletionsStream_OpenAI(t *testing.T) { func testGetCompletionsStream(t *testing.T, client *azopenai.Client, tv testVars) { body := azopenai.CompletionsOptions{ - Prompt: []string{"What is Azure OpenAI?"}, - MaxTokens: to.Ptr(int32(2048)), - Temperature: to.Ptr(float32(0.0)), - DeploymentID: tv.Completions, + Prompt: []string{"What is Azure OpenAI?"}, + MaxTokens: to.Ptr(int32(2048)), + Temperature: to.Ptr(float32(0.0)), + Deployment: tv.Completions, } response, err := client.GetCompletionsStream(context.TODO(), body, nil) @@ -154,10 +154,10 @@ func TestClient_GetCompletions_Error(t *testing.T) { doTest := func(t *testing.T, client *azopenai.Client, model string) { streamResp, err := client.GetCompletionsStream(context.Background(), azopenai.CompletionsOptions{ - Prompt: []string{"What is Azure OpenAI?"}, - MaxTokens: to.Ptr(int32(2048 - 127)), - Temperature: to.Ptr(float32(0.0)), - DeploymentID: model, + Prompt: []string{"What is Azure OpenAI?"}, + MaxTokens: to.Ptr(int32(2048 - 127)), + Temperature: to.Ptr(float32(0.0)), + Deployment: model, }, nil) require.Empty(t, streamResp) assertResponseIsError(t, err) diff --git a/sdk/ai/azopenai/example_client_embeddings_test.go b/sdk/ai/azopenai/example_client_embeddings_test.go index 78ed1a3d8417..59a84337f358 100644 --- a/sdk/ai/azopenai/example_client_embeddings_test.go +++ b/sdk/ai/azopenai/example_client_embeddings_test.go @@ -38,8 +38,8 @@ func ExampleClient_GetEmbeddings() { } resp, err := client.GetEmbeddings(context.TODO(), azopenai.EmbeddingsOptions{ - Input: []string{"The food was delicious and the waiter..."}, - DeploymentID: modelDeploymentID, + Input: []string{"The food was delicious and the waiter..."}, + Deployment: modelDeploymentID, }, nil) if err != nil { diff --git a/sdk/ai/azopenai/example_client_getchatcompletions_test.go b/sdk/ai/azopenai/example_client_getchatcompletions_test.go index 950c625c246a..b424747d269e 100644 --- a/sdk/ai/azopenai/example_client_getchatcompletions_test.go +++ b/sdk/ai/azopenai/example_client_getchatcompletions_test.go @@ -64,8 +64,8 @@ func ExampleClient_GetChatCompletions() { resp, err := client.GetChatCompletions(context.TODO(), azopenai.ChatCompletionsOptions{ // This is a conversation in progress. // NOTE: all messages count against token usage for this API. - Messages: messages, - DeploymentID: modelDeploymentID, + Messages: messages, + Deployment: modelDeploymentID, }, nil) if err != nil { @@ -111,7 +111,7 @@ func ExampleClient_GetChatCompletions_functions() { } resp, err := client.GetChatCompletions(context.Background(), azopenai.ChatCompletionsOptions{ - DeploymentID: modelDeploymentID, + Deployment: modelDeploymentID, Messages: []azopenai.ChatMessage{ { Role: to.Ptr(azopenai.ChatRoleUser), @@ -220,9 +220,9 @@ func ExampleClient_GetChatCompletionsStream() { resp, err := client.GetChatCompletionsStream(context.TODO(), azopenai.ChatCompletionsOptions{ // This is a conversation in progress. // NOTE: all messages count against token usage for this API. - Messages: messages, - N: to.Ptr[int32](1), - DeploymentID: modelDeploymentID, + Messages: messages, + N: to.Ptr[int32](1), + Deployment: modelDeploymentID, }, nil) if err != nil { diff --git a/sdk/ai/azopenai/example_client_getcompletions_test.go b/sdk/ai/azopenai/example_client_getcompletions_test.go index 8b050d148ef1..66d94fdc45da 100644 --- a/sdk/ai/azopenai/example_client_getcompletions_test.go +++ b/sdk/ai/azopenai/example_client_getcompletions_test.go @@ -16,12 +16,12 @@ import ( func ExampleClient_GetCompletions() { azureOpenAIKey := os.Getenv("AOAI_API_KEY") - modelDeploymentID := os.Getenv("AOAI_COMPLETIONS_MODEL_DEPLOYMENT") + modelDeployment := os.Getenv("AOAI_COMPLETIONS_MODEL_DEPLOYMENT") // Ex: "https://.openai.azure.com" azureOpenAIEndpoint := os.Getenv("AOAI_ENDPOINT") - if azureOpenAIKey == "" || modelDeploymentID == "" || azureOpenAIEndpoint == "" { + if azureOpenAIKey == "" || modelDeployment == "" || azureOpenAIEndpoint == "" { fmt.Fprintf(os.Stderr, "Skipping example, environment variables missing\n") return } @@ -41,10 +41,10 @@ func ExampleClient_GetCompletions() { } resp, err := client.GetCompletions(context.TODO(), azopenai.CompletionsOptions{ - Prompt: []string{"What is Azure OpenAI, in 20 words or less"}, - MaxTokens: to.Ptr(int32(2048)), - Temperature: to.Ptr(float32(0.0)), - DeploymentID: modelDeploymentID, + Prompt: []string{"What is Azure OpenAI, in 20 words or less"}, + MaxTokens: to.Ptr(int32(2048)), + Temperature: to.Ptr(float32(0.0)), + Deployment: modelDeployment, }, nil) if err != nil { @@ -85,10 +85,10 @@ func ExampleClient_GetCompletionsStream() { } resp, err := client.GetCompletionsStream(context.TODO(), azopenai.CompletionsOptions{ - Prompt: []string{"What is Azure OpenAI, in 20 words or less?"}, - MaxTokens: to.Ptr(int32(2048)), - Temperature: to.Ptr(float32(0.0)), - DeploymentID: modelDeploymentID, + Prompt: []string{"What is Azure OpenAI, in 20 words or less?"}, + MaxTokens: to.Ptr(int32(2048)), + Temperature: to.Ptr(float32(0.0)), + Deployment: modelDeploymentID, }, nil) if err != nil { diff --git a/sdk/ai/azopenai/models.go b/sdk/ai/azopenai/models.go index 2eb3a62b490d..8173ce319754 100644 --- a/sdk/ai/azopenai/models.go +++ b/sdk/ai/azopenai/models.go @@ -237,8 +237,8 @@ type ChatCompletionsOptions struct { // The maximum number of tokens to generate. MaxTokens *int32 - // REQUIRED: DeploymentID specifies the name of the deployment (for Azure OpenAI) or model (for OpenAI) to use for this request. - DeploymentID string + // REQUIRED: Deployment specifies the name of the deployment (for Azure OpenAI) or model (for OpenAI) to use for this request. + Deployment string // The number of chat completions choices that should be generated for a chat completions response. Because this setting can // generate many completions, it may quickly consume your token quota. Use @@ -431,8 +431,8 @@ type CompletionsOptions struct { // The maximum number of tokens to generate. MaxTokens *int32 - // REQUIRED: DeploymentID specifies the name of the deployment (for Azure OpenAI) or model (for OpenAI) to use for this request. - DeploymentID string + // REQUIRED: Deployment specifies the name of the deployment (for Azure OpenAI) or model (for OpenAI) to use for this request. + Deployment string // The number of completions choices that should be generated per provided prompt as part of an overall completions response. // Because this setting can generate many completions, it may quickly consume @@ -579,8 +579,8 @@ type EmbeddingsOptions struct { // inferior results when newlines are present. Input []string - // REQUIRED: DeploymentID specifies the name of the deployment (for Azure OpenAI) or model (for OpenAI) to use for this request. - DeploymentID string + // REQUIRED: Deployment specifies the name of the deployment (for Azure OpenAI) or model (for OpenAI) to use for this request. + Deployment string // An identifier for the caller or end user of the operation. This may be used for tracking or rate-limiting purposes. User *string diff --git a/sdk/ai/azopenai/models_serde.go b/sdk/ai/azopenai/models_serde.go index 7af3419c5f09..ed13ca5ebf6d 100644 --- a/sdk/ai/azopenai/models_serde.go +++ b/sdk/ai/azopenai/models_serde.go @@ -481,7 +481,7 @@ func (c ChatCompletionsOptions) MarshalJSON() ([]byte, error) { populate(objectMap, "logit_bias", c.LogitBias) populate(objectMap, "max_tokens", c.MaxTokens) populate(objectMap, "messages", c.Messages) - populate(objectMap, "model", &c.DeploymentID) + populate(objectMap, "model", &c.Deployment) populate(objectMap, "n", c.N) populate(objectMap, "presence_penalty", c.PresencePenalty) populate(objectMap, "stop", c.Stop) @@ -519,7 +519,7 @@ func (c *ChatCompletionsOptions) UnmarshalJSON(data []byte) error { err = unpopulate(val, "Messages", &c.Messages) delete(rawMsg, key) case "model": - err = unpopulate(val, "Model", &c.DeploymentID) + err = unpopulate(val, "Model", &c.Deployment) delete(rawMsg, key) case "n": err = unpopulate(val, "N", &c.N) @@ -829,7 +829,7 @@ func (c CompletionsOptions) MarshalJSON() ([]byte, error) { populate(objectMap, "logit_bias", c.LogitBias) populate(objectMap, "logprobs", c.LogProbs) populate(objectMap, "max_tokens", c.MaxTokens) - populate(objectMap, "model", &c.DeploymentID) + populate(objectMap, "model", &c.Deployment) populate(objectMap, "n", c.N) populate(objectMap, "presence_penalty", c.PresencePenalty) populate(objectMap, "prompt", c.Prompt) @@ -868,7 +868,7 @@ func (c *CompletionsOptions) UnmarshalJSON(data []byte) error { err = unpopulate(val, "MaxTokens", &c.MaxTokens) delete(rawMsg, key) case "model": - err = unpopulate(val, "Model", &c.DeploymentID) + err = unpopulate(val, "Model", &c.Deployment) delete(rawMsg, key) case "n": err = unpopulate(val, "N", &c.N) @@ -1190,7 +1190,7 @@ func (e *Embeddings) UnmarshalJSON(data []byte) error { func (e EmbeddingsOptions) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "input", e.Input) - populate(objectMap, "model", &e.DeploymentID) + populate(objectMap, "model", &e.Deployment) populate(objectMap, "user", e.User) return json.Marshal(objectMap) } @@ -1208,7 +1208,7 @@ func (e *EmbeddingsOptions) UnmarshalJSON(data []byte) error { err = unpopulate(val, "Input", &e.Input) delete(rawMsg, key) case "model": - err = unpopulate(val, "Model", &e.DeploymentID) + err = unpopulate(val, "Model", &e.Deployment) delete(rawMsg, key) case "user": err = unpopulate(val, "User", &e.User)