run-llama / llama_index

LlamaIndex is a data framework for your LLM applications
https://docs.llamaindex.ai
MIT License
36.74k stars 5.27k forks source link

[Feature Request]: Support ADC with VertexTextEmbedding #16846

Open vishwarajanand opened 1 week ago

vishwarajanand commented 1 week ago

Feature Description

VertexTextEmbedding does not support ADC credentials and currently it throws when ADC credentials are used i.e. credentials via an enn var or a well known path per google's client libraries. This feature is missing in the llama index's VertexTextEmbedding implementation.

Instead users need to provide the credentials manually, code ref.

Reason

If both the following conditions are not met:

        if credentials is None:
            if client_email and token_uri and private_key_id and private_key:

then llama index throws a value error.

Value of Feature

This will enable users to be able to use Google's models for embeddings automatically and increase Llama Index adoption among GCP users. Until then, providing credentials is quite manual and not really doable out of the box.

My workaround looks like this, but it causes confusion about the project id used here:

from google.auth import default
credentials, project_id = default()
Settings.embed_model = VertexTextEmbedding(
    model_name="textembedding-gecko@001",
    project=project_id,
    credentials=credentials  # SHOULD NOT BE REQUIRED
)