Orion - Knowledge Organization Agent
Overview
Orion is the Folder Organization agent in the TKM AI Agency Platform, responsible for intelligently organizing files and documents into appropriate folder structures. It analyzes document content and metadata to determine optimal categorization and file placement.
Directory Structure
Backend/CRM/Orion/
├── data/ # Organization decisions and logs
├── orion.py # Main agent implementation
├── tools.py # Organization utilities
├── tools_schema.py # Data models and schemas
└── tools_definitions.py # Constants and definitions
Main Components
OrionAgent Class
The core component that handles file organization:
- Document analysis
- Folder structure determination
- Category assignment
- Metadata management
Processing Pipeline
-
Document Reception
- File metadata extraction
- Content analysis
- Context gathering
- Request validation
-
Organization Analysis
- Content categorization
- Structure determination
- Confidence scoring
- Category mapping
-
Structure Management
- Folder creation decisions
- Path generation
- Metadata updates
- Structure validation
API Operations
Process Organization
- Endpoint:
/process_request
- Method: POST
- Purpose: Analyzes and determines folder structure for documents
- Request Format:
{ "file_name": "document.pdf", "conversation_id": "conversation_identifier", "document_data": { "extracted_text": "document content", "summary": "document summary" }, "user_id": "user_identifier", "organization_id": "org_identifier" }
- Response Format:
{ "folder_name": "determined_folder", "file_name": "document.pdf", "category": "main_category", "subcategory": "sub_category", "state": "processed", "confidence": 0.95 }
Key Features
-
Document Analysis
- Content understanding
- Metadata extraction
- Category detection
- Context analysis
-
Structure Determination
- Intelligent categorization
- Folder hierarchy
- Path optimization
- Naming conventions
-
Organization Management
- Decision tracking
- Structure validation
- History logging
- Metadata updates
Integration
Platform Integration
- Interfaces with other CRM agents
- Event-based communication
- Metadata sharing
- Structure coordination
LLM Integration
- Groq primary provider
- OpenAI fallback support
- Content analysis
- Category determination
Error Handling
-
Input Validation
- File validation
- Data verification
- Request formatting
- Recovery procedures
-
Processing Errors
- Analysis failures
- Structure conflicts
- Category mismatches
- Error reporting
Performance Features
-
Optimization
- Quick categorization
- Efficient processing
- Cache utilization
- Resource management
-
Configuration
- Category rules
- Structure templates
- Model selection
- Provider settings
Data Models
Folder Request
{
"file_name": str,
"conversation_id": str,
"document_data": dict,
"user_id": str,
"organization_id": str
}
Folder Structure
{
"folder_name": str,
"file_name": str,
"category": str,
"subcategory": str,
"state": str,
"confidence": float
}