## Agents Added - Alateya: R&D, biotech, innovations - Clan (Spirit): Community spirit agent - Eonarch: Consciousness evolution agent ## Changes - docker-compose.node1.yml: Added tokens for all 3 new agents - gateway-bot/http_api.py: Added configs and webhook endpoints - gateway-bot/clan_prompt.txt: New prompt file - gateway-bot/eonarch_prompt.txt: New prompt file ## Fixes - Fixed ROUTER_URL from :9102 to :8000 (internal container port) - All 9 Telegram agents now working ## Documentation - Created PROJECT-MASTER-INDEX.md - single entry point - Added various status documents and scripts Tokens configured: - Helion, NUTRA, Agromatrix (existing) - Alateya, Clan, Eonarch (new) - Druid, GreenFood, DAARWIZZ (configured)
73 lines
2.7 KiB
Python
73 lines
2.7 KiB
Python
"""
|
|
Pydantic models for RAG Service API
|
|
"""
|
|
|
|
from typing import Optional, List, Dict, Any
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class IngestRequest(BaseModel):
|
|
"""Request for document ingestion"""
|
|
dao_id: str = Field(..., description="DAO identifier")
|
|
doc_id: str = Field(..., description="Document identifier")
|
|
parsed_json: Dict[str, Any] = Field(..., description="ParsedDocument JSON from PARSER service")
|
|
user_id: Optional[str] = Field(None, description="User identifier")
|
|
|
|
|
|
class IngestResponse(BaseModel):
|
|
"""Response from document ingestion"""
|
|
status: str = Field(..., description="Status: success or error")
|
|
doc_count: int = Field(..., description="Number of documents ingested")
|
|
dao_id: str = Field(..., description="DAO identifier")
|
|
doc_id: str = Field(..., description="Document identifier")
|
|
message: Optional[str] = Field(None, description="Error message if status=error")
|
|
|
|
|
|
class QueryRequest(BaseModel):
|
|
"""Request for RAG query"""
|
|
dao_id: str = Field(..., description="DAO identifier")
|
|
question: str = Field(..., description="User question")
|
|
top_k: Optional[int] = Field(None, description="Number of documents to retrieve")
|
|
user_id: Optional[str] = Field(None, description="User identifier")
|
|
|
|
|
|
class Citation(BaseModel):
|
|
"""Citation from retrieved document"""
|
|
doc_id: str = Field(..., description="Document identifier")
|
|
page: int = Field(..., description="Page number")
|
|
section: Optional[str] = Field(None, description="Section name")
|
|
excerpt: str = Field(..., description="Document excerpt")
|
|
|
|
|
|
class QueryResponse(BaseModel):
|
|
"""Response from RAG query"""
|
|
answer: str = Field(..., description="Generated answer")
|
|
citations: List[Citation] = Field(..., description="List of citations")
|
|
documents: List[Dict[str, Any]] = Field(..., description="Retrieved documents (for debugging)")
|
|
|
|
|
|
class UpsertChunk(BaseModel):
|
|
content: str = Field(..., description="Chunk content")
|
|
meta: Dict[str, Any] = Field(default_factory=dict, description="Chunk metadata")
|
|
|
|
|
|
class UpsertRequest(BaseModel):
|
|
chunks: List[UpsertChunk] = Field(..., description="Chunks to index")
|
|
|
|
|
|
class UpsertResponse(BaseModel):
|
|
status: str = Field(..., description="Status: success or error")
|
|
indexed_count: int = Field(..., description="Number of chunks indexed")
|
|
message: Optional[str] = Field(None, description="Optional message")
|
|
|
|
|
|
class DeleteByFingerprintRequest(BaseModel):
|
|
fingerprint: str = Field(..., description="Index fingerprint to delete")
|
|
|
|
|
|
class DeleteResponse(BaseModel):
|
|
status: str = Field(..., description="Status: success or error")
|
|
deleted_count: int = Field(..., description="Number of chunks deleted")
|
|
message: Optional[str] = Field(None, description="Optional message")
|
|
|