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

Embeddings.create() got an unexpected keyword argument 'engine', when using ChromaDB #389

Closed
pedrurrego opened this issue Feb 14, 2024 · 2 comments

Comments

@pedrurrego
Copy link

pedrurrego commented Feb 14, 2024

Context ℹ️ 💁🏼‍♂️

I have a VectorDB with Chroma using OpenAI's Embeddings and created a retriever_model in dspy:

from dspy.retrieve.chromadb_rm import ChromadbRM
retriever_model = ChromadbRM(collection_name=COLLECTION_NAME, persist_directory=MY_PATH)

The following are my dependencies in the requirements.txt file. I am using Python 3.10.12.

chromadb==0.4.22
dspy-ai==2.1.9
openai==1.12.0
tiktoken==0.5.1

Problem 💩

When running

dspy.settings.rm("Who is Chuck Norris?")

I get the following error:

File [~/Library/CloudStorage/OneDrive-Personal/Code/AI/LLM/dspy/venv/lib/python3.10/site-packages/dspy/retrieve/chromadb_rm.py:139](139), in ChromadbRM._get_embeddings(self, queries)
    [125] """Return query vector after creating embedding using OpenAI
    [126]
    [127] Args:
   (...)
    [131]     List[List[float]]: List of embeddings corresponding to each query.
    [132] """
    [134] model_arg = {"engine": self.model_name,
    [135]     "deployment_id": self.model_name,
    [136]     "api_version": self.api_version,
    [137]     "api_base": self.api_base,
    [138] }
--> [139] embedding = self.openai_ef._client.create(
    [140]     input=queries, model=self._openai_embed_model, **model_arg, api_provider=self.openai_api_type
    [141] )
    [143] return [embedding.embedding for embedding in embedding.data]

TypeError: Embeddings.create() got an unexpected keyword argument 'engine'

Possible solution 👍🏼 ✅

I was able to solve it by using only input and model arguments in self.openai_ef._client.create() method, as shown below:

embedding = self.openai_ef._client.create(input=queries, model=self._openai_embed_model)

What do you guys think about this? Thanks in advance for your help!

@pedrurrego pedrurrego changed the title OpenAI Error when using ChromaDB as retriever Embeddings.create() got an unexpected keyword argument 'engine', when using ChromaDB Feb 14, 2024
lukaskuhn-lku pushed a commit to lukaskuhn-lku/dspy that referenced this issue Feb 15, 2024
@okhat
Copy link
Collaborator

okhat commented Feb 17, 2024

Ok solved(?) by merging #400. Let us know if all is good now. Thank you @lukaskuhn-lku and @animtel

@okhat okhat closed this as completed Feb 17, 2024
@okhat
Copy link
Collaborator

okhat commented Feb 17, 2024

Will be pushed to pypi on the next release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants