vibe.runtime_models.assistant

Assistant service payload validation models.

Provides Pydantic models for validating: - LLM provider responses (chat completions, tool calls) - Streaming chunk structures - Tool invocation payloads - Inter-service message passing - Endpoint/provider configuration

These models are used by AssistantService and StreamTranslator when exchanging data with LLM providers and processing streaming responses.

StreamChunkModel

Validation model for streaming chunk structures.

Stream chunks represent incremental updates during LLM generation. Uses FlexibleModel to accommodate provider-specific fields.

ToolInvocationPayloadModel

Validation model for tool invocation requests.

Validates structure of tool calls before sending to tool execution handlers.

validate_non_empty_fields

validate_non_empty_fields(v: str) -> str

Ensure tool_name and tool_id are non-empty.

LLMResponseMetadataModel

Validation model for LLM response metadata.

Captures provider-specific metadata like token usage, model version, etc. Uses FlexibleModel to allow provider-specific extensions.

AssistantDraftBlockUpdateModel

Validation model for draft block updates during streaming.

Draft blocks are updated incrementally as content streams in.

validate_block_id

validate_block_id(v: str) -> str

Ensure block_id is non-empty.

ContextStrategyModel

Validation model for LLM context management strategy.

Controls how conversation history is managed when approaching token limits.

EndpointConfigModel

Validation model for LLM endpoint configuration.

Validates structure of endpoint entries from endpoints.yml or app config. Uses FlexibleModel to allow provider-specific extensions.

validate_provider_path

validate_provider_path(v: str) -> str

Ensure provider is a valid module path.

validate_config_structure

validate_config_structure() -> EndpointConfigModel

Validate that config dict doesn't contain reserved keys.