Implements comprehensive service client layer for Library Desk API to support
Librarian AI agent with multi-tenant knowledge management across Neo4j, Qdrant,
Wiki.js, SearXNG, and Ollama.
## Service Clients (src/clients/)
- Neo4j async client with connection pooling and user-scoped labels
- Qdrant vector store with collection-per-user multi-tenancy
- Wiki.js GraphQL API client for page/dossier management
- SearXNG client for web search integration
- Ollama client for text embeddings (nomic-embed-text)
## Core Infrastructure (src/core/)
- Multi-tenancy helpers for user namespace management
- Wiki.js: path-based namespaces (/users/{user})
- Neo4j: user-specific labels (User_{User}_Document)
- Qdrant: collection per user (library_desk_{user})
- Dependency injection with FastAPI Depends and @lru_cache singletons
- Lifecycle management (startup/shutdown) for all service connections
## Background Jobs (src/jobs/)
- Redis-based job manager for long-running operations
- Job status tracking with 24-hour TTL
- Support for queued, processing, completed, failed states
## Configuration
- Updated config.py with Redis DB 4 for library-desk jobs
- Updated docker-compose.yml: REDIS_DB from 2 to 4
- Added pytest and pytest-asyncio to requirements.txt
## Testing
- Unit tests: 25/25 passed (multi-tenancy helpers)
- Integration tests: 12/12 passed (all services verified)
- Neo4j connection and CRUD operations
- Qdrant vector operations with 768-dim embeddings
- Wiki.js GraphQL queries
- SearXNG web search
- Job Manager with Redis
- Dependency injection lifecycle
- pytest.ini configuration with asyncio support
## Health Monitoring
- Real-time service health checks via /health endpoint
- Connection status for all 5 external services
- Graceful degradation for partial service availability
## Architecture
- Follows async/await pattern throughout
- Connection pooling for Neo4j (singleton driver)
- HTTP client lifecycle management (httpx)
- Multi-tenancy enforced at client layer
- Default user: jpmschweitzer
Files changed: 26 files
- 5 new service clients (~1500 lines)
- 2 core modules (~500 lines)
- 1 job manager (~350 lines)
- 3 test files with 37 test cases
- Updated main.py with lifecycle hooks
All services tested and operational. Ready for Phase 2 (routers/services).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
30 lines
479 B
Plaintext
30 lines
479 B
Plaintext
# Requires Python 3.12+
|
|
|
|
# FastAPI Framework (latest Dec 2024)
|
|
fastapi~=0.115.0
|
|
uvicorn[standard]~=0.32.0
|
|
pydantic~=2.10.0
|
|
pydantic-settings~=2.6.0
|
|
|
|
# HTTP Client (no known CVEs)
|
|
httpx~=0.27.0
|
|
|
|
# Database & Vector Store
|
|
neo4j~=6.0.3
|
|
qdrant-client~=1.16.1
|
|
|
|
# Redis (Python 3.12 compatible)
|
|
redis~=7.1.0
|
|
|
|
# Security
|
|
python-jose[cryptography]~=3.3.0
|
|
passlib[bcrypt]~=1.7.4
|
|
python-multipart~=0.0.20
|
|
|
|
# Utilities
|
|
python-dateutil~=2.9.0
|
|
|
|
# Testing
|
|
pytest~=8.3.0
|
|
pytest-asyncio~=0.24.0
|