- Update all client endpoints to use /housekeeping/ prefix
- Add critical rule requiring list_devices() before control actions
- Add housekeeping API spec documentation
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Convert booleans to strings for Redis hset (Redis doesn't accept bool)
- Extract capability from delegate_to_X tool names for tracking
- Use loop_scope="module" for pytest-asyncio module-scoped fixtures
- Add note about using venv for tests in AGENTS.md
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Messages in reasoning_content should be plain text, not wrapped
in <think> tags. Removed wrappers from:
- delegation.py household think messages
- orchestration.py status messages
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Use DeepSeek R1 format (reasoning_content field) instead of <think>
tags in content. Open WebUI now renders thinking as proper
collapsible blocks instead of broken escaped HTML.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
library-desk now returns keywords as dict with core_keywords field.
Client now handles both list and dict formats for backwards compat.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix `invalid message content type: <nil>` error from Ollama
- Create TatlockOllamaProvider that sanitizes messages (null → "")
- Update all agents to use sanitized provider
- Fix repeating think messages by adding ReasoningSummaryDone signal
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fixes several issues with the web search migration to Librarian:
- Update Steward routing guidelines for web search/weather → Librarian
- Register search_web, read_url, read_urls_batch tools with Librarian agent
- Update Librarian system prompt with web search documentation
- Fix query enrichment not being passed to delegations (location context)
- Add URL reading keywords to RESEARCH action type detection
Weather queries now automatically include user's stored location from
the Biographer, enabling location-aware search results.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Move web search functionality to The Librarian agent, integrating with
the library-desk /rag/search endpoint for enhanced search capabilities.
Changes:
- Add search_web, read_url, read_urls_batch tools to Librarian
- Add WebSearchResult, ContentExtractionResult models to client
- Add search_web, extract_content, extract_content_batch client methods
- Update Librarian capability with web/url/internet domains
- Remove search_web from tatlock_core tools and toolset
- Update Tatlock system prompt to delegate web search to Librarian
- Add comprehensive unit tests for new Librarian tools
- Clean up legacy src/agents/tools.py
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Two-Phase Tatlock Execution:
- orchestrate_tool_calls() for Phase 1 coordination
- synthesize_from_results() for Phase 2 butler-toned synthesis
- Guarantees butler personality in all responses
Automatic Think Slugs:
- Deterministic butler-perspective messages during expert delegation
- ActionType enum: RETRIEVE, RESEARCH, CREATE, CONTROL, RECORD
- HOUSEHOLD_THINK_MESSAGES mapping for all experts
- Streaming delegation wrappers with automatic think messages
Steward Query Enrichment:
- Auto-fill user context (location, timezone) when not specified
- _build_enriched_query() with regex word boundary matching
- enriched_query field in StewardRecommendation schema
Documentation:
- ORCHESTRATION_SCENARIOS.md rewritten with Mermaid diagrams
- New Housekeeper and Biographer scenarios
- TESTING_IMPROVEMENTS.md for future LLM testing patterns
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements The Housekeeper, a new expert agent for home automation
following the Librarian pattern. Communicates with core-api service
which wraps Home Assistant REST API.
New agent features:
- CoreAPIClient with 13 home automation methods
- 13 tools: list_areas, list_devices, get_device_state, turn_on,
turn_off, toggle, list_scenes, activate_scene, list_scripts,
run_script, list_automations, toggle_automation, get_history
- PydanticAI agent with butler-friendly system prompt
- HouseholdCapability registration for Steward coordination
- delegate_to_housekeeper() wrapper for orchestration
Also includes:
- Dev port changed from 8123 to 8777 (avoids Home Assistant conflict)
- Config: CORE_API_HOST, CORE_API_KEY, CORE_API_TIMEOUT
- 44 unit tests for client and capability
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
### Added
- Environment-aware configuration:
- Auto-selected logging (DEBUG for dev, WARNING for prod)
- Auto-selected default user (llm_tester for dev isolation)
- User context logging at request entry
- Direct delegation bypass:
- Pure memory/librarian requests skip Tatlock LLM
- Reduces latency for memory-only requests
- Text-based delegation fallback:
- Parse [DELEGATE:agent] patterns from LLM output
- Sequential and parallel execution support
- Comprehensive E2E test suite:
- 22 orchestration tests with QdrantVerifier
- assert_llm_behavior() for flexible pattern matching
- Tests for memory, delegation, isolation, scenarios
### Fixed
- Unit test mocks for streaming (async generator)
- Temporal context handling in tests
- LLM non-determinism with pytest.xfail()
- Streaming test timeouts increased
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Change `str | None` to `str` with empty default for memory_type
- Remove `keywords` parameter from store_insight (auto-generated anyway)
- Ollama's OpenAI API doesn't handle union types with None properly
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add delegate_to_biographer to household registry delegation map
- Was returning raw tools which caused Ollama "invalid message content type: nil"
- Add Qdrant host/port to .env.example
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix Qdrant client to use query_points API (qdrant-client >= 1.10)
- Rename REDIS_DB to REDIS_BENCHMARK_DB for clarity
- Update Redis defaults to match stack allocation (benchmark=6, memory=1)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add The Biographer household member for user memory management:
Memory Service (direct access layer):
- src/core/memory_service.py for fast, LLM-free lookups
- Profile, preference, and fact management
- Session context with Redis caching
- Steward integration via prefetch_context()
The Biographer Agent:
- src/agents/biographer/ package with PydanticAI agent
- Discreet chronicler personality for privacy
- Tools: recall_semantic, list_memories, store_insight,
update_profile, update_preference, forget_memory
- Registered with Household Registry on startup
Steward Integration:
- Memory context pre-fetch during analysis
- Profile/preferences included in Butler note
- Keyword-based context determination
Also includes:
- delegate_to_biographer() wrapper
- 34 new tests (capability + memory service)
- Version bump to 1.2.0
Documentation cleanup:
- Removed obsolete PHASE2_COMPLETE.md, PHASE2_PLAN.md
- Removed docs/library-desk-requirements.md
- Moved ORCHESTRATION_SCENARIOS.md to project root
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds multi-expert coordination infrastructure:
- ExecutionMode enum (SEQUENTIAL, PARALLEL)
- MultiExpertResult dataclass for aggregating results
- execute_sequential(): Tasks run one after another
- execute_parallel(): Tasks run concurrently via asyncio.gather
- orchestrate_multi_expert(): Streaming think updates during multi-expert work
Supports:
- Stop-on-failure mode for sequential execution
- Partial failure handling (some succeed, some fail)
- Result aggregation with combined output formatting
- Exception handling in parallel execution
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Creates orchestration module for multi-expert coordination:
- parse_delegation_from_steward_note(): Extracts delegation task
- execute_delegation(): Routes to appropriate expert agent
- orchestrate_with_think_updates(): Streams <think> updates around
delegation calls while using run() internally
This enables real-time user feedback while avoiding Ollama's
streaming+tool call bugs.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Updates Steward's output format to structured delegation format:
- DELEGATE: [capability] to [action] [task]
- REASON: [explanation]
- COMPLEXITY: [simple/moderate/complex]
- CONTEXT: [relevant history or "none"]
Also adds guidance for conversation memory queries (handled by
Tatlock directly, not delegated to Librarian).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Changes preprocessing to use get_delegation_tools() instead of
get_scoped_tools(). Expert agents now get delegation wrappers
(delegate_to_librarian) while core tools are returned directly.
This reduces Tatlock's cognitive load from 16+ tools to ~3-5.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements the agent-as-tool pattern in the registry:
- For members WITH an agent: returns delegation wrapper function
- For members WITHOUT an agent: returns raw tools directly
This reduces Tatlock's tool count from 16+ to ~3-5, preventing
cognitive overload and improving Ollama reliability.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Introduces agent-as-tool pattern infrastructure:
- DelegationTask: Structured representation of expert work
- DelegationResult: Typed result from expert delegation
- delegate_to_librarian(): Wrapper for Librarian agent calls
This implements PydanticAI's recommended delegation pattern where
parent agents call child agents via tool wrappers.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
PydanticAI + Ollama streaming with tool calls has known issues:
- Issue #1292: Streaming stops after tool call due to empty TextPart
- Issue #2256: Empty text part causes run to end prematurely
This change uses run() for the actual tool execution while still
yielding the response in chunks to maintain the streaming UX.
The orchestration loop can emit <think> updates between await calls.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Update Librarian capability description to highlight CREATE/UPDATE/SEARCH
- Add specific Steward guidelines for wiki creation, updates, and research
- Add dynamic time injection to user prompts for temporal awareness
- Expand domains to include 'create', 'write', 'update'
- Update test to match new capability description
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add _get_version_from_pyproject() function to config.py
- APP_VERSION now uses default_factory to load from pyproject.toml
- Add pyproject.toml to Docker build for version detection
- Add LIBRARY_DESK configuration settings
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add Librarian registration to household member registration
- Error handling to prevent startup failure if Librarian unavailable
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- CoordinationEngine for task orchestration between agents
- Routing tasks to appropriate expert agents
- Sequential and parallel execution support
- Result aggregation from multiple agents
- Graceful error handling and degradation
- Streaming delegation support
- Convenience functions: delegate_to_librarian(), delegate_to_librarian_stream()
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Library-Desk API Client:
- Async HTTP client with httpx for library-desk API
- HybridRAG search (vector + graph + web)
- Wiki operations (search, get, list, create, update)
- Smart page creation with HybridRAG research
- Semantic vector search and knowledge graph queries
- Dossier browsing and health checks
Librarian Tools (11 total):
- Research: hybrid_search, search_wiki, get_wiki_page, semantic_search
- Browse: list_dossiers, get_dossier_pages, explore_knowledge_graph
- Graph: find_related_entities
- Write: create_wiki_page, update_wiki_page, smart_create_wiki_page
Agent:
- PydanticAI agent with research assistant personality
- System prompt with research and writing workflows
- Streaming support via run_librarian_stream()
Capability:
- LIBRARIAN_CAPABILITY definition for Household Registry
- Automatic registration on startup
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fix streaming issues that caused text repetition and broken tool execution
in Open WebUI. Implements real LLM streaming using PydanticAI's run_stream()
with delta=True instead of artificial word-by-word chunking.
**Fixed:**
- Text repetition in streaming output (was accumulating instead of deltas)
- Broken tool execution (tools now execute properly in streaming mode)
- Invalid 'thinking' parameter in ReasoningOutputItem schema
**Changes:**
- Add run_with_scoped_tools_stream() method to TatlockAgent
- Uses PydanticAI's run_stream() with delta=True for real deltas
- Properly streams LLM output with tool execution
- Update StreamingCoordinator.stream_response_with_steward()
- Uses new streaming method instead of fake word-by-word streaming
- Removes invalid thinking parameter from ReasoningOutputItem
- All streaming now uses actual LLM deltas, not accumulated text
Resolves streaming issues reported in Open WebUI where responses showed
repetitive text and tool calls appeared as raw JSON instead of executed results.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add two major features to enhance Tatlock's capabilities:
1. Conversation History Support:
- Convert OpenAI-format messages to PydanticAI ModelRequest/ModelResponse
- Pass full conversation context via message_history parameter
- Filter empty messages to prevent Ollama errors
- Add debug logging for message history construction
- Tatlock now remembers previous turns in multi-turn conversations
2. Tool Call Logging:
- Implement ToolCallTracker dependency for per-request tracking
- Tools log usage via RunContext deps parameter
- Web search: "🔍 Searching for: 'query'"
- Calculator: "🧮 Calculating: expression"
- Date/time: "🕐 Calculating date offset: description"
- Tool logs appear in reasoning output as <think> tags in Open WebUI
Both features improve user experience by maintaining conversation context
and providing transparency into tool usage.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Convert Tatlock from mock to real PydanticAI agent:
- Connect to Ollama backend (mistral-nemo:latest)
- British butler personality with research-oriented mindset
- Lazy initialization pattern for better testability
- Register permanent tools (calculator, date/time, search)
- Streaming response support with reasoning output
- Error handling for PydanticAI exceptions
- Update registry tests for tools capability
- Add integration test for streaming functionality
- Add SEARXNG_HOST config with localhost:8087 default
- Add SEARXNG_TIMEOUT setting (30 seconds default)
- Update .env.example with SearXNG configuration
- Supports both local and production SearXNG instances
Version increment to mark basic setup completion milestone.
Changes:
- Updated APP_VERSION to 0.1.1 in src/core/config.py
- Released CHANGELOG.md [Unreleased] section as [0.1.1]
- Updated version links to use git.schweitz.net repository
This version represents the completion of all core infrastructure:
- Agent interface and implementations
- Responses API with full feature set
- Chat Completions wrapper
- Comprehensive test coverage (95 tests, 78.95%)
- Production-ready architecture
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Application Configuration:
- FastAPI application factory pattern
- CORS middleware for cross-origin support
- Global exception handlers for consistent error responses
- AppException handler for custom errors
- RequestValidationError handler for Pydantic validation
- General exception handler for unexpected errors
- Lifespan management for startup/shutdown events
- Router registration for all API endpoints
- OpenAPI schema with interactive documentation
Models Service:
- Integration with ModelRegistry
- List available models endpoint
- Model capability discovery
Test Infrastructure:
- Pytest configuration with async support
- Test client fixtures for sync and async testing
- Comprehensive main application tests (14 tests):
- App creation and metadata
- Router registration verification
- CORS middleware and functionality
- Exception handler registration and behavior
- Lifespan event handling
- OpenAPI schema generation
- Documentation accessibility
- Validation error handling
- Models API tests (2 tests)
- Total: 95 tests, 78.95% coverage
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Implements Phase 5: OpenAI Chat Completions compatibility layer
Features:
- Wraps Responses API for single source of truth
- Automatically enables reasoning generation
- Converts reasoning items to <think> tags for Open WebUI
- Maintains OpenAI-compatible chat completion format
- Supports both streaming and non-streaming modes
- Pipeline prefix preservation for model names
- System message handling
Architecture:
- Service layer calls Responses API internally
- Streams word-by-word for smooth UX
- Reasoning displayed in thought bubbles (Open WebUI)
- Main response shown separately from thinking
Error Handling:
- Enhanced exception types (RateLimitError, ContextLengthError)
- OpenAI-compatible error format
- Graceful error propagation from Responses API
Testing:
- 6 unit tests for chat router functionality
- 6 unit tests for streaming wrapper behavior
- Total: 12 tests with comprehensive coverage
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Implements Phases 2, 3, and 6: Complete Responses API implementation
Core API (Phase 2):
- OpenAI Responses API format with structured output items
- Streaming and non-streaming support via SSE-Starlette
- Reasoning items (thinking summaries)
- Function call items (tool execution)
- Message items (assistant responses)
- Router, schemas, service, and streaming coordinator
Conversation History (Phase 3):
- Hybrid client/server approach
- Auto-generated deterministic conversation IDs
- Configurable max turns with automatic trimming
- Context window management with token counting
- Token usage statistics
- Placeholder for future vector memory integration
Advanced Features (Phase 6):
- Parameter validation with Pydantic field validators:
- Temperature: 0.0-2.0 range enforcement
- Reasoning effort: 6 levels (none to xhigh)
- Max output tokens: positive integer enforcement
- Stop sequences: up to 4, non-empty strings
- Real-time stop sequence detection during streaming
- Real-time max tokens enforcement with token counting
- Graceful error handling and OpenAI-compatible error format
Testing:
- 9 unit tests for API endpoints and streaming
- 11 unit tests for error handling
- 13 unit tests for conversation history and context
- 12 unit tests for advanced features and validation
- Total: 45 tests with comprehensive coverage
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Implements Phase 1: Agent abstraction layer with multiple model support
Features:
- Abstract AgentInterface base class with standard contract
- LoremTesterAgent: Full-featured mock agent with realistic behavior
- Configurable reasoning effort levels (none to xhigh)
- Random tool/function call generation
- Error triggers for testing (rate_limit, context_overflow)
- Temperature-based response variation
- TatlockAgent: Placeholder for future PydanticAI integration
- ModelRegistry: Centralized model management and discovery
Testing:
- 9 unit tests for lorem-tester agent behavior
- 9 unit tests for registry operations
- Coverage: Agent abstraction fully tested
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Implement application factory pattern with clean main.py.
Separate routers for each domain, centralized exception handling.
Core Router (src/core/router.py):
- Root endpoint (/)
- Health check endpoint (/health)
- Simple status responses
- No prefix (mounted at root)
Main Application (src/main.py):
- create_application() factory function
- Clean configuration-focused main.py
- CORS middleware setup
- Exception handler registration
- Router registration with proper prefixes
- Global config integration
Application Architecture:
- Application factory pattern for testability
- Routers imported from separate controllers
- Exception handlers in dedicated function
- All routes cleanly separated by domain
Exception Handling:
- OpenAI-compatible error format
- Custom AppException handler
- Validation error handler (422)
- Generic exception handler (500)
Following Best Practices:
- Separation of concerns
- Factory pattern for DI
- Clean main.py (config only)
- Type hints throughout
Status: Production-ready structure
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Add OpenAI-compatible models listing endpoint.
Currently returns mock model (mistral-nemo:latest).
Models Router (src/models/router.py):
- GET /v1/models endpoint
- OpenAI-compatible response format
- Lists available models
Models Schemas (src/models/schemas.py):
- Model object with id, created, owned_by
- ModelsListResponse with data array
- Full OpenAI API compatibility
Models Service (src/models/service.py):
- list_models() function
- Mock model listing (ready for Ollama integration)
- Returns mistral-nemo:latest as default
Following Best Practices:
- Business logic in service layer
- Router only handles HTTP concerns
- Type hints throughout
- Async/await pattern
Model: mistral-nemo:latest
Status: Mock implementation (ready for Ollama integration)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Add OpenAI-compatible chat completions endpoint with streaming support.
Currently returns mock lorem ipsum responses (Ollama integration pending).
Chat Router (src/chat/router.py):
- POST /v1/chat/completions endpoint
- Streaming and non-streaming support
- SSE format with EventSourceResponse
- 20-second timeout protection
- OpenAI-compatible response format
Chat Schemas (src/chat/schemas.py):
- ChatMessage, ChatCompletionRequest
- ChatCompletionResponse, ChatCompletionChoice
- ChatCompletionChunk for streaming
- Full OpenAI API compatibility
Chat Service (src/chat/service.py):
- create_chat_completion() - non-streaming
- create_chat_completion_stream() - streaming word-by-word
- Mock lorem ipsum responses
- Token usage calculation
Chat Constants (src/chat/constants.py):
- OpenAI API constants for consistency
- Object types, roles, finish reasons
Following Best Practices:
- Business logic in service layer
- Router only handles HTTP concerns
- Async generators for streaming
- Type hints throughout
Model: mistral-nemo:latest
Status: Mock implementation (ready for Ollama integration)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Add production-ready async HTTP client for Ollama API communication
with proper error handling and dependency injection.
Ollama Client (src/ollama/client.py):
- Async context manager for connection lifecycle
- Non-streaming chat endpoint
- Streaming chat endpoint with async generator
- Model listing endpoint
- Health check endpoint
- Timeout configuration per request
- Comprehensive error handling with custom exceptions
- FastAPI dependency injection support
Ollama Schemas (src/ollama/schemas.py):
- OllamaMessage: Chat message format
- OllamaChatRequest: Request with model, messages, options
- OllamaChatResponse: Complete chat response
- OllamaModelInfo: Model metadata
- OllamaModelsResponse: Model list response
Features:
- Async/await throughout for non-blocking I/O
- Connection pooling via httpx.AsyncClient
- Configurable timeouts (default: 120s)
- Proper exception mapping (connection errors, timeouts)
- Ready for integration (currently not connected to routes)
Following Best Practices:
- Async context manager pattern
- Dependency injection for FastAPI routes
- Separation of concerns (client vs schemas)
- Type hints throughout
- Comprehensive logging
Status: Ready for integration (mock responses used in routes currently)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Implement global application configuration and custom Pydantic models
following FastAPI best practices.
Core Configuration (src/core/config.py):
- BaseSettings with environment variable support
- Split configuration by domain (following best practices)
- Ollama connection settings (host, model, timeouts)
- API configuration (host, port, prefix)
- CORS settings
- 20-second streaming timeout per turn
- Cached configuration with @lru_cache
Custom Base Models (src/core/models.py):
- CustomBaseModel for consistent serialization
- ISO datetime formatting
- Alias population support
- Enum value serialization
- Validation on assignment
- serializable_dict() for logging/debugging
Exception Handling (src/core/exceptions.py):
- Base AppException with status codes
- OllamaConnectionError (503)
- OllamaTimeoutError (504)
- ModelNotFoundError (404)
- ValidationError (422)
- OpenAI-compatible error structure
Benefits:
- Consistent configuration across domains
- Type-safe settings with validation
- Easy environment override via .env
- Predictable error responses
- Better debugging with serializable models
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>