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 @@ -44,6 +44,7 @@
from ..models import _supports_reasoning_effort

ServiceTier = Literal["auto", "default", "flex", "scale", "priority"]
Verbosity = Literal["low", "medium", "high"]

OPENAI_RESPONSES_WS_URL = "wss://api.openai.com/v1/responses"

Expand Down Expand Up @@ -144,6 +145,7 @@ class _LLMOptions:
reasoning: NotGivenOr[Reasoning]
metadata: NotGivenOr[dict[str, str]]
service_tier: NotGivenOr[ServiceTier]
verbosity: NotGivenOr[Verbosity]
max_output_tokens: NotGivenOr[int]
use_websocket: bool

Expand All @@ -165,6 +167,7 @@ def __init__(
store: NotGivenOr[bool] = NOT_GIVEN,
metadata: NotGivenOr[dict[str, str]] = NOT_GIVEN,
service_tier: NotGivenOr[ServiceTier] = NOT_GIVEN,
verbosity: NotGivenOr[Verbosity] = NOT_GIVEN,
max_output_tokens: NotGivenOr[int] = NOT_GIVEN,
timeout: httpx.Timeout | None = None,
) -> None:
Expand Down Expand Up @@ -196,6 +199,7 @@ def __init__(
metadata=metadata,
reasoning=reasoning,
service_tier=service_tier,
verbosity=verbosity,
max_output_tokens=max_output_tokens,
use_websocket=use_websocket,
)
Expand Down Expand Up @@ -293,6 +297,10 @@ def chat(
if is_given(self._opts.service_tier):
extra["service_tier"] = self._opts.service_tier

if is_given(self._opts.verbosity):
text_cfg = extra.get("text") or {}
extra["text"] = {**text_cfg, "verbosity": self._opts.verbosity}

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

Expand Down