Langchain Embedding ConnectionError: HTTPSConnectionPool(host='openaipublic.blob.core.windows.net') #14323
Replies: 2 comments 2 replies
-
🤖 Hello @Faranak001, I'm Dosu, a bot here to assist you with any issues, questions, or contributions related to the LangChain repository. I'm here to provide preliminary support while we wait for a human maintainer. Looking forward to assisting you! Based on the information you've provided and similar issues in the LangChain repository, it seems like the connection error you're experiencing with LangChain's OpenAIEmbeddings might be due to the network configuration of your corporate server. Since your server has access to Azure OpenAI but not the public internet, you need to set up the environment variables correctly. The environment variables that need to be set are:
Here is an example of how you can set these environment variables: import os
os.environ["OPENAI_API_TYPE"] = "azure"
os.environ["OPENAI_API_BASE"] = "https://<your-endpoint.openai.azure.com/"
os.environ["OPENAI_API_KEY"] = "your AzureOpenAI key"
os.environ["OPENAI_API_VERSION"] = "2023-05-15"
os.environ["OPENAI_PROXY"] = "http://your-corporate-proxy:8080" After setting these environment variables, you can initialize the OpenAIEmbeddings class as follows: from langchain.embeddings.openai import OpenAIEmbeddings
embeddings = OpenAIEmbeddings(
deployment="your-embeddings-deployment-name",
model="your-embeddings-model-name",
openai_api_base="https://your-endpoint.openai.azure.com/",
openai_api_type="azure",
)
text = "This is a test query."
query_result = embeddings.embed_query(text) This will ensure that the OpenAIEmbeddings class uses the Azure OpenAI endpoint and the corporate proxy for its requests. You can find more information about this in the OpenAIEmbeddings class in the LangChain repository. If you're still experiencing issues after trying these steps, could you please provide more details about the exact error message you're receiving? This will help in further diagnosing the issue. Sources
This response is meant to be useful and save you time. 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. If you want to continue the conversation, start your reply with @dosu-bot. |
Beta Was this translation helpful? Give feedback.
-
I have a connection Error in general when calling llmchain @dosu-bot |
Beta Was this translation helpful? Give feedback.
-
I get connection error when running
We do not use any proxy.
I am trying to run the code on corporate server that does not have access to public internet but has access to Azure Openai.
I am not aware of any primate URL to add based on re suggestion in #13499
How can I get thi working?
Beta Was this translation helpful? Give feedback.
All reactions