GPTCache icon indicating copy to clipboard operation
GPTCache copied to clipboard

[Feature]: Support for Azure OpenAI

Open amrit2cisco opened this issue 2 years ago • 2 comments

Is your feature request related to a problem? Please describe.

We are currently using Azure OpenAI to make API calls, seems that GPTCache only supports using the standard OpenAI API keys and it isn't possible to route the requests through Azure

Describe the solution you'd like.

OpenAI's library allows us to specify to route the requests through Azure with the following config:

openai.api_type = "azure"
openai.api_version = "2023-05-15"
openai.api_key = "<api key>"
openai.api_base = "https://<tenant>.openai.azure.com/"
model = "gpt-35-turbo"

Including support to do this through the GPTCache OpenAI adapter would be the way to replicate the same for GPTCache

Describe an alternate solution.

N/A

Anything else? (Additional Context)

No response

amrit2cisco avatar Nov 13 '23 22:11 amrit2cisco

@amrit2cisco Do you mean to also introduce these constants in the openai file under gptcache?

SimFG avatar Nov 14 '23 02:11 SimFG

@SimFG yes, and particularly the Azure OpenAI API key (which is fundamentally different from the vanilla OpenAI API Key) should be able to be used to route the requests to api_base in the absence of a standard OpenAI API key

amrit2cisco avatar Nov 14 '23 18:11 amrit2cisco