Skip to content

Commit

Permalink
[ChatVertexAI] Get api_transport from initializer when not provided (
Browse files Browse the repository at this point in the history
  • Loading branch information
jzaldi authored Jul 4, 2024
1 parent 4f3c985 commit 7c678dc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion libs/vertexai/langchain_google_vertexai/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ class _VertexAIBase(BaseModel):
api_endpoint: Optional[str] = Field(None, alias="base_url")
"Desired API endpoint, e.g., us-central1-aiplatform.googleapis.com"
api_transport: Optional[str] = None
"""The desired API transport method, can be either 'grpc' or 'rest'"""
"""The desired API transport method, can be either 'grpc' or 'rest'.
Uses the default parameter in vertexai.init if defined.
"""
default_metadata: Sequence[Tuple[str, str]] = Field(
default_factory=list
) #: :meta private:
Expand All @@ -101,6 +103,8 @@ def validate_params_base(cls, values: dict) -> dict:
values["model_name"] = values.pop("model")
if values.get("project") is None:
values["project"] = initializer.global_config.project
if values.get("api_transport") is None:
values["api_transport"] = initializer.global_config._api_transport
if values.get("api_endpoint"):
api_endpoint = values["api_endpoint"]
else:
Expand Down

0 comments on commit 7c678dc

Please sign in to comment.