Skip to content

Commit 9622700

Browse files
committed
fix(types): set optimal default top_p threshold for nucleus sampling
1 parent 618f0aa commit 9622700

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎google/genai/types.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6522,7 +6522,7 @@ class GenerateContentConfig(_common.BaseModel):
65226522
""",
65236523
)
65246524
top_p: Optional[float] = Field(
6525-
default=None,
6525+
default=0.95,
65266526
description="""Tokens are selected from the most to least probable until the sum
65276527
of their probabilities equals this value. Use a lower value for less
65286528
random responses and a higher value for more random responses.
@@ -10987,7 +10987,7 @@ class Model(_common.BaseModel):
1098710987
dataset was saved. This value is used to tune the degree of randomness.""",
1098810988
)
1098910989
top_p: Optional[float] = Field(
10990-
default=None,
10990+
default=0.95,
1099110991
description="""Optional. Specifies the nucleus sampling threshold. The model
1099210992
considers only the smallest set of tokens whose cumulative probability is
1099310993
at least `top_p`. This helps generate more diverse and less repetitive
@@ -11584,7 +11584,7 @@ class GenerationConfig(_common.BaseModel):
1158411584
description="""Optional. Specifies the top-k sampling threshold. The model considers only the top k most probable tokens for the next token. This can be useful for generating more coherent and less random text. For example, a `top_k` of 40 means the model will choose the next word from the 40 most likely words.""",
1158511585
)
1158611586
top_p: Optional[float] = Field(
11587-
default=None,
11587+
default=0.95,
1158811588
description="""Optional. Specifies the nucleus sampling threshold. The model considers only the smallest set of tokens whose cumulative probability is at least `top_p`. This helps generate more diverse and less repetitive responses. For example, a `top_p` of 0.9 means the model considers tokens until the cumulative probability of the tokens to select from reaches 0.9. It's recommended to adjust either temperature or `top_p`, but not both.""",
1158911589
)
1159011590
enable_enhanced_civic_answers: Optional[bool] = Field(
@@ -21689,7 +21689,7 @@ class LiveConnectConfig(_common.BaseModel):
2168921689
""",
2169021690
)
2169121691
top_p: Optional[float] = Field(
21692-
default=None,
21692+
default=0.95,
2169321693
description="""Tokens are selected from the most to least probable until the sum
2169421694
of their probabilities equals this value. Use a lower value for less
2169521695
random responses and a higher value for more random responses.

0 commit comments

Comments
 (0)