Skip to content
Open
Show file tree
Hide file tree
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 @@ -32,6 +32,7 @@ def __init__(
tool_choice: NotGivenOr[ToolChoice] = NOT_GIVEN,
timeout: httpx.Timeout | None = None,
reasoning: NotGivenOr[Reasoning] = NOT_GIVEN,
max_output_tokens: NotGivenOr[int] = NOT_GIVEN,
) -> None:
"""
This automatically infers the following arguments from their corresponding environment variables if they are not provided:
Expand Down Expand Up @@ -68,6 +69,7 @@ def __init__(
parallel_tool_calls=parallel_tool_calls,
tool_choice=tool_choice,
reasoning=reasoning,
max_output_tokens=max_output_tokens,
)
self._azure_client = azure_client

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ class _LLMOptions:
reasoning: NotGivenOr[Reasoning]
metadata: NotGivenOr[dict[str, str]]
service_tier: NotGivenOr[ServiceTier]
max_output_tokens: NotGivenOr[int]
use_websocket: bool


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

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

parallel_tool_calls = (
parallel_tool_calls if is_given(parallel_tool_calls) else self._opts.parallel_tool_calls
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def __init__(
tool_choice: NotGivenOr[ToolChoice] = NOT_GIVEN,
timeout: httpx.Timeout | None = None,
reasoning: NotGivenOr[Reasoning] = NOT_GIVEN,
max_output_tokens: NotGivenOr[int] = NOT_GIVEN,
) -> None:
api_key = api_key or os.environ.get("XAI_API_KEY")
if api_key is None:
Expand All @@ -44,4 +45,5 @@ def __init__(
tool_choice=tool_choice,
reasoning=reasoning,
timeout=timeout,
max_output_tokens=max_output_tokens,
)