Skip to content

Commit

Permalink
langchain-openai[patch]: fix #5520
Browse files Browse the repository at this point in the history
  • Loading branch information
jeasonnow committed May 23, 2024
1 parent 4839804 commit 74ecce6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions libs/langchain-openai/src/azure/llms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,13 @@ export class AzureOpenAI extends OpenAI {
) {
const newFields = fields ? { ...fields } : fields;
if (newFields) {
newFields.azureOpenAIApiDeploymentName = newFields.deploymentName;
newFields.azureOpenAIApiKey = newFields.openAIApiKey;
newFields.azureOpenAIApiVersion = newFields.openAIApiVersion;
// don't rewrite the fields if they are already set
newFields.azureOpenAIApiDeploymentName =
newFields.azureOpenAIApiDeploymentName ?? newFields.deploymentName;
newFields.azureOpenAIApiKey =
newFields.azureOpenAIApiKey ?? newFields.openAIApiKey;
newFields.azureOpenAIApiVersion =
newFields.azureOpenAIApiVersion ?? newFields.openAIApiVersion;
}

super(newFields);
Expand Down
2 changes: 1 addition & 1 deletion libs/langchain-openai/src/utils/azure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function getEndpoint(config: OpenAIEndpointConfig) {
} = config;

if (
azureOpenAIApiKey &&
(azureOpenAIApiKey || azureADTokenProvider) &&
azureOpenAIBasePath &&
azureOpenAIApiDeploymentName
) {
Expand Down

0 comments on commit 74ecce6

Please sign in to comment.