Closed garethcthomasdev closed 3 months ago
🤖
Hey @garethcthomasdev, great to see you diving into another challenge! 🚀
The Weaviate hybrid search interface is currently not available in the TypeScript library of LangChainJS. This could be due to various reasons such as development priorities, resource allocation, or the current focus of the TypeScript library's development.
However, you can perform a similarity search with filters using the WeaviateStore in the TypeScript library. The similaritySearch
method allows you to search the index with a filter. Here is an example:
// Create a store for an existing index
const store = await WeaviateStore.fromExistingIndex(new OpenAIEmbeddings(), {
client,
indexName: "Test",
metadataKeys: ["foo"],
});
// Search the index with a filter, in this case, only return results where
// the "foo" metadata key is equal to "baz", see the Weaviate docs for more
// https://weaviate.io/developers/weaviate/api/graphql/filters
const results2 = await store.similaritySearch("hello world", 1, {
where: {
operator: "Equal",
path: ["foo"],
valueText: "baz",
},
});
console.log(results2);
/*
[ Document { pageContent: 'hi there', metadata: { foo: 'baz' } } ]
*/
This code creates a WeaviateStore from an existing index and performs a similarity search with a filter. The filter is specified in the where
parameter of the similaritySearch
method. In this case, the filter is set to return results where the "foo" metadata key is equal to "baz".
You can find this example in the examples/src/indexes/vector_stores/weaviate_search.ts file in the LangChainJS repository.
As for the inclusion of a hybrid search interface in the TypeScript library similar to the one in the Python library, I couldn't find any information about this in the repository. It might be a feature that will be added in the future, but I can't confirm this at the moment.
It looks like it is possible to do compound filters - is there some documentation on this?
Hi, @garethcthomasdev,
I'm helping the langchainjs team manage their backlog and am marking this issue as stale. The issue was raised by you regarding the absence of the Weaviate hybrid search interface in the TypeScript library, seeking alternatives for creating a RAG system and filtering retrieved documents by multiple metadata fields and vector similarity. In response, I provided a detailed explanation and example of how to perform a similarity search with filters using the WeaviateStore in the TypeScript library. Additionally, you inquired about documentation for compound filters.
Could you please confirm if this issue is still relevant to the latest version of the langchainjs repository? If it is, please let the langchainjs team know by commenting on the issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days. Thank you!
Hi,
is there a reason that the weaviate hybrid search interface that is available in the python library
https://github.com/langchain-ai/langchain/blob/master/libs/community/langchain_community/retrievers/weaviate_hybrid_search.py is not yet available in the typescript library? are there good alternatives that I should explore - I have to create a RAG system and be able to filter the documents I retrieve from by multiple meta-data fields as well the vector similarity.
Thanks,
Gareth