Skip to content

Custom azureOpenAIApiBasePath should be applied also with azureADTokenProvider #5520

Closed
@aleclair-KoAi

Description

@aleclair-KoAi

Checked other resources

  • I added a very descriptive title to this issue.
  • I searched the LangChain.js documentation with the integrated search.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain.js rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).

Example Code

const model = new AzureChatOpenAI({
    azureADTokenProvider: azureADTokenProvider,
    azureOpenAIApiInstanceName: "myapp-api",
    azureOpenAIApiCompletionsDeploymentName: "mydeployment",
    azureOpenAIBasePath:
      "https://myapp-api.mydomain.com/openai/deployments",
    azureOpenAIApiDeploymentName: "maia-gpt-35-turbo-1106",
    azureOpenAIApiVersion: "2024-02-15-preview",
  });

Error Message and Stack Trace (if applicable)

Wrong url called, it will be https://myapp-api.openai.azure.com/openai/deployments/mydeployment/chat/completions instead of https://myapp-api.mydomain.com/openai/deployments/mydeployment/chat/completions
I also noted that I should use AZURE_OPENAI_API_DEPLOYMENT_NAME and AZURE_OPENAI_API_VERSION to get azureOpenAIApiDeploymentName and azureOpenAIApiVersion works

Description

  • I am trying to use langchain 0.2.1 to use Azure APIM to have Azure OpenAI with Oauth.
  • I have a custom url for this endpoint by langchain force to have an url ending by openai.azure.com with azureADTokenProvider
  • I want to use azureOpenAIBasePath and azureOpenAIApiDeploymentName to have ${azureOpenAIBasePath}/${azureOpenAIApiDeploymentName} url in getEndpoint function

System Info

langchain version: '0.2.1'
platform mac
node 18

Metadata

Metadata

Assignees

No one assigned

    Labels

    auto:bugRelated to a bug, vulnerability, unexpected error with an existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions