Skip to content

Context Service

ghost_brain.modules.ai.context

LLM Context and VAD factory.

create_context_and_aggregators(sample_rate: int = 8000, extra_tools: list[FunctionSchema] | None = None) -> tuple[LLMContext, LLMUserAggregator, LLMAssistantAggregator]

Create shared LLM context and user/assistant context aggregators with VAD.

Parameters:

Name Type Description Default
sample_rate int

Audio sample rate (8000 for Twilio). Silero supports 8000 or 16000.

8000
extra_tools list[FunctionSchema] | None

Additional FunctionSchema tools to register (e.g., from MCP servers).

None

Returns:

Type Description
tuple[LLMContext, LLMUserAggregator, LLMAssistantAggregator]

Tuple of (context, user_aggregator, assistant_aggregator).