diff --git a/libs/vertexai/langchain_google_vertexai/model_garden.py b/libs/vertexai/langchain_google_vertexai/model_garden.py index 07134753..192d2370 100644 --- a/libs/vertexai/langchain_google_vertexai/model_garden.py +++ b/libs/vertexai/langchain_google_vertexai/model_garden.py @@ -16,6 +16,7 @@ Union, ) +from google.auth.credentials import Credentials from langchain_core.callbacks.manager import ( AsyncCallbackManagerForLLMRun, CallbackManagerForLLMRun, @@ -134,6 +135,7 @@ class ChatAnthropicVertex(_VertexAICommon, BaseChatModel): max_output_tokens: int = Field(default=1024, alias="max_tokens") access_token: Optional[str] = None stream_usage: bool = True # Whether to include usage metadata in streaming output + credentials: Optional[Credentials] = None class Config: """Configuration for this pydantic object.""" @@ -156,12 +158,14 @@ def validate_environment(cls, values: Dict) -> Dict: region=values["location"], max_retries=values["max_retries"], access_token=values["access_token"], + credentials=values["credentials"], ) values["async_client"] = AsyncAnthropicVertex( project_id=values["project"], region=values["location"], max_retries=values["max_retries"], access_token=values["access_token"], + credentials=values["credentials"], ) return values diff --git a/libs/vertexai/poetry.lock b/libs/vertexai/poetry.lock index 6224639f..7cb590be 100644 --- a/libs/vertexai/poetry.lock +++ b/libs/vertexai/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. [[package]] name = "aiohttp" @@ -126,13 +126,13 @@ typing-extensions = {version = ">=4.0.0", markers = "python_version < \"3.9\""} [[package]] name = "anthropic" -version = "0.29.0" +version = "0.31.2" description = "The official Python library for the anthropic API" optional = true python-versions = ">=3.7" files = [ - {file = "anthropic-0.29.0-py3-none-any.whl", hash = "sha256:d16010715129c8bc3295b74fbf4da73cfb156618bf0abb2d007255983266b76a"}, - {file = "anthropic-0.29.0.tar.gz", hash = "sha256:3eb558a232d83bdf7cdedb75663bf7ff7a8b50cc10acaa9ce6494ff295b8506a"}, + {file = "anthropic-0.31.2-py3-none-any.whl", hash = "sha256:28d176b98c72615bfae30f0a9eee6297cc33bf52535d38156fc2805556e2f09b"}, + {file = "anthropic-0.31.2.tar.gz", hash = "sha256:0134b73df8d1f142fc68675fbadb75e920054e9e3437b99df63f10f0fc6ac26f"}, ] [package.dependencies] @@ -2101,6 +2101,7 @@ files = [ {file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"}, {file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"}, {file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"}, + {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a08c6f0fe150303c1c6b71ebcd7213c2858041a7e01975da3a99aed1e7a378ef"}, {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"}, {file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"}, {file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"}, @@ -2767,4 +2768,4 @@ anthropic = ["anthropic"] [metadata] lock-version = "2.0" python-versions = ">=3.8.1,<4.0" -content-hash = "e1900005a8ec866c8818338e3f0293e0592f18bf75b7b051316730ff4d4b5551" +content-hash = "67590d73d9efefb96a49361cdfa23e6acf4992b878bb741aa35b81b80fbba18a" diff --git a/libs/vertexai/pyproject.toml b/libs/vertexai/pyproject.toml index 8e02d749..13f90eff 100644 --- a/libs/vertexai/pyproject.toml +++ b/libs/vertexai/pyproject.toml @@ -16,7 +16,7 @@ langchain-core = ">=0.2.9,<0.3" google-cloud-aiplatform = "^1.56.0" google-cloud-storage = "^2.17.0" # optional dependencies -anthropic = { extras = ["vertexai"], version = ">=0.29.0,<1", optional = true } +anthropic = { extras = ["vertexai"], version = ">=0.30.0,<1", optional = true } [tool.poetry.group.test] optional = true