File size: 999 Bytes
db6dcad
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env python3
"""
Simple test to verify Ollama integration
"""
import ollama

def test_ollama():
    print("πŸ” Testing Ollama integration...")
    
    try:
        # Test connection
        models = ollama.list()
        print(f"βœ… Ollama is accessible! Found {len(models['models'])} models:")
        for model in models['models']:
            model_name = model.get('name', model.get('model', 'Unknown'))
            print(f"  πŸ“¦ {model_name}")
        
        # Test generation
        print("\nπŸ€– Testing AI generation...")
        response = ollama.generate(
            model='llama2',
            prompt='Hello! Can you analyze data? Please respond briefly.'
        )
        
        print("βœ… AI Response:")
        print("-" * 40)
        print(response['response'])
        print("-" * 40)
        
        return True
        
    except Exception as e:
        print(f"❌ Ollama test failed: {e}")
        return False

if __name__ == "__main__":
    test_ollama()