Skip to content

Bug in from langchain_google_genai import GoogleGenerativeAIEmbeddings.embed_query #902

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

Open
nasheedyasin opened this issue May 5, 2025 · 2 comments · May be fixed by #908
Open

Bug in from langchain_google_genai import GoogleGenerativeAIEmbeddings.embed_query #902

nasheedyasin opened this issue May 5, 2025 · 2 comments · May be fixed by #908

Comments

@nasheedyasin
Copy link

The task_type passed to langchain_google_genai import GoogleGenerativeAIEmbeddings.embed_query is ignored. Refer this line.

This bug leads to an un-intuitive in behavior for the two following calls:

from langchain_google_genai import GoogleGenerativeAIEmbeddings


embeddings = GoogleGenerativeAIEmbeddings(model="models/gemini-embedding-exp-03-07", task_type="clustering")
emb = embeddings.embed_query("How does alphafold work?", output_dimensionality=768)

embeddings2 = GoogleGenerativeAIEmbeddings(model="models/gemini-embedding-exp-03-07")
emb2 = embeddings2.embed_query("How does alphafold work?",  task_type="clustering", output_dimensionality=768)

# Check for point-wise equality
emb == emb2
# >>> False
@nasheedyasin
Copy link
Author

I am open to fixing it: Delete this line and we are good.

@lkuligin
Copy link
Collaborator

lkuligin commented May 6, 2025

yes, feel free to send a PR, please

do not delete the line but just try to determine the task type in the right order

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants