langchain
langchain copied to clipboard
[Azure] Centralizing Environment Validation for Azure OpenAI LLM & Chat Model & Embeddings Model
Description
References Issue #3769. Ports over functionality from AzureChatOpenAI to AzureOpenAIMixin to standardize interaction experience with Azure models.
Changes
- Added
AzureOpenAIMixin - Changed
AzureOpenAIto inherit fromAzureOpenAIMixin - Changed
AzureChatOpenAIto inherit fromAzureOpenAIMixin - Added relevant docstrings
- Added
AzureOpenAIEmbeddingmodel - Added client type (openai.Completion...etc) validation
Testing
- Ran on Jupyter Notebook
@hwchase17
can this also be used in embeddings?
Yes, it can. I'll adjust the PR tomorrow with an Azure class for embeddings. Might have to add a slight modification to the Mixin class to pass in the client (previous is openai.ChatCompletion) but embeddings is openai.Embedding.
can this also be used in embeddings?
Yes, it can. I'll adjust the PR tomorrow with an Azure class for embeddings. Might have to add a slight modification to the Mixin class to pass in the client (previous is openai.ChatCompletion) but embeddings is openai.Embedding.
well the LLM class should also not be ChatCompletion but Completion, right?
can this also be used in embeddings?
Yes, it can. I'll adjust the PR tomorrow with an Azure class for embeddings. Might have to add a slight modification to the Mixin class to pass in the client (previous is openai.ChatCompletion) but embeddings is openai.Embedding.
well the LLM class should also not be ChatCompletion but Completion, right?
Yes - good catch. Created a new commit that allocates the correct client per model type along with adding the AzureEmbeddings class.
@philipk19238 Hi , could you, please, resolve the merging issues and address the last comments (if needed)? After that, ping me and I push this PR for the review. Thanks!
Closing because the PR wouldn't line up with the current directory structure of the library (would need to be in /libs/langchain/langchain instead of /langchain). Feel free to reopen against the current head if it's still relevant!