llm

Fireworks AI service implementation using OpenAI-compatible interface.

class pipecat.services.fireworks.llm.FireworksLLMSettings(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 FireworksLLMService.

class pipecat.services.fireworks.llm.FireworksLLMService(*, api_key: str, model: str | None = None, base_url: str = 'https://api.fireworks.ai/inference/v1', settings: FireworksLLMSettings | None = None, **kwargs)[source]

Bases: OpenAILLMService

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

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

Settings

alias of FireworksLLMSettings

__init__(*, api_key: str, model: str | None = None, base_url: str = 'https://api.fireworks.ai/inference/v1', settings: FireworksLLMSettings | None = None, **kwargs)[source]

Initialize the Fireworks LLM service.

Parameters:
  • api_key – The API key for accessing Fireworks AI.

  • model

    The model identifier to use. Defaults to “accounts/fireworks/models/firefunction-v2”.

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

  • base_url – The base URL for Fireworks API. Defaults to “https://api.fireworks.ai/inference/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=None, base_url=None, **kwargs)[source]

Create OpenAI-compatible client for Fireworks API endpoint.

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

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

  • **kwargs – Additional arguments passed to the client constructor.

Returns:

Configured OpenAI client instance for Fireworks API.

build_chat_completion_params(params_from_context: OpenAILLMInvocationParams) dict[source]

Build parameters for Fireworks chat completion request.

Fireworks doesn’t support some OpenAI parameters like seed, max_completion_tokens, and stream_options.

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.