File size: 1,301 Bytes
0c8aadf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import sys
import os
import asyncio

# Add current directory to path
sys.path.append(os.getcwd())

from app.core.config import settings
from app.services.enrichment import AIEnrichmentService
from app.services.generation import GenerationService

async def verify_models():
    print("--- Verifying Local Models ---")
    print(f"USE_LOCAL_MODELS: {settings.USE_LOCAL_MODELS}")
    print(f"Effective LLM: {settings.get_effective_llm()}")
    print(f"Effective Embedding: {settings.get_effective_embedding()}")

    enricher = AIEnrichmentService()
    generator = GenerationService()

    # 1. Test Embedding
    print("\n1. Testing Local Embedding...")
    text = "Hello world"
    embedding = await enricher.generate_embedding(text)
    print(f"Embedding generated! Length: {len(embedding)}")
    assert len(embedding) == 384, f"Expected 384, got {len(embedding)}"

    # 2. Test Generation
    print("\n2. Testing Local Generation (Lightweight)...")
    query = "Who are you?"
    context = [{"payload": {"text": "I am a local AI assistant."}}]
    response = await generator.generate_answer(query, context)
    print(f"Answer: {response['answer']}")
    print(f"Citations: {response['citations']}")

if __name__ == "__main__":
    asyncio.run(verify_models())