Skip to content

Commit

Permalink
Fix GenerationConfig to match the API. (#609)
Browse files Browse the repository at this point in the history
* Fix GenerationConfig, this doesn't match the API

Change-Id: I4e0c3b45125023e056c3d7e1549eafb47e42815a

* format

Change-Id: I161dd7b9b371e005b4385faeaa84f6d141e09b43
  • Loading branch information
MarkDaoust authored Oct 24, 2024
1 parent e9b0cde commit 3d91916
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions google/generativeai/types/generation_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ class GenerationConfigDict(TypedDict, total=False):
temperature: float
response_mime_type: str
response_schema: protos.Schema | Mapping[str, Any] # fmt: off
presence_penalty: float
frequency_penalty: float


@dataclasses.dataclass
Expand Down Expand Up @@ -144,8 +146,6 @@ class GenerationConfig:
Note: The default value varies by model, see the
`Model.top_k` attribute of the `Model` returned the
`genai.get_model` function.
seed:
Optional. Seed used in decoding. If not set, the request uses a randomly generated seed.
response_mime_type:
Optional. Output response mimetype of the generated candidate text.
Expand All @@ -161,10 +161,6 @@ class GenerationConfig:
Optional.
frequency_penalty:
Optional.
response_logprobs:
Optional. If true, export the `logprobs` results in response.
logprobs:
Optional. Number of candidates of log probabilities to return at each step of decoding.
"""

candidate_count: int | None = None
Expand All @@ -173,13 +169,10 @@ class GenerationConfig:
temperature: float | None = None
top_p: float | None = None
top_k: int | None = None
seed: int | None = None
response_mime_type: str | None = None
response_schema: protos.Schema | Mapping[str, Any] | type | None = None
presence_penalty: float | None = None
frequency_penalty: float | None = None
response_logprobs: bool | None = None
logprobs: int | None = None


GenerationConfigType = Union[protos.GenerationConfig, GenerationConfigDict, GenerationConfig]
Expand Down

0 comments on commit 3d91916

Please sign in to comment.