Closed dvideby0 closed 4 months ago
Can you add the access_token parameter to the class and pass it to the Anthropic classes in libs/vertexai/langchain_google_vertexai/model_garden.py
libs/vertexai/langchain_google_vertexai/model_garden.py
async_client: Any = None #: :meta private: model_name: Optional[str] = Field(default=None, alias="model") # type: ignore[assignment] "Underlying model name." max_output_tokens: int = Field(default=1024, alias="max_tokens") access_token: Optional[str] = None class Config: """Configuration for this pydantic object.""" allow_population_by_field_name = True @root_validator() def validate_environment(cls, values: Dict) -> Dict: from anthropic import ( # type: ignore[import-not-found] AnthropicVertex, AsyncAnthropicVertex, ) values["client"] = AnthropicVertex( project_id=values["project"], region=values["location"], max_retries=values["max_retries"], access_token=values["access_token"], ) values["async_client"] = AsyncAnthropicVertex( project_id=values["project"], region=values["location"], max_retries=values["max_retries"], access_token=values["access_token"], ) return values
@dvideby0 thanks for the feature request and a code sample. Do you mind raising a PR, pleease?
PR: https://github.com/langchain-ai/langchain-google/pull/212
thanks a lot for your contribution!
Can you add the access_token parameter to the class and pass it to the Anthropic classes in
libs/vertexai/langchain_google_vertexai/model_garden.py