Skip to content

Feature: Support GoogleGenerativeAIEmbeddings using application default credentials #33049

@bkarduck

Description

@bkarduck

Checked other resources

  • This is a feature request, not a bug report or usage question.
  • I added a clear and descriptive title that summarizes the feature request.
  • I used the GitHub search to find a similar feature request and didn't find it.
  • I checked the LangChain documentation and API reference to see if this feature already exists.
  • This is not related to the langchain-community package.

Feature Description

I would like langchain to support the use of the Application Default Credentials json as the access pattern for google models when using GoogleGenerativeAI features. It currently only accepts an API key.

Use Case

I have an application through my work that uses an Application Default Credentials json file to access the google endpoint for embeddings. As vertex gets officially phased out, we're moving to using all of the google genai capabilities and while we have been using langchain's VertexAIEmbeddings wrapper to handle embedding and storing docs in elasticsearch, we want to use GoogleGenerativeAIEmbeddings instead. We found today that it's not supported unless we pass in an API key, which doesn't align with the access pattern we've been using.

Proposed Solution

I think this could be fixed by allowing the user to pass in the client they are using that has the appropriate google access with the ADC.

Alternatives Considered

The alternative would be effectively copy/pasting the class and using the same features with the correct access pattern.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestrequest for an enhancement / additional functionality

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions