You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
proxysql/RAG_FILE_SUMMARY.md

2.5 KiB

RAG Implementation File Summary

New Files Created

Core Implementation

  • include/RAG_Tool_Handler.h - RAG tool handler header
  • lib/RAG_Tool_Handler.cpp - RAG tool handler implementation

Test Files

  • test/test_rag_schema.cpp - Test to verify RAG database schema
  • test/build_rag_test.sh - Simple build script for RAG test
  • test/Makefile - Updated to include RAG test compilation

Documentation

  • doc/rag-documentation.md - Comprehensive RAG documentation
  • doc/rag-examples.md - Examples of using RAG tools
  • RAG_IMPLEMENTATION_SUMMARY.md - Summary of RAG implementation

Scripts

  • scripts/mcp/test_rag.sh - Test script for RAG functionality

Files Modified

Core Integration

  • include/MCP_Thread.h - Added RAG tool handler member
  • lib/MCP_Thread.cpp - Added RAG tool handler initialization and cleanup
  • lib/ProxySQL_MCP_Server.cpp - Registered RAG endpoint
  • lib/AI_Features_Manager.cpp - Added RAG database schema creation

Configuration

  • include/GenAI_Thread.h - Added RAG configuration variables
  • lib/GenAI_Thread.cpp - Added RAG configuration variable initialization

Documentation

  • scripts/mcp/README.md - Updated to include RAG in architecture and tools list

Key Features Implemented

  1. MCP Integration: RAG tools available via /mcp/rag endpoint
  2. Database Schema: Complete RAG table structure with FTS and vector support
  3. Search Tools: FTS, vector, and hybrid search with RRF scoring
  4. Fetch Tools: Get chunks and documents with configurable return parameters
  5. Admin Tools: Statistics and monitoring capabilities
  6. Security: Input validation, limits, and timeouts
  7. Configuration: Runtime-configurable RAG parameters
  8. Testing: Comprehensive test scripts and documentation

MCP Tools Provided

  • rag.search_fts - Keyword search using FTS5
  • rag.search_vector - Semantic search using vector embeddings
  • rag.search_hybrid - Hybrid search (fuse and fts_then_vec modes)
  • rag.get_chunks - Fetch chunk content
  • rag.get_docs - Fetch document content
  • rag.fetch_from_source - Refetch authoritative data
  • rag.admin.stats - Operational statistics

Configuration Variables

  • genai.rag_enabled - Enable RAG features
  • genai.rag_k_max - Maximum search results
  • genai.rag_candidates_max - Maximum candidates for hybrid search
  • genai.rag_query_max_bytes - Maximum query length
  • genai.rag_response_max_bytes - Maximum response size
  • genai.rag_timeout_ms - Operation timeout