Scaffold all modules, route stubs, data models, and config. No logic implemented yet — all core methods raise NotImplementedError. Establishes the full directory layout matching the architecture in CLAUDE.md. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
70 lines
2.4 KiB
Python
70 lines
2.4 KiB
Python
"""
|
|
Pydantic request and response models for the session API endpoints.
|
|
"""
|
|
|
|
from typing import Optional
|
|
from pydantic import BaseModel, Field
|
|
|
|
from fellowship.core.session import (
|
|
BotConfig,
|
|
ParticipationMode,
|
|
TurnOrder,
|
|
SessionState,
|
|
)
|
|
|
|
|
|
class CreateSessionRequest(BaseModel):
|
|
bots: list[BotConfig] = Field(description="List of bots in this session")
|
|
global_system_prompt: Optional[str] = Field(
|
|
default=None, description="System prompt injected for all bots"
|
|
)
|
|
goal: Optional[str] = Field(
|
|
default=None,
|
|
description="Natural language goal. Required for orchestrator end_session tool to be available.",
|
|
)
|
|
participation_mode: ParticipationMode = Field(
|
|
default=ParticipationMode.AUTONOMOUS,
|
|
description="How human talkers interact with the session",
|
|
)
|
|
turn_order: TurnOrder = Field(
|
|
default=TurnOrder.ROUND_ROBIN,
|
|
description="How the next bot speaker is selected",
|
|
)
|
|
max_talkers: int = Field(default=1, description="Maximum simultaneous talker connections")
|
|
max_turns: Optional[int] = Field(default=None, description="End session after N bot turns")
|
|
max_time: Optional[int] = Field(default=None, description="End session after N seconds")
|
|
max_context_tokens: Optional[int] = Field(
|
|
default=None, description="End or summarize when total context reaches N tokens"
|
|
)
|
|
rectify_history: bool = Field(default=True, description="Enable history rectification")
|
|
summarize_context: bool = Field(
|
|
default=False, description="Summarize old context instead of ending when limit is reached"
|
|
)
|
|
stream_tokens: bool = Field(default=False, description="Stream bot responses token-by-token")
|
|
llm_base_url: Optional[str] = Field(
|
|
default=None, description="Override LLM backend URL for this session"
|
|
)
|
|
llm_api_key: Optional[str] = Field(
|
|
default=None, description="Override LLM API key for this session"
|
|
)
|
|
debug: Optional[bool] = Field(
|
|
default=None, description="Override debug mode for this session"
|
|
)
|
|
|
|
|
|
class CreateSessionResponse(BaseModel):
|
|
token: str = Field(description="Session token used for all subsequent interactions")
|
|
state: SessionState
|
|
bot_count: int
|
|
|
|
|
|
class SessionStatusResponse(BaseModel):
|
|
token: str
|
|
state: SessionState
|
|
bot_count: int
|
|
turn_count: int
|
|
talker_count: int
|
|
observer_count: int
|
|
participation_mode: ParticipationMode
|
|
turn_order: TurnOrder
|