-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest-rag-indexing.sh
More file actions
executable file
·65 lines (57 loc) · 2.31 KB
/
test-rag-indexing.sh
File metadata and controls
executable file
·65 lines (57 loc) · 2.31 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
echo "Testing RAG Indexing with cleaned text preprocessing..."
echo "=================================================="
# Test if Ollama is running
echo "1. Checking Ollama status..."
if curl -s http://localhost:11434/api/tags > /dev/null 2>&1; then
echo "✅ Ollama is running"
# Check for embedding model
if curl -s http://localhost:11434/api/tags | grep -q "embeddinggemma"; then
echo "✅ embeddinggemma model is available"
else
echo "❌ embeddinggemma model not found"
echo " Run: ollama pull embeddinggemma"
exit 1
fi
else
echo "❌ Ollama is not running"
echo " Run: ollama serve"
exit 1
fi
# Test PostgreSQL connection
echo ""
echo "2. Checking PostgreSQL with pgvector..."
if psql -U akashswamy -d noteraity_vectors -c "SELECT 1;" > /dev/null 2>&1; then
echo "✅ PostgreSQL is accessible"
# Check pgvector extension
if psql -U akashswamy -d noteraity_vectors -c "SELECT * FROM pg_extension WHERE extname = 'vector';" | grep -q vector; then
echo "✅ pgvector extension is installed"
else
echo "⚠️ pgvector extension not found, attempting to create..."
psql -U akashswamy -d noteraity_vectors -c "CREATE EXTENSION IF NOT EXISTS vector;"
fi
# Check chunks table
CHUNK_COUNT=$(psql -U akashswamy -d noteraity_vectors -t -c "SELECT COUNT(*) FROM note_chunks;" 2>/dev/null | tr -d ' ')
echo "📊 Current chunks in database: $CHUNK_COUNT"
# Check chunks with embeddings
EMBEDDING_COUNT=$(psql -U akashswamy -d noteraity_vectors -t -c "SELECT COUNT(*) FROM note_chunks WHERE embedding IS NOT NULL;" 2>/dev/null | tr -d ' ')
echo "📊 Chunks with embeddings: $EMBEDDING_COUNT"
else
echo "❌ PostgreSQL is not accessible"
echo " Check your PostgreSQL service and credentials"
exit 1
fi
echo ""
echo "3. Test complete!"
echo ""
echo "To manually test indexing:"
echo " 1. Open the app with: npm run tauri:dev"
echo " 2. Create or edit a note"
echo " 3. Click the database icon to see RAG debug info"
echo " 4. Check the console for preprocessing logs"
echo ""
echo "Look for these log messages:"
echo " 📝 Preprocessing note..."
echo " 📦 Created X chunks for note..."
echo " 🔄 Generating embedding for chunk..."
echo " ✅ Successfully generated embedding..."