Module livekit.plugins.xai.responses.llm

Classes

class LLM (*,
model: str = 'grok-4-1-fast-non-reasoning',
api_key: str | None = None,
base_url: str | livekit.agents.types.NotGiven = NOT_GIVEN,
user: str | livekit.agents.types.NotGiven = NOT_GIVEN,
temperature: float | livekit.agents.types.NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | livekit.agents.types.NotGiven = NOT_GIVEN,
tool_choice: livekit.agents.llm.tool_context.NamedToolChoice | Literal['auto', 'required', 'none'] | livekit.agents.types.NotGiven = NOT_GIVEN,
timeout: spitch.Timeout | None = None,
reasoning: openai.types.shared.reasoning.Reasoning | livekit.agents.types.NotGiven = NOT_GIVEN)
Expand source code
class LLM(openai.responses.LLM):
    def __init__(
        self,
        *,
        model: str = "grok-4-1-fast-non-reasoning",
        api_key: str | None = None,
        base_url: NotGivenOr[str] = NOT_GIVEN,
        user: NotGivenOr[str] = NOT_GIVEN,
        temperature: NotGivenOr[float] = NOT_GIVEN,
        parallel_tool_calls: NotGivenOr[bool] = NOT_GIVEN,
        tool_choice: NotGivenOr[ToolChoice] = NOT_GIVEN,
        timeout: httpx.Timeout | None = None,
        reasoning: NotGivenOr[Reasoning] = NOT_GIVEN,
    ) -> None:
        api_key = api_key or os.environ.get("XAI_API_KEY")
        if api_key is None:
            raise ValueError(
                "XAI API key is required, either as argument or set XAI_API_KEY environmental variable"  # noqa: E501
            )
        super().__init__(
            model=model,
            base_url=base_url if is_given(base_url) else XAI_BASE_URL,
            api_key=api_key,
            user=user,
            temperature=temperature,
            parallel_tool_calls=parallel_tool_calls,
            tool_choice=tool_choice,
            reasoning=reasoning,
            timeout=timeout,
        )

Helper class that provides a standard way to create an ABC using inheritance.

Create a new instance of OpenAI Responses LLM.

api_key must be set to your OpenAI API key, either using the argument or by setting the OPENAI_API_KEY environmental variable.

Ancestors

Inherited members