You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the Gptcache.core to work with the Azure Openai adapter the code is as shown below
`@staticmethod
def set_azure_openai_key():
import_openai()
import openai # pylint: disable=C0415
So we can confirm that gptcache works with openai version 0.28
But the issuse is if we can see the gptcache.embeddings. openai the code is as below where we are calling openai to embed the text . Here we are providing parameter model=self.model to openai which should be changed to engine=self.model if we are working with openai version 0.28 and model =self.model if we work with version 1.x
`def to_embeddings(self, data, **_):
"""Generate embedding given text input
:param data: text in string.
:type data: str
:return: a text embedding in shape of (dim,).
"""
sentence_embeddings = openai.Embedding.create(model=self.model, input=data, api_base=self.api_base)
return np.array(sentence_embeddings["data"][0]["embedding"]).astype("float32"`
Because of the above param prblm i faced with the below error Must provide an 'engine' or 'deployment_id' parameter to create a <class 'openai.api_resources.embedding.Embedding'>
Solved the issue by changing the param model to engine in gptcache.embeddings.openai file
Current Behavior
In the Gptcache.core to work with the Azure Openai adapter the code is as shown below
`@staticmethod
def set_azure_openai_key():
import_openai()
import openai # pylint: disable=C0415
cache = Cache()
`
Here the version of openai is 0.28 because in openai version 0.28 we set the endpoint as openai.api_base where as in openai version >=1.x we set endpoint as azure_endpoint
you can refer the below link where the format is defined.
https://learn.microsoft.com/en-us/azure/ai-services/openai/quickstart?tabs=command-line%2Cpython-new&pivots=programming-language-python
So we can confirm that gptcache works with openai version 0.28
But the issuse is if we can see the gptcache.embeddings. openai the code is as below where we are calling openai to embed the text . Here we are providing parameter model=self.model to openai which should be changed to engine=self.model if we are working with openai version 0.28 and model =self.model if we work with version 1.x
`def to_embeddings(self, data, **_):
"""Generate embedding given text input
you can refer to the microsoft documents for the syntax of embeddings for openai version 0.28 and >=1.x
https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/embeddings?tabs=python
Because of the above param prblm i faced with the below error
Must provide an 'engine' or 'deployment_id' parameter to create a <class 'openai.api_resources.embedding.Embedding'>
Solved the issue by changing the param model to engine in gptcache.embeddings.openai file
Expected Behavior
No response
Steps To Reproduce
No response
Environment
No response
Anything else?
https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/embeddings?tabs=python
The text was updated successfully, but these errors were encountered: