Closed commenthol closed 4 days ago
Hey @commenthol! I'm here to help you with any bugs, questions, or contributions. Let's dig into this together!
The issue you're encountering seems to be related to how the similaritySearchVectorWithScore
method in the Chroma module handles the filter
parameter. By default, if no filter is provided, the method should perform a similarity search without any filtering criteria, considering all available vectors in the collection [1].
The proposed code change you mentioned aims to address this by setting the where
clause to undefined
if no filter is provided, which aligns with the expected behavior. This change should prevent the 400 Bad Request error when no filter is specified, allowing the search to proceed without filtering.
If you implement this change, it should resolve the issue by ensuring that the where
clause is only applied when a filter is explicitly defined. This approach maintains the flexibility of querying without mandatory filters, which seems to be the intended functionality.
To continue talking to Dosu, mention @dosu.
Oh dear, thank you!
Checked other resources
Example Code
Error Message and Stack Trace (if applicable)
Description
I am trying to use chroma through langchain to search for vector embeddings.
If documents do not contain general metadata to filter for a 400 Bad Request is returned.
Only if all documents contain e.g.
{ ..., metadata: { source: '1' } }
results can be found withawait vectorStore.similaritySearch('biology', 1, { source: '1' } )
IMO querying should work without any filter being set.
I'd propose the following code change: https://github.com/langchain-ai/langchainjs/blob/main/libs/langchain-community/src/vectorstores/chroma.ts
System Info
platform: mac
package.json