llm

Azure OpenAI service implementation for the Pipecat AI framework.

class pipecat.services.azure.llm.AzureLLMSettings(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 AzureLLMService.

class pipecat.services.azure.llm.AzureLLMService(*, api_key: str, endpoint: str, model: str | None = None, api_version: str = '2024-09-01-preview', settings: AzureLLMSettings | None = None, **kwargs)[source]

Bases: OpenAILLMService

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

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

Settings

alias of AzureLLMSettings

__init__(*, api_key: str, endpoint: str, model: str | None = None, api_version: str = '2024-09-01-preview', settings: AzureLLMSettings | None = None, **kwargs)[source]

Initialize the Azure LLM service.

Parameters:
  • api_key – The API key for accessing Azure OpenAI.

  • endpoint – The Azure endpoint URL.

  • model

    The model identifier to use. Defaults to “gpt-4.1”.

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

  • api_version – Azure API version. Defaults to “2024-09-01-preview”.

  • 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 Azure OpenAI endpoint.

Parameters:
  • api_key – API key for authentication. Uses instance key if None.

  • base_url – Base URL for the client. Ignored for Azure implementation.

  • **kwargs – Additional keyword arguments. Ignored for Azure implementation.

Returns:

Configured Azure OpenAI client instance.

Return type:

AsyncAzureOpenAI