Open alphrc opened 3 weeks ago
This issue remains even if you use embed_query instead of embed_documents
It's not the bug in Langchain for sure as I explored Similarity_search
as well as similarity_search_by_vector
methods using HuggingFaceEmbeddings in Langchain framework itself and got the exactly same results from both.
db = Chroma.from_documents(texts,huggingface_embeddings)
query = "what happened to harry's parents ?"
results_text = db.similarity_search(query)
vector = huggingface_embeddings.embed_documents([query])[0]
results_vector = db.similarity_search_by_vector(vector)
if (results_text == results_vector):
print("True")
else:
print("False")
The output which came was "True" .
similarity_search_with_vector
in langchain_chroma integrational framework , so replace it with similarity_search_by_vector
.
Checked other resources
Example Code
Error Message and Stack Trace (if applicable)
No response
Description
Using the same embedding function, searching with text and searching with vector would get different results.
System Info
langchain==0.2.11 langchain-chroma==0.1.2 langchain-community==0.2.10 langchain-core==0.2.23 langchain-openai==0.1.17 langchain-text-splitters==0.2.2
max
python 3.9.6