""" Context Management Engine Sophisticated context assembly and optimization for LLM requests. Provides intelligent context selection, token budget management, and model-specific formatting. Usage: from app.services.context import ( ContextSettings, get_context_settings, SystemContext, KnowledgeContext, ConversationContext, TaskContext, ToolContext, TokenBudget, BudgetAllocator, TokenCalculator, ) # Get settings settings = get_context_settings() # Create budget for a model allocator = BudgetAllocator(settings) budget = allocator.create_budget_for_model("claude-3-sonnet") # Create context instances system_ctx = SystemContext.create_persona( name="Code Assistant", description="You are a helpful code assistant.", capabilities=["Write code", "Debug issues"], ) """ # Budget Management from .budget import ( BudgetAllocator, TokenBudget, TokenCalculator, ) # Configuration from .config import ( ContextSettings, get_context_settings, get_default_settings, reset_context_settings, ) # Exceptions from .exceptions import ( AssemblyTimeoutError, BudgetExceededError, CacheError, CompressionError, ContextError, ContextNotFoundError, FormattingError, InvalidContextError, ScoringError, TokenCountError, ) # Types from .types import ( AssembledContext, BaseContext, ContextPriority, ContextType, ConversationContext, KnowledgeContext, MessageRole, SystemContext, TaskComplexity, TaskContext, TaskStatus, ToolContext, ToolResultStatus, ) __all__ = [ # Budget Management "BudgetAllocator", "TokenBudget", "TokenCalculator", # Configuration "ContextSettings", "get_context_settings", "get_default_settings", "reset_context_settings", # Exceptions "AssemblyTimeoutError", "BudgetExceededError", "CacheError", "CompressionError", "ContextError", "ContextNotFoundError", "FormattingError", "InvalidContextError", "ScoringError", "TokenCountError", # Types - Base "AssembledContext", "BaseContext", "ContextPriority", "ContextType", # Types - Conversation "ConversationContext", "MessageRole", # Types - Knowledge "KnowledgeContext", # Types - System "SystemContext", # Types - Task "TaskComplexity", "TaskContext", "TaskStatus", # Types - Tool "ToolContext", "ToolResultStatus", ]