-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configuration using OpenAI API hosted on Azure #2013
Comments
Answer generated by a 🤖 AnswerI understand that you're having trouble configuring the OpenAI API on Azure with LangChain. Specifically, you're encountering an issue when creating the vector store with the OpenAIEmbedding class, and you're not sure how to correctly set up the endpoint URL for Azure OpenAI. From my understanding, the To address this issue, you should ensure that the Here's an example of how you might set up your configuration: const config: OpenAIEndpointConfig = {
azureOpenAIApiDeploymentName: 'my-openai-deployment',
azureOpenAIApiInstanceName: 'my-instance-name',
azureOpenAIApiKey: 'my-api-key',
azureOpenAIBasePath: 'https://westeurope.api.cognitive.microsoft.com',
};
const endpoint = getEndpoint(config); In this example, Please replace This is just one potential solution based on the information you've provided. If you're still encountering issues after checking your configuration, it might be a problem with the Azure OpenAI service itself. If you find this solution helpful and believe it might be useful to others, I encourage you to make a pull request to update the documentation. This way, other users who encounter the same issue can benefit from your experience. SourcesThis response is meant to be useful, save you time, and share context. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. |
Hey @gclem, with the base path the URL to Azure is created like this:
Can you try that? |
Thanks, it works for static API url overwritting. |
Hi,
There are 2 cases of handling API URL on Azure :
First one is generated from the instance name in .env file
AZURE_OPENAI_API_INSTANCE_NAME=''
Documented here
/** * Azure OpenAI API deployment name to use for completions when making requests to Azure OpenAI. * This is the name of the deployment you created in the Azure portal. * e.g. "my-openai-deployment" * this will be used in the endpoint URL: https://{InstanceName}.openai.azure.com/openai/deployments/my-openai-deployment/ */ azureOpenAIApiDeploymentName?: string;
Second one, is static.
From what I can see with my account, there are differents typologies of clusters, depending the location of deployement (Azure region)
My second cluster has a generic url path :
AZURE_OPENAI_BASE_PATH=https://westeurope.api.cognitive.microsoft.com/
I have an issue, during the creation of the vector store (seems the class OpenAIEmbedding), not using the overwriten BASEPATH in the config file.
creating vector store... error Error: getaddrinfo ENOTFOUND [instanceName].openai.azure.com at __node_internal_captureLargerStackTrace (node:internal/errors:496:5) at __node_internal_ (node:internal/errors:715:10) at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:118:26) { errno: -3008, code: 'ENOTFOUND',
In ingest-data.ts
const embeddings = new OpenAIEmbeddings();
Any example on making Embedding works without updating the code with Azure on your side folks?
The text was updated successfully, but these errors were encountered: