Skip to content
Merged
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class _LLMOptions:
http_options: NotGivenOr[types.HttpOptions]
seed: NotGivenOr[int]
safety_settings: NotGivenOr[list[types.SafetySettingOrDict]]
service_tier: NotGivenOr[types.ServiceTier]


BLOCKED_REASONS = [
Expand Down Expand Up @@ -117,6 +118,7 @@ def __init__(
http_options: NotGivenOr[types.HttpOptions] = NOT_GIVEN,
seed: NotGivenOr[int] = NOT_GIVEN,
safety_settings: NotGivenOr[list[types.SafetySettingOrDict]] = NOT_GIVEN,
service_tier: NotGivenOr[types.ServiceTier] = NOT_GIVEN,
credentials: google.auth.credentials.Credentials | None = None,
) -> None:
"""
Expand Down Expand Up @@ -148,6 +150,7 @@ def __init__(
http_options (HttpOptions, optional): The HTTP options to use for the session.
seed (int, optional): Random seed for reproducible generation. Defaults to None.
safety_settings (list[SafetySettingOrDict], optional): Safety settings for content filtering. Defaults to None.
service_tier (types.ServiceTier, optional): The service tier for the request (e.g. types.ServiceTier.PRIORITY). Defaults to None.
""" # noqa: E501
super().__init__()
gcp_project = project if is_given(project) else os.environ.get("GOOGLE_CLOUD_PROJECT")
Expand Down Expand Up @@ -220,6 +223,7 @@ def __init__(
http_options=http_options,
seed=seed,
safety_settings=safety_settings,
service_tier=service_tier,
)
self._client = Client(
api_key=gemini_api_key,
Expand Down Expand Up @@ -384,6 +388,9 @@ def chat(
if is_given(self._opts.safety_settings):
extra["safety_settings"] = self._opts.safety_settings

if is_given(self._opts.service_tier):
extra["service_tier"] = self._opts.service_tier

return LLMStream(
self,
client=self._client,
Expand Down
Loading