openai icon indicating copy to clipboard operation
openai copied to clipboard

Support Azure OpenAI.

Open zmhu opened this issue 1 year ago • 4 comments

I have a suggestion, can Azure OpenAI's API also be supported? If there is no time for development, I can also take care of it.

zmhu avatar Dec 12 '23 07:12 zmhu

Please do, it was previously requested so I started an azure branch but I couldn't test it personally since I can't have an Azure OpenAI access.

it is really highly appreciated, during your support for it I can help as well.

anasfik avatar Dec 13 '23 18:12 anasfik

I modified the code and tailored it for ChatGPT, then I made updates to the README file. You can find the code in this branch (https://github.com/geeker-ai/dart_openai/tree/azure). Your review is much appreciated. This is the most basic adaptation I could conceive of. If you find this approach feasible, I can customize it for other models compatible with Azure.

zmhu avatar Dec 15 '23 11:12 zmhu

@zmhu I've tested your modified code and I encountered an issue: "The method 'configureRestAPI' isn't defined for the type 'AzureOpenAi'." Could there be something I overlooked?

 // Set your API key
  AzureOpenAI.apiKey = Env.apiKey;

  // Set your resource name and deployment name
  AzureOpenAI.configureRestAPI(
    yourResourceName: "your_resource_name",
    yourDeploymentName: "your_deployment_name",
    apiVersion: DateTime(2023, 06, 01),
  );

Same behavior with the example. Thanks

MrHazee avatar Dec 16 '23 22:12 MrHazee

Hi there, could you please provide an update on the current status of this feature? Thank you!

BartoszRudnik avatar Mar 20 '24 10:03 BartoszRudnik

@zmhu @anasfik I will take on this issue as I have a paid account and can do the full testing. I will further update this branch.

tyler-jewell avatar Oct 23 '24 02:10 tyler-jewell

@zmhu @anasfik do we want to try to place everything into the OpenAI singleton instead of creating a new "AzureOpenAI" class?

It's all OpenAI at the end of the day.

tyler-jewell avatar Oct 23 '24 04:10 tyler-jewell