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

Add support for Azure OpenAI #106

Closed
wants to merge 2 commits into from
Closed

Conversation

kw217
Copy link

@kw217 kw217 commented Apr 11, 2023

This PR adds support for the Azure OpenAI service, which is an alternate API for accessing the OpenAI models. In the initial-config wizard it adds a question Use OpenAI via Azure? (default no), and if the answer is yes it asks for the endpoint and deployment name. It stores these in the config file under new keys. It also adds support for max_tokens (on both APIs), since the Azure max_tokens default is very low.

Details:

If aoai_endpoint is set, then use Azure OpenAI endpoint rather than the direct OpenAI endpoint. Requires aoai_deployment to be specified as well. You should set the model too, so that aichat knows the correct number of remaining tokens.

Also adds support for max_tokens since the AOAI default is very low.

The Azure OpenAI API currently requires chats to be encoded as completions, so logic to do this is added as well.

Tested with gpt-35-turbo (version 0301).

kw217 and others added 2 commits April 5, 2023 14:38
If `aoai_endpoint` is set, then use Azure OpenAI endpoint rather than
the direct OpenAI endpoint. Requires `aoai_deployment` to be specified
as well. You should set the model too, so that aichat knows the correct
number of remaining tokens.

Also adds support for `max_tokens` since the AOAI default is very low.

The Azure OpenAI requires chats to be encoded as completions, so logic
to do this is added as well.
* Add `aoai_use_chat` option - GPT-4 requires the use of the chat API, whereas GPT-3.5 accepts both
* Report new config setting in .info
---------

Co-authored-by: Keith Wansbrough <kwansbrough@microsoft.com>
@kw217
Copy link
Author

kw217 commented Apr 28, 2023

@sigoden please could you approve the workflow so I can see if this builds correctly?

@sigoden
Copy link
Owner

sigoden commented Oct 26, 2023

After pr #150, aichat supports multiple clients.

It would be better to add an independent azure-openai client. @kw217 @FalacerSelene

@sigoden
Copy link
Owner

sigoden commented Oct 29, 2023

see #166

@sigoden sigoden closed this Oct 29, 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

Successfully merging this pull request may close these issues.

3 participants