-
Notifications
You must be signed in to change notification settings - Fork 17
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
No access to the similarity_search_by_vector function #131
Comments
You can, by passing a keyword argument to the search method. It's not as straightforward as it used to be, because now it relies on a hidden keyword argument called So, if you call weaviate_vstore.similarity_search(..., search_method = "near_vector") It will call the if search_method == "hybrid":
embedding = self._embedding.embed_query(query)
result = collection.query.hybrid(
query=query, vector=embedding, limit=k, **kwargs
)
elif search_method == "near_vector":
result = collection.query.near_vector(limit=k, **kwargs) There's another problem though, in this block specifically elif search_method == "near_vector":
result = collection.query.near_vector(limit=k, **kwargs) The embedding of the query isn't being passed. I've raised an issue and made a PR for that. |
Ok - I had tried to use the search_method but like you said it didn't pass the vector - I like your solution much better. |
Remove `similarity_search_by_vector` since the same function can be done by hybrid search Fixes: * #132 * #131 Signed-off-by: hsm207 <[email protected]> --------- Signed-off-by: hsm207 <[email protected]>
@xindexer in this new integration, calling weaviate_vector_store.similarity_search(query="hello", k=5, alpha=1)
weaviate_vector_store.similarity_search(query=None, vector=[1, 2, 3], k=5, alpha=1) |
@xindexer
The hybrid search favors one search outcome over the other via a parameter called You can even control the weight on the level of the property. See here in the weaviate Docs That's why, you'll find in @hsm207 answer, he provides the |
There's no way to call for a near_vector search function (similarity_search_by_vector_function). One of the earlier versions had a "by_text" boolean that was used to switch to a vector search. If that is put back in then you can access it again.
if self._by_text: return self._perform_search(query, k, **kwargs) else: if self._embedding is None: raise ValueError( "_embedding cannot be None for similarity_search when " "_by_text=False" ) embedding = self._embedding.embed_query(query) return self.similarity_search_by_vector(embedding, k, **kwargs)
Not the best solution in my opinion, but it is working
The text was updated successfully, but these errors were encountered: