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

How do you add an Azure ChatGPT deployment as the OPENAI_API_BASE? #191

Closed
dnhkng opened this issue Oct 17, 2023 · 2 comments
Closed

How do you add an Azure ChatGPT deployment as the OPENAI_API_BASE? #191

dnhkng opened this issue Oct 17, 2023 · 2 comments

Comments

@dnhkng
Copy link

dnhkng commented Oct 17, 2023

Hi,

I have access to ChatGPT via Azure, and I can access it with curl:

curl "https://my_deployment.openai.azure.com/openai/deployments/my_gpt35turbo/completions?api-version=2023-05-15"\
  -H "Content-Type: application/json" \
  -H "api-key: my_secret_key" \
  -d "{
  \"prompt\": \"Once upon a time\",
  \"max_tokens\": 50
}"   

How do I use this with Chatdev? I've tried multiple ways, like this:

OPENAI_API_BASE="https://my_deployment.openai.azure.com/openai/deployments/my_gpt35turbo?api-version=2023-05-15" OPENAI_API_KEY=my_secret_key python3 run.py --task "Snake game in pure html" --name "WebSnake"

But I always see this in the logs:
[2023-17-10 09:03:10 INFO] error_code=404 error_message='Resource not found' error_param=None error_type=None message='OpenAI API error received' stream_error=False

Any tips on how to correctly set the OPENAI_API_BASE for Azure users? Does the deployment name have to match? ie it must be set as 'GPT_3_5_TURBO' on Azure? Or can I modify that in the ChatDev code?

Thanks!

@dnhkng
Copy link
Author

dnhkng commented Oct 17, 2023

UPDATE: OK, I have gotten a bit further:

OPENAI_API_BASE="https://my_deployment.openai.azure.com/" OPENAI_API_TYPE=azure OPENAI_API_MODEL=my_model OPENAI_API_VERSION=2023-05-15 OPENAI_API_KEY= my_secret_key python3 run.py --task "Snake game in pure html" --name "WebSnake"

This solves the 'Resource not found' error, but now generates this error:

Must provide an 'engine' or 'deployment_id' parameter to create a <class 'openai.api_resources.chat_completion.ChatCompletion'>

Im not sure what ''engine' or 'deployment_id' should be but adding:
OPENAI_API_ENGINE=my_model
to the command does not help.

@dnhkng
Copy link
Author

dnhkng commented Oct 17, 2023

OK, fixed in pull #192

@dnhkng dnhkng closed this as completed Oct 18, 2023
@wyifei26 wyifei26 mentioned this issue Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant