BuilderIO / ai-shell

A CLI that converts natural language to shell commands.
MIT License
3.92k stars 238 forks source link

Add Azure OpenAI support #96

Closed akira-cn closed 1 month ago

akira-cn commented 10 months ago

Now you can use Microsoft azure openAI as your ai service.

  1. Set OPENAI_API_ENDPOINT to Azure-OpenAI's EndPoints and set AZURE_OPENAI_DEPLOYMENT to your developmentId.

  2. Use your azureApiKey as OPENAI_KEY.

e.g.

ai config set OPENAI_API_ENDPOINT=https://<your-endpoint>.openai.azure.com
ai config set AZURE_OPENAI_DEPLOYMENT=<your-deployment-id>
ai config set OPENAI_KEY=<your token>

Get more details please follow the instruction here.

steve8708 commented 10 months ago

thanks @akira-cn! can take a. look at this in a bit

steve8708 commented 10 months ago

code looks good to me, just need build to pass to merge

steve8708 commented 10 months ago

just about to merge this but looks like we've run into a merge conflict

Racle commented 9 months ago

Quick note, there probably should be check to remove trailing / in ai config set OPENAI_API_ENDPOINT as when you copy your endpoint from azure, it has trailing / in url.

And if that is there, ai-shell will just output:

{
  "error": {
    "code": "404",
    "message": "Resource not found"
  }
}

Don't ask me how I know :sweat_smile:

qingpengchen2011 commented 5 months ago

Need this feature. Will the conflicts be resolved?

huseyinulas commented 4 months ago

waiting for the pr

steve8708 commented 1 month ago

going to close this out given no activity, feel free to reopen if any updates