Files
dnviti 73c352128b
Some checks failed
CI/CD Pipeline / Lint Code (push) Failing after 7m34s
CI/CD Pipeline / Run Tests (push) Has been skipped
CI/CD Pipeline / Security Scanning (push) Has been skipped
CI/CD Pipeline / Build and Push Docker Images (api) (push) Has been skipped
CI/CD Pipeline / Build and Push Docker Images (chat) (push) Has been skipped
CI/CD Pipeline / Build and Push Docker Images (frontend) (push) Has been skipped
CI/CD Pipeline / Build and Push Docker Images (worker) (push) Has been skipped
CI/CD Pipeline / Deploy to Staging (push) Has been skipped
CI/CD Pipeline / Deploy to Production (push) Has been skipped
CI/CD Pipeline / Generate Documentation (push) Failing after 7m59s
feat: add Docker Compose configuration for MongoDB, Redis, FastAPI, Chat, Worker, Flower, and Frontend services; include health checks and volume management
2025-10-21 11:45:08 +02:00

60 lines
1.7 KiB
Python
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
"""
Test script for RAG system in chat service
"""
import asyncio
import sys
from pathlib import Path
# Add src to path
sys.path.insert(0, str(Path(__file__).parent.parent / "src"))
from datacenter_docs.chat.agent import DocumentationAgent
from datacenter_docs.utils.llm_client import get_llm_client
async def test_rag_search():
"""Test RAG search and retrieval"""
print("🧪 Testing RAG system...\n")
# Initialize agent
print("1⃣ Initializing DocumentationAgent...")
agent = DocumentationAgent(vector_store_path="./data/chroma_db")
print("✅ Agent initialized\n")
# Test queries
test_queries = [
"Come è configurato smarthome-services?",
"Quali VM sono in esecuzione?",
"Come faccio il backup dei container?",
"Configurazione di storage su Proxmox",
]
for i, query in enumerate(test_queries, 1):
print(f"\n{'='*60}")
print(f"Query {i}: {query}")
print('='*60)
# Search documentation
results = await agent.search_documentation(query, limit=3)
if results:
print(f"\n📚 Found {len(results)} results:\n")
for j, result in enumerate(results, 1):
print(f" {j}. Section: {result['section']}")
print(f" Relevance: {result['relevance_score']:.3f} ({result['relevance_score']*100:.1f}%)")
print(f" Source: {Path(result['source']).name}")
print(f" Content preview: {result['content'][:100]}...")
print()
else:
print("❌ No results found")
print("\n" + "="*60)
print("✅ RAG test completed successfully!")
print("="*60)
if __name__ == "__main__":
asyncio.run(test_rag_search())