-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_llm_basic.py
More file actions
46 lines (41 loc) · 1.22 KB
/
test_llm_basic.py
File metadata and controls
46 lines (41 loc) · 1.22 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
"""
Basic test of LLM functionality
"""
# Test 1: Basic imports
print("Testing imports...")
try:
import pandas as pd
import numpy as np
print("✅ Pandas/NumPy working")
except Exception as e:
print(f"❌ Pandas/NumPy error: {e}")
# Test 2: Ollama connection
print("\nTesting Ollama...")
try:
import ollama
response = ollama.chat(
model='llama2',
messages=[{'role': 'user', 'content': 'Say "working" if you can respond'}]
)
print(f"✅ Ollama working: {response['message']['content']}")
except Exception as e:
print(f"❌ Ollama error: {e}")
print("💡 Try: ollama pull llama2")
# Test 3: Sentence transformers
print("\nTesting sentence transformers...")
try:
from sentence_transformers import SentenceTransformer
model = SentenceTransformer('all-MiniLM-L6-v2')
embedding = model.encode("test sentence")
print(f"✅ Embeddings working: {len(embedding)} dimensions")
except Exception as e:
print(f"❌ Embeddings error: {e}")
# Test 4: ChromaDB
print("\nTesting ChromaDB...")
try:
import chromadb
client = chromadb.Client()
print("✅ ChromaDB working")
except Exception as e:
print(f"❌ ChromaDB error: {e}")
print("\n🎉 Basic test complete!")