support Microsoft Azure OpenAI service endpoints
Problem
Describe the feature or improvement you're requesting Update the API configuration to support Azure openai endpoints as well. In order to use the Python OpenAI library with Microsoft Azure endpoints, we need to set the api_type, api_base and api_version in addition to the api_key. The api_type must be set to 'azure' and the others correspond to the properties of your endpoint. In addition, the deployment name must be passed as the engine parameter. python ========== import openai openai.api_type = "azure" openai.api_key = "..." openai.api_base = "https://example-endpoint.openai.azure.com" openai.api_version = "2022-12-01" create a completion completion = openai.Completion.create(engine="deployment-name", prompt="Hello world") print the completion print(completion.choices[0].text) Additional context _No response_
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: support Microsoft Azure OpenAI service endpoints
even simpler than the example from jtvcodes: you can add the headers/params to the configuration as baseOptions [code block] The completion call is then just [code block]
Trust Score
6 verifications
- 1
even simpler than the example from jtvcodes: you can add the headers/params to t
even simpler than the example from jtvcodes: you can add the headers/params to the configuration as baseOptions
- 2
The completion call is then just
[code block]
Validation
Resolved in openai/openai-node GitHub issue #53. Community reactions: 18 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep