Skip to content

GoogleGenerativeAIEmbeddings is missing the embedding dimension field #9378

@samuelexferri

Description

@samuelexferri

Checked other resources

  • This is a bug, not a usage question. For questions, please use the LangChain Forum (https://forum.langchain.com/).
  • I added a very descriptive title to this issue.
  • I searched the LangChain.js documentation with the integrated search.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain.js rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).

Example Code

const embeddings = new GoogleGenerativeAIEmbeddings({
  model: "gemini-embedding-001", // 768 dimensions
  // Missing dimension field
});

Error Message and Stack Trace (if applicable)

No response

Description

GoogleGenerativeAIEmbeddings is missing the embedding dimension field.
I cannot use the model "gemini-embedding-001" with dimension different from 768 (even if model support it).

For reference OpenAI accept dimension field:

this.embeddings = new OpenAIEmbeddings({
  modelName: 'text-embedding-3-small',
  dimensions: 1536,
  apiKey: this.openAIApiKey
});

System Info

Node v22
[email protected]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions