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

Updated embedding to work with OpenAI's Python v1.3+ and with Azure O… #569

Open
wants to merge 7 commits into
base: dev
Choose a base branch
from
Prev Previous commit
Next Next commit
Updated init to correctly pass variables to OpenAi/AzureOpenAi embedd…
…ings
jmahmood committed Nov 18, 2023
commit 07f0261adba89545a240bba30fa6ce8da06005e6
8 changes: 6 additions & 2 deletions gptcache/embedding/__init__.py
Original file line number Diff line number Diff line change
@@ -37,8 +37,12 @@ def Cohere(model="large", api_key=None):
return cohere.Cohere(model, api_key)


def OpenAI(model="text-embedding-ada-002", api_key=None):
return openai.OpenAIEmbedding(model, api_key)
def OpenAI(client, model="text-embedding-ada-002"):
return openai.OpenAIEmbedding(client, model)


def AzureOpenAI(client, model="text-embedding-ada-002"):
return azureopenai.AzureOpenAIEmbedding(client, model)


def Huggingface(model="distilbert-base-uncased"):
9 changes: 6 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
numpy
cachetools
requests
numpy~=1.26.2
cachetools~=5.3.2
requests~=2.31.0
pydantic~=2.5.1
httpx~=0.25.1
setuptools~=60.2.0