Skip to content

Commit 8170804

Browse files
authored
feat(genai): update model examples and enhance field descriptions in _BaseGoogleGenerativeAI (#1174)
Also make `api_transport` an alias to `transport`
1 parent bf8ec7c commit 8170804

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

libs/genai/langchain_google_genai/_common.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class _BaseGoogleGenerativeAI(BaseModel):
2323
...,
2424
description="""The name of the model to use.
2525
Examples:
26-
- gemini-2.5-pro
26+
- gemini-2.5-flash
2727
- models/text-bison-001""",
2828
)
2929
"""Model name to use."""
@@ -32,26 +32,35 @@ class _BaseGoogleGenerativeAI(BaseModel):
3232
)
3333
"""Google AI API key.
3434
If not specified will be read from env var ``GOOGLE_API_KEY``."""
35+
3536
credentials: Any = None
3637
"The default custom credentials (google.auth.credentials.Credentials) to use "
3738
"when making API calls. If not provided, credentials will be ascertained from "
3839
"the GOOGLE_API_KEY envvar"
40+
3941
temperature: float = 0.7
40-
"""Run inference with this temperature. Must be within ``[0.0, 2.0]``."""
42+
"""Run inference with this temperature. Must be within ``[0.0, 2.0]``. If unset,
43+
will default to ``0.7``."""
44+
4145
top_p: Optional[float] = None
4246
"""Decode using nucleus sampling: consider the smallest set of tokens whose
43-
probability sum is at least ``top_p``. Must be within ``[0.0, 1.0]``."""
47+
probability sum is at least ``top_p``. Must be within ``[0.0, 1.0]``."""
48+
4449
top_k: Optional[int] = None
4550
"""Decode using top-k sampling: consider the set of ``top_k`` most probable tokens.
46-
Must be positive."""
51+
Must be positive."""
52+
4753
max_output_tokens: Optional[int] = Field(default=None, alias="max_tokens")
4854
"""Maximum number of tokens to include in a candidate. Must be greater than zero.
49-
If unset, will default to ``64``."""
55+
If unset, will default to ``64``."""
56+
5057
n: int = 1
5158
"""Number of chat completions to generate for each prompt. Note that the API may
52-
not return the full ``n`` completions if duplicates are generated."""
59+
not return the full ``n`` completions if duplicates are generated."""
60+
5361
max_retries: int = 6
54-
"""The maximum number of retries to make when generating."""
62+
"""The maximum number of retries to make when generating. If unset, will default
63+
to ``6``."""
5564

5665
timeout: Optional[float] = None
5766
"""The maximum number of seconds to wait for a response."""
@@ -66,6 +75,7 @@ class _BaseGoogleGenerativeAI(BaseModel):
6675
transport: Optional[str] = Field(
6776
default=None,
6877
description="A string, one of: [`rest`, `grpc`, `grpc_asyncio`].",
78+
alias="api_transport",
6979
)
7080
additional_headers: Optional[Dict[str, str]] = Field(
7181
default=None,

0 commit comments

Comments
 (0)