IntegraChat / FILE_STRUCTURE.md
nothingworry's picture
all the thing
78b6d7b
|
raw
history blame
4.28 kB

IntegraChat - Current File Structure

IntegraChat/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ api/
β”‚   β”‚   β”œβ”€β”€ main.py                          # FastAPI main application
β”‚   β”‚   β”œβ”€β”€ mcp_clients/
β”‚   β”‚   β”‚   β”œβ”€β”€ admin_client.py              # Admin MCP client
β”‚   β”‚   β”‚   β”œβ”€β”€ mcp_client.py                # Main MCP client wrapper
β”‚   β”‚   β”‚   β”œβ”€β”€ rag_client.py                # RAG MCP client
β”‚   β”‚   β”‚   └── web_client.py                 # Web search MCP client
β”‚   β”‚   β”œβ”€β”€ models/
β”‚   β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”‚   β”œβ”€β”€ agent.py                     # Agent request/response models
β”‚   β”‚   β”‚   └── redflag.py                   # Red flag rule models
β”‚   β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”‚   β”œβ”€β”€ admin.py                     # Admin routes
β”‚   β”‚   β”‚   β”œβ”€β”€ agent.py                     # Agent chat routes
β”‚   β”‚   β”‚   β”œβ”€β”€ analytics.py                 # Analytics routes
β”‚   β”‚   β”‚   β”œβ”€β”€ rag.py                       # RAG routes
β”‚   β”‚   β”‚   └── web.py                       # Web search routes
β”‚   β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”‚   β”œβ”€β”€ agent_orchestrator.py        # Main orchestrator (multi-tool execution)
β”‚   β”‚   β”‚   β”œβ”€β”€ intent_classifier.py         # Intent classification service
β”‚   β”‚   β”‚   β”œβ”€β”€ llm_client.py                # LLM client (Ollama/Groq)
β”‚   β”‚   β”‚   β”œβ”€β”€ prompt_builder.py            # Prompt building utilities
β”‚   β”‚   β”‚   β”œβ”€β”€ redflag_detector.py          # Red flag detection service
β”‚   β”‚   β”‚   └── tool_selector.py             # Multi-tool selection logic
β”‚   β”‚   └── utils/
β”‚   β”‚       └── text_extractor.py            # Text extraction utilities
β”‚   β”œβ”€β”€ mcp_server/
β”‚   β”‚   β”œβ”€β”€ server.py                        # Unified MCP entrypoint (rag/web/admin)
β”‚   β”‚   β”œβ”€β”€ rag/                             # RAG tool handlers (search/ingest/delete)
β”‚   β”‚   β”œβ”€β”€ web/                             # Web search tool handler
β”‚   β”‚   β”œβ”€β”€ admin/                           # Admin rules + violations tools
β”‚   β”‚   └── common/                          # Shared tenant/logging/utils helpers
β”‚   β”œβ”€β”€ tests/
β”‚   β”‚   β”œβ”€β”€ conftest.py                      # Pytest configuration
β”‚   β”‚   β”œβ”€β”€ test_agent_orchestrator.py       # Orchestrator tests
β”‚   β”‚   └── test_intent.py                   # Intent classification tests
β”‚   └── workers/                             # Background workers (empty)
β”‚
β”œβ”€β”€ venv/                                    # Python virtual environment
β”œβ”€β”€ env.example                              # Environment variables template
β”œβ”€β”€ pytest.ini                               # Pytest configuration
β”œβ”€β”€ README.md                                # Project documentation
β”œβ”€β”€ requirements.txt                         # Python dependencies
└── start.bat                                # Windows startup script

Key Files Overview

Core Services

  • agent_orchestrator.py - Main orchestrator handling multi-tool execution
  • tool_selector.py - Intelligent multi-tool selection (RAG + Web + LLM)
  • intent_classifier.py - Classifies user intent
  • redflag_detector.py - Detects policy violations

MCP Servers

  • backend/mcp_server/server.py - Unified MCP entrypoint (rag/web/admin tools)
  • backend/mcp_server/rag/*.py - RAG tool handlers (search/ingest/delete)
  • backend/mcp_server/web/search.py - DuckDuckGo handler
  • backend/mcp_server/admin/*.py - Admin rules & violations tools

API Routes

  • agent.py - Main chat/agent endpoint
  • rag.py - RAG operations
  • web.py - Web search operations
  • admin.py - Admin operations
  • analytics.py - Analytics endpoints

Models

  • agent.py - AgentRequest, AgentDecision, AgentResponse
  • redflag.py - RedFlagRule, RedFlagMatch

MCP Clients

  • mcp_client.py - Unified MCP client wrapper
  • rag_client.py - RAG client
  • web_client.py - Web search client
  • admin_client.py - Admin client