Skip to content
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

Unable to get PR-Agent GitHub Action to use Azure OpenAI #364

Closed
JyrkiHei opened this issue Oct 8, 2023 · 7 comments
Closed

Unable to get PR-Agent GitHub Action to use Azure OpenAI #364

JyrkiHei opened this issue Oct 8, 2023 · 7 comments
Labels

Comments

@JyrkiHei
Copy link

JyrkiHei commented Oct 8, 2023

Hi!
Asked this on discord also, but was redirected here. Tried to find a solution, but did not find anything matching. I'm trying to setup the GitHub Action version of PR-Agent to give review or description on our GitHub PR changes. We want to use our own instance of Azure OpenAi Service instead of the "public" OpenAi service. Deployment_ID is the name of the deployed model in Azure OpenAI Service and the model is 'gpt-35-turbo'.lso I want to use Azure OpenAI Service, but I seem to get this error all the time*openai.error.AuthenticationError: Incorrect API key provided:**.

I cannot use GPT4 right now, the 'gpt-latest' deployment is gpt-35-turbo -model.

When I run the github action with these environment variables (key and github token naturally masked, tried also adding that config.model) I get this error saying that the OpenAI key is wrong and shows URL where I can get those API keys. But I want to use our own Azure OpenAI instance instead.... I'm really confused what environment variables should I set to get this working 😦

image

And I don't have any .secrets.toml or configuration.toml files in my repository... Not sure if I should have or not if I'm using these env variables.

Only results I get from running this GitHub action is ~400 lines of python error logging and in the error it says couple of times 'openai.error.AuthenticationError: Incorrect API key provided: **. You can find your API key at https://platform.openai.com/account/api-keys.'

Any ideas? (I was requested to tag you @krrishdholakia, if you could help)

@mrT23
Copy link
Collaborator

mrT23 commented Oct 9, 2023

@krrishdholakia does litellm support this kind of deployment?
it does seem to follow: https://github.com/Codium-ai/pr-agent/blob/main/Usage.md#azure

@krrishdholakia
Copy link
Contributor

Hey @JyrkiHei @mrT23 if i understand this - are you asking if litellm lets you set your azure deployment id as an environment variable?

isn't this already being read from the environment and passed here?

Screenshot 2023-10-09 at 8 07 11 AM

@mrT23
Copy link
Collaborator

mrT23 commented Oct 9, 2023

@JyrkiHei
can you try debugging it from CLI ? i suspect there might be some naming issue

pr_agent/algo/pr_processing.py, line 240

def _get_all_deployments(all_models: List[str]) -> List[str]:
    deployment_id = get_settings().get("openai.deployment_id", None)

so maybe the var name should be
'openai.deployment_id'

I suggest catching a breaking there, and making sure you are able to pass the deployment_id

@JyrkiHei
Copy link
Author

JyrkiHei commented Oct 9, 2023

I think that was it @mrT23! Thank you!

I changed my configuration to this (not sure yet if all values are needed, because I was just testing around):

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:
      OPENAI_KEY: ${{ secrets.AZURE_OPENAI_KEY }}
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      OPENAI_API_TYPE: 'azure'
      OPENAI_API_VERSION: '2023-07-01-preview'
      OPENAI_API_BASE: 'https://genai-xxxx-xxxx.openai.azure.com'
      OPENAI.DEPLOYMENT_ID: 'gpt-latest'
      OPENAI.CONFIG_MODEL: 'gpt-35-turbo'

@mrT23
Copy link
Collaborator

mrT23 commented Oct 9, 2023

great 💯

will update the docs

@mrT23 mrT23 added the solved label Oct 9, 2023
@mrT23 mrT23 closed this as completed Oct 10, 2023
@nandantws
Copy link

Similar Issues


  1. [Feature request] Azure API not well supported / documented (score=0.90)

  2. Unrecognized request argument supplied: azure on GitHub Actions (score=0.89)

  3. Unable to use Github Action anymore (score=0.89)

  4. Issue on github action (score=0.86)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants