-
Notifications
You must be signed in to change notification settings - Fork 621
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
[Feature request] Azure API not well supported / documented #245
Comments
Hi @TomDarmon if get_settings().get("OPENAI.API_TYPE", None):
if get_settings().openai.api_type == "azure":
self.azure = True
litellm.azure_key = get_settings().openai.key Fill in the commented fields in the configuration file (.secrets.toml) or through environment variables. [openai]
key = "" # Acquire through https://platform.openai.com
#org = "<ORGANIZATION>" # Optional, may be commented out.
# Uncomment the following for Azure OpenAI
#api_type = "azure"
#api_version = '2023-05-15' # Check Azure documentation for the current API version
#api_base = "" # The base URL for your Azure OpenAI resource. e.g. "https://<your resource name>.openai.azure.com"
#deployment_id = "" # The deployment name you chose when you deployed the engine
#fallback_deployments = [] # For each fallback model specified in configuration.toml in the [config] section, specify the appropriate deployment_id |
Thanks for the reply @okotek ! So if I understand correctly, by just setting the env variables like this it should work ? on:
pull_request:
jobs:
pr_agent_job:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
contents: write
name: Run pr agent on every pull request, respond to user comments
steps:
- name: PR Agent action step
id: pragent
uses: Codium-ai/pr-agent@main
env:
API_TYPE: "azure"
DEPLOYMENT_ID: "gpt-4" # custom name of the deployed model on Azure
OPENAI_KEY: ${{ secrets.AZURE_API_KEY }}
API_BASE: ${{ secrets.API_BASE }}
API_VERSION: ${{ secrets.API_VERSION }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} EDIT: It looks like this code doesn't work, below is the traceback. The exact same credentials work using litellm.
An interesting observation is that if I use Do you have any idea what I am doing wrong ? |
We use Dynaconf for configuration, the syntax for environment variables is <SECTION>.<KEY>, so you should add "OPENAI." for the OpenAI variables, for example: |
@TomDarmon I'm the maintainer of LiteLLM - was this solved for you ? Here's how azure calls work with litellm from litellm import completion
response= completion('your-azure-deployment-name', messages, custom_llm_provider="azure") Make sure your .env contains the following variables: Here's a link to our docs Here's my calendly: happy to hop on a call and help out :https://calendly.com/ishaan-berri/30min |
@mrT23 @TomDarmon i'll make a PR to improve docs on this |
Made a PR for this - #276 |
Can we close this now as the PR has been merged @TomDarmon @mrT23 |
/similar_issue |
Similar Issues: |
Hello!
I am currently learning how to use a PR agent. I would like to use the Azure API instead of the OpenAI key using GitHub Actions.
There is no documentation available, but it seems that the code can be modified locally with minor adjustments to make it work.
It appears that with minimal effort, it could be added for the GitHub Actions deployment method.
I believe there are two changes that need to be made to make it possible:
AiHandler
needs to dynamically set theazure
attribute based on a configured value to specify Azure deployment.open_ai.api_base
andopen_ai.api_version
, should be passed as GitHub Actions secrets/configurations.I'm new to the repository so I'm unsure if I'm missing something, if it's already possible to use the azure API using github actions I would be super grateful if you could document it 🙏
The text was updated successfully, but these errors were encountered: