Support Use of LLM's Deployed in Azure Open AI #20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
While the package abstracts away the llm connections in a very useful way, being unable to uniquely configure the langchain llm instantiation means that Azure OpenAI can't be used. The reason for this is that in lanchain, Azure deployed LLM's require different arguments than standard openai llm's do.
This Fix
This fix introduces bare minimum functionality to allow promptimize to work with Azure OpenAI. LangChain accepts the OPENAI_API_TYPE=='azure' environment variable, but when this is present it expects at least a deployment name to accompany the modelname. base url and key are passed via environment variables the same as a non-azure deployment.
With this fix, Azure users can simply provide the api type of 'azure' accompanies by an environment variable of AZURE_DEPLOYMENT_NAME, and the promptimize tests will work for them like they do for OpenAI deployments.
Benefits to Maintainers
Issues raised by Azure users will have a clear path to resolution after this merge. In addition, this unlocks individual and corporate adoption for Azure users, a large cohort of the LLM consumption community.