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
from embedchain import App
app = App()
app.add("https://www.forbes.com/profile/elon-musk")
context = app.search("What is the net worth of Elon?", num_documents=2)
print(context)
when used verbatim, raises this exception:
Traceback (most recent call last):
File "/home/gavid/crawler_test/test1.py", line 9, in <module>
context = app.search("What is the net worth of Elon?", num_documents=2)
File "/home/gavid/.asdf/installs/python/3.10.15/lib/python3.10/site-packages/embedchain/embedchain.py", line 712, in search
return [{"context": c[0], "metadata": c[1]} for c in self.db.query(**params)]
File "/home/gavid/.asdf/installs/python/3.10.15/lib/python3.10/site-packages/embedchain/vectordb/chroma.py", line 221, in query
result = self.collection.query(
File "/home/gavid/.asdf/installs/python/3.10.15/lib/python3.10/site-packages/chromadb/api/models/Collection.py", line 210, in query
query_request = self._validate_and_prepare_query_request(
File "/home/gavid/.asdf/installs/python/3.10.15/lib/python3.10/site-packages/chromadb/api/models/CollectionCommon.py", line 93, in wrapper
raise type(e)(msg).with_traceback(e.__traceback__)
File "/home/gavid/.asdf/installs/python/3.10.15/lib/python3.10/site-packages/chromadb/api/models/CollectionCommon.py", line 90, in wrapper
return func(self, *args, **kwargs)
File "/home/gavid/.asdf/installs/python/3.10.15/lib/python3.10/site-packages/chromadb/api/models/CollectionCommon.py", line 294, in _validate_and_prepare_query_request
validate_filter_set(filter_set=filters)
File "/home/gavid/.asdf/installs/python/3.10.15/lib/python3.10/site-packages/chromadb/api/types.py", line 339, in validate_filter_set
validate_where(filter_set["where"])
File "/home/gavid/.asdf/installs/python/3.10.15/lib/python3.10/site-packages/chromadb/api/types.py", line 598, in validate_where
raise ValueError(f"Expected where to have exactly one operator, got {where}")
ValueError: Expected where to have exactly one operator, got {} in query.
My python version: 3.10.15
My embedchain version: 0.1.125
The text was updated successfully, but these errors were encountered:
Hi there! I've taken a look at the issue you're experiencing with the Embedchain search method.
The error ValueError: Expected where to have exactly one operator, got {} in query suggests there might be an issue with how the search method is being called or how the database is configured.
# Try specifying explicit search parameterscontext=app.search("What is the net worth of Elon?",
num_documents=2,
where={}) # Explicitly pass an empty dict
Check Database State:
Make sure you've actually added documents to the database before searching. The example you provided adds a single URL, but ensure it's been processed:
app=App()
app.add("https://www.forbes.com/profile/elon-musk")
app.query() # Ensure database is populatedcontext=app.search("What is the net worth of Elon?", num_documents=2)
A few additional troubleshooting steps:
Verify you're using the latest version of Embedchain
Check that Chroma is properly installed
Ensure you have the necessary dependencies
Could you confirm:
Have you successfully added documents to the database before searching?
What version of Chroma and Embedchain are you using?
Can you share the full traceback and your complete initialization code?
Let me know if any of these suggestions help or if you need more detailed guidance!
🐛 Describe the bug
This example from the docs: https://docs.embedchain.ai/api-reference/app/search,
when used verbatim, raises this exception:
My python version: 3.10.15
My embedchain version: 0.1.125
The text was updated successfully, but these errors were encountered: