-
Notifications
You must be signed in to change notification settings - Fork 121
Azure OpenAI LLM implementation #188
Azure OpenAI LLM implementation #188
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall direction seems good, main changes is:
- env loading should be handled by client or by explicit passing parameters
- llm object creation in app.py
- adding proper docstrings and adding readme
Thanks for your review @miararoy Happy to know the direction is the correct one. |
Adressed review comments:
|
17b1174
to
b347120
Compare
Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MichaelAnckaert Thank you very much for your contribution!!
Please see a few required changes.
Also, please note that tests are required - a unit test for OpenAIRecordEncoder
and a system test for OpenAILLM
(see comments inline).
@MichaelAnckaert there hasn't been any activity in this PR since the review two weeks ago. |
This better conforms with our code base styling
Inheriting from OpenAI allows simplifying the implementation
To conform with our coding style
For very specific model versions and API version - AzureOpenAI's function calling capability simply works like regular OpenAI. For all other deployments - we will simply error out
This way derived classes like AzureOpenAILLM can handle the errors more explicitly
Instead of a dedicated, copy-pasted test file, I paramerteized the existing test_openai file to test both OpenAI and AzureOpenAI classes.
Improve OpenAI and AzureOpenAI's error handling messages
Give a more explicit error in FunctionCallingQueryGenerator if we suspect that function calling isn't supported.
Changed to new format + minimal changes required for using AzureOpenAI
|
GitGuardian id | Secret | Commit | Filename | |
---|---|---|---|---|
- | Generic High Entropy Secret | 1f3add7 | tests/system/llm/test_azure_openai.py | View secret |
- | Generic High Entropy Secret | 2c80fbd | tests/system/llm/test_azure_openai.py | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secrets safely. Learn here the best practices.
- Revoke and rotate these secrets.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
Our GitHub checks need improvements? Share your feedbacks!
@MichaelAnckaert Thank you very much for your contribution!! Since this PR has been inactive, we have finalized it with all missing tests and prepared it for merging. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM overall, look at the minor suggestions. I mainly think we should decide if api version goes to env vars or config, and can consider enable model name in config at some sense
config/azure.yaml
Outdated
type: AzureOpenAILLM # Options: [OpenAILLM, AzureOpenAILLM] | ||
params: | ||
model_name: your-deployment-name # Specify the name of the LLM deployment to use. | ||
api_version: 2023-07-01 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this should come from env var, we shouldn't mix env vars and config
def __init__( | ||
self, | ||
*, | ||
model_name: str = "text-embedding-ada-002", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we shouldn't have this default, the user is more likely to have a different name. I'm not sure if it breaks our config with defaults pattern since azure encoder is not a default encoder. If it breaks and complicate stuff we can leave it as is for now
- Bump pinecone-text version - Add error handling - Add system tests - Finalize the config
The fixture is shared across multiple test files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Code changed and approved
The CI workflow needs these secrets to run the AzureOpenAI tests
Problem
Canopy can't be used with the Azure OpenAI offering.
Solution
This PR creates a new AzureOpenAILLM class (inherits from OpenAILLM) to be used with the Azure OpenAI offering.
Type of Change
Test Plan
No tests added yet.