llm

SambaNova LLM service implementation using OpenAI-compatible interface.

class pipecat.services.sambanova.llm.SambaNovaLLMSettings(model: str | None | _NotGiven = <factory>, extra: dict[str, Any]=<factory>, system_instruction: str | None | _NotGiven = <factory>, temperature: float | None | _NotGiven | NotGiven = <factory>, max_tokens: int | None | _NotGiven | NotGiven = <factory>, top_p: float | None | _NotGiven | NotGiven = <factory>, top_k: int | None | _NotGiven = <factory>, frequency_penalty: float | None | _NotGiven | NotGiven = <factory>, presence_penalty: float | None | _NotGiven | NotGiven = <factory>, seed: int | None | _NotGiven | NotGiven = <factory>, filter_incomplete_user_turns: bool | None | _NotGiven = <factory>, user_turn_completion_config: UserTurnCompletionConfig | None | _NotGiven = <factory>, max_completion_tokens: int | _NotGiven | NotGiven = <factory>)[source]

Bases: OpenAILLMSettings

Settings for SambaNovaLLMService.

class pipecat.services.sambanova.llm.SambaNovaLLMService(*, api_key: str, model: str | None = None, base_url: str = 'https://api.sambanova.ai/v1', settings: SambaNovaLLMSettings | None = None, **kwargs: dict[Any, Any])[source]

Bases: OpenAILLMService

A service for interacting with SambaNova using the OpenAI-compatible interface.

This service extends OpenAILLMService to connect to SambaNova’s API endpoint while maintaining full compatibility with OpenAI’s interface and functionality.

supports_developer_role = False

Whether this service’s API supports the “developer” message role.

OpenAI’s native API supports it, but some OpenAI-compatible services (e.g. Cerebras) do not. Subclasses that don’t support it should set this to False, which causes the adapter to convert “developer” messages to “user” messages before sending them to the API.

Settings

alias of SambaNovaLLMSettings

__init__(*, api_key: str, model: str | None = None, base_url: str = 'https://api.sambanova.ai/v1', settings: SambaNovaLLMSettings | None = None, **kwargs: dict[Any, Any]) None[source]

Initialize SambaNova LLM service.

Parameters:
  • api_key – The API key for accessing SambaNova API.

  • model

    The model identifier to use. Defaults to “Llama-4-Maverick-17B-128E-Instruct”.

    Deprecated since version 0.0.105: Use settings=SambaNovaLLMService.Settings(model=...) instead.

  • base_url – The base URL for SambaNova API. Defaults to “https://api.sambanova.ai/v1”.

  • settings – Runtime-updatable settings. When provided alongside deprecated parameters, settings values take precedence.

  • **kwargs – Additional keyword arguments passed to OpenAILLMService.

create_client(api_key: str | None = None, base_url: str | None = None, **kwargs: dict[Any, Any]) Any[source]

Create OpenAI-compatible client for SambaNova API endpoint.

Parameters:
  • api_key – API key for authentication. If None, uses instance default.

  • base_url – Base URL for the API endpoint. If None, uses instance default.

  • **kwargs – Additional keyword arguments for client configuration.

Returns:

Configured OpenAI-compatible client instance.

build_chat_completion_params(params_from_context: OpenAILLMInvocationParams) dict[source]

Build parameters for SambaNova chat completion request.

SambaNova doesn’t support some OpenAI parameters like frequency_penalty, presence_penalty, and seed.

Parameters:

params_from_context – Parameters, derived from the LLM context, to use for the chat completion. Contains messages, tools, and tool choice.

Returns:

Dictionary of parameters for the chat completion request.