Skip to content

Commit 9e6767b

Browse files
Add JSON mode (#274)
* Add JSON mode * format --------- Co-authored-by: Mark Daoust <[email protected]>
1 parent 948a5a8 commit 9e6767b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

google/generativeai/types/generation_types.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ class GenerationConfigDict(TypedDict):
7979
stop_sequences: Iterable[str]
8080
max_output_tokens: int
8181
temperature: float
82+
response_mime_type: str
8283

8384

8485
@dataclasses.dataclass
@@ -138,6 +139,13 @@ class GenerationConfig:
138139
Note: The default value varies by model, see the
139140
`Model.top_k` attribute of the `Model` returned the
140141
`genai.get_model` function.
142+
143+
response_mime_type:
144+
Optional. Output response mimetype of the generated candidate text.
145+
146+
Supported mimetype:
147+
`text/plain`: (default) Text output.
148+
`application/json`: JSON response in the candidates.
141149
"""
142150

143151
candidate_count: int | None = None
@@ -146,6 +154,7 @@ class GenerationConfig:
146154
temperature: float | None = None
147155
top_p: float | None = None
148156
top_k: int | None = None
157+
response_mime_type: str | None = None
149158

150159

151160
GenerationConfigType = Union[glm.GenerationConfig, GenerationConfigDict, GenerationConfig]

0 commit comments

Comments
 (0)