diff --git a/libs/genai/langchain_google_genai/chat_models.py b/libs/genai/langchain_google_genai/chat_models.py index 91a1cfa81..45ad1cec4 100644 --- a/libs/genai/langchain_google_genai/chat_models.py +++ b/libs/genai/langchain_google_genai/chat_models.py @@ -579,9 +579,9 @@ class ChatGoogleGenerativeAI(_BaseGoogleGenerativeAI, BaseChatModel): Instantiation: To use, you must have either: - 1. The ``GOOGLE_API_KEY``` environment variable set with your API key, or - 2. Pass your API key using the google_api_key kwarg to the ChatGoogle - constructor. + 1. The ``GOOGLE_API_KEY`` environment variable set with your API key, or + 2. Pass your API key using the google_api_key kwarg + to the ChatGoogleGenerativeAI constructor. .. code-block:: python diff --git a/libs/genai/langchain_google_genai/embeddings.py b/libs/genai/langchain_google_genai/embeddings.py index a920c7ffc..b79b95eb7 100644 --- a/libs/genai/langchain_google_genai/embeddings.py +++ b/libs/genai/langchain_google_genai/embeddings.py @@ -27,9 +27,9 @@ class GoogleGenerativeAIEmbeddings(BaseModel, Embeddings): To use, you must have either: - 1. The ``GOOGLE_API_KEY``` environment variable set with your API key, or - 2. Pass your API key using the google_api_key kwarg to the ChatGoogle - constructor. + 1. The ``GOOGLE_API_KEY`` environment variable set with your API key, or + 2. Pass your API key using the google_api_key kwarg + to the GoogleGenerativeAIEmbeddings constructor. Example: .. code-block:: python diff --git a/libs/vertexai/langchain_google_vertexai/model_garden_maas/_base.py b/libs/vertexai/langchain_google_vertexai/model_garden_maas/_base.py index 256c5d1f1..ffc807228 100644 --- a/libs/vertexai/langchain_google_vertexai/model_garden_maas/_base.py +++ b/libs/vertexai/langchain_google_vertexai/model_garden_maas/_base.py @@ -44,7 +44,11 @@ def _get_token(credentials: Optional[Credentials] = None) -> str: """Returns a valid token for GCP auth.""" - credentials = auth.default()[0] if not credentials else credentials + credentials = ( + auth.default(scopes=["https://www.googleapis.com/auth/cloud-platform"])[0] + if not credentials + else credentials + ) request = auth_requests.Request() credentials.refresh(request) if not credentials.token: