TNG / please-cli

An AI helper for creating CLI commands
Apache License 2.0
71 stars 17 forks source link

Feature Request: enable Azure OpenAPI #41

Open lipkau opened 6 months ago

lipkau commented 6 months ago

Hello.

I would love to use your tool; unfortunately I am restricted to use LLMs hosted by my company. I have an Azure hosted OpenAPI and would love to be able to overwrite the API endpoint.

Here is an example of a request:

curl https://MY_RESOURCE_NAME.openai.azure.com/openai/deployments/MY_DEPLYOMENT_NAME/chat/completions?api-version=2023-05-15 \
  -H "Content-Type: application/json" \
  -H "api-key: MY_API_KEY" \
  -d '{"messages":[{"role": "system", "content": "You are a helpful assistant."},{"role": "user", "content": "Does Azure OpenAI support customer managed keys?"},{"role": "assistant", "content": "Yes, customer managed keys are supported by Azure OpenAI."},{"role": "user", "content": "Do other Azure AI services support this too?"}]}'

docs

here is an implementation from a raycast plugin which supports both openai.com and azure: https://github.com/raycast/extensions/blob/beb950d86ecebbb2d8f6e6d27cbadd0959f9ca11/extensions/chatgpt/src/hooks/useChat.tsx

lipkau commented 6 months ago

I created a POC here: https://github.com/TNG/please-cli/pull/42

I didn't write documentation in the readme yet. I would do so once I get feedback if this change is worth the while.