Skip to content

Add response_schema parameter #302

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
May 3, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion google/generativeai/types/generation_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import collections
import contextlib
import sys
from collections.abc import Iterable, AsyncIterable
from collections.abc import Iterable, AsyncIterable, Mapping
import dataclasses
import itertools
import textwrap
Expand Down Expand Up @@ -80,6 +80,7 @@ class GenerationConfigDict(TypedDict, total=False):
max_output_tokens: int
temperature: float
response_mime_type: str
response_schema: Mapping[str, str]


@dataclasses.dataclass
Expand Down Expand Up @@ -155,6 +156,7 @@ class GenerationConfig:
top_p: float | None = None
top_k: int | None = None
response_mime_type: str | None = None
response_schema: Mapping[str, str | None] | None = None


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