-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_vectorstore.py
More file actions
61 lines (50 loc) · 1.8 KB
/
Copy pathtest_vectorstore.py
File metadata and controls
61 lines (50 loc) · 1.8 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
#!/usr/bin/env python3
"""
Test script to debug vector store creation issues
"""
import os
from dotenv import load_dotenv
from supporting_functions import create_chunks, create_vector_store
# Load environment variables
load_dotenv()
def test_vector_store():
print("Testing vector store creation...")
# Check if API key is loaded
api_key = os.getenv('GOOGLE_API_KEY')
if not api_key:
print("ERROR: GOOGLE_API_KEY not found in environment variables")
return False
else:
print(f"API Key found: {api_key[:10]}...")
# Test with sample transcript
sample_transcript = """
This is a sample transcript for testing purposes.
It contains multiple sentences to test the chunking functionality.
We want to make sure that the vector store creation works properly.
This should be enough text to create meaningful chunks for testing.
"""
try:
print("Creating chunks...")
chunks = create_chunks(sample_transcript)
print(f"Created {len(chunks)} chunks")
print("Creating vector store...")
vector_store = create_vector_store(chunks)
print("Vector store created successfully!")
# Test similarity search
print("Testing similarity search...")
results = vector_store.similarity_search("testing", k=2)
print(f"Found {len(results)} similar documents")
return True
except Exception as e:
print(f"ERROR: {e}")
print(f"ERROR TYPE: {type(e)}")
import traceback
print("FULL TRACEBACK:")
traceback.print_exc()
return False
if __name__ == "__main__":
success = test_vector_store()
if success:
print("✅ Vector store test passed!")
else:
print("❌ Vector store test failed!")