service_loader

Service loading and validation logic.

This module handles loading services, validating configurations, and providing utilities for working with the service registry.

pipecat.cli.registry.service_loader.extract_package_extra(package: str) list[str][source]

Extract the extra names from a package string.

Parameters:

package – Package string like “pipecat-ai[deepgram]”, “pipecat-ai[deepgram,sagemaker]”, or “pipecat-ai”

Returns:

List of extra names (e.g., [“deepgram”] or [“deepgram”, “sagemaker”]), or an empty list if no extras

Examples

>>> extract_package_extra("pipecat-ai[deepgram]")
['deepgram']
>>> extract_package_extra("pipecat-ai[deepgram,sagemaker]")
['deepgram', 'sagemaker']
>>> extract_package_extra("pipecat-ai")
[]
class pipecat.cli.registry.service_loader.ServiceLoader[source]

Bases: object

Handles loading and validating services from the registry.

static get_service_by_value(service_list: list[ServiceDefinition], value: str) ServiceDefinition | None[source]

Find a service definition by its value.

Parameters:
  • service_list – List of service definitions to search

  • value – Service value to find

Returns:

Service definition or None if not found

static get_all_services_by_type(service_type: Literal['transport', 'stt', 'llm', 'tts', 'realtime']) list[ServiceDefinition][source]

Get all services of a specific type.

Parameters:

service_type – Type of service to retrieve

Returns:

List of service definitions

static get_service_config(service_value: str) str | None[source]

Get the initialization code for a service.

Parameters:

service_value – Service identifier (e.g., “deepgram_stt”)

Returns:

Initialization code string or None if not found

static get_service_import(service_value: str) list[str][source]

Get import statements for a service.

Parameters:

service_value – Service identifier

Returns:

List of import statements

static extract_extras_for_services(services: dict[str, str | list[str]]) set[str][source]

Extract all package extras needed for selected services.

Parameters:

services – Dict mapping service type to service value(s) e.g., {“transports”: [“daily”], “stt”: “deepgram_stt”, …}

Returns:

Set of package extras (e.g., {“daily”, “deepgram”, “openai”})

static validate_service_exists(service_value: str) bool[source]

Check if a service exists in the registry.

Parameters:

service_value – Service identifier to check

Returns:

True if service exists, False otherwise

static get_transport_options(bot_type: Literal['web', 'telephony']) list[ServiceDefinition][source]

Get transport options based on bot type.

Parameters:

bot_type – Type of bot (“web” or “telephony”)

Returns:

List of transport service definitions

static get_imports_for_services(services: dict[str, str | list[str]], features: dict[str, bool], bot_type: str = 'web') list[str][source]

Get all necessary import statements for selected services and features.

Parameters:
  • services – Dict mapping service type to service value(s)

  • features – Dict of enabled features

  • bot_type – Type of bot (“web” or “telephony”)

Returns:

List of import statements

static get_missing_services() dict[str, list[str]][source]

Find services that are defined but missing configs or imports.

Returns:

Dict with ‘missing_configs’ and ‘missing_imports’ lists