[langchain]: The batch method of GoogleGenerativeAIEmbeddings should only returns one vector for "gemini-embedding-2-preview"

Open Beginner friendly
#3,656 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Quiet
Tech stack
python
Domain
documentation

Research direction

Start with the Batch section of the GoogleGenerativeAIEmbeddings integration documentation and compare its example with the linked Google GenAI embedding aggregation note. Verify the displayed result for gemini-embedding-2-preview and update the documentation so the example accurately describes the returned vectors.

Written by the indexing model from the issue text.

Description

external langchain
Type of issue

issue / bug

Language

Python

Description

The embed_documents method of GoogleGenerativeAIEmbeddings only returns one vector for multiple inputs when using the model "gemini-embedding-2-preview".

In the Batch section of the GoogleGenerativeAIEmbeddings integration documentation.
The following Python code should print 1, but not 3:

embeddings = GoogleGenerativeAIEmbeddings(model="gemini-embedding-2-preview")
vectors = embeddings.embed_documents(
    [
        "Today is Monday",
        "Today is Tuesday",
        "Today is April Fools day",
    ]
)
print(len(vectors))

This note can be found at Embeddings of Google GenAI SDK:

"Note: Gemini Embedding 2 creates an aggregated embedding for multiple inputs. See Embedding aggregation for more details."

Dominant language
MDX
Stars
418
Forks
2.7k
Avg merge
1d 6h
Merged PRs (30d)
351

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from langchain-ai/docs

All issues in langchain-ai/docs

Similar issues

More Documentation issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.