-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_airis.py
More file actions
86 lines (68 loc) · 3.21 KB
/
test_airis.py
File metadata and controls
86 lines (68 loc) · 3.21 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
from src.agents.fashion_advisor import AIris
from dotenv import load_dotenv
import pytest
def test_fashion_advisor():
# Initialize AIris with online mode (requires GROQ_API_KEY)
advisor = AIris(offline_mode=False)
print("\nTesting outfit advice:")
advice = advisor.get_outfit_advice("What should I wear to a summer wedding?")
print(advice)
print("\nTesting style inspiration:")
inspiration = advisor.get_inspiration("bohemian")
print(inspiration)
def test_airis_memory_and_preferences():
"""Test AIris's ability to remember and use context."""
airis = AIris(offline_mode=True)
# First interaction
response1 = airis.get_outfit_advice("I love bohemian style and earth tones")
assert "Agent is running in offline mode" in response1
# Check if preferences were stored
memory = airis.get_memory()
assert memory["preferences"] # Should have stored style preferences
# Second interaction should have context from first
response2 = airis.get_outfit_advice("What should I wear to a summer wedding?")
assert "Agent is running in offline mode" in response2
# Verify conversation history
memory = airis.get_memory()
assert len(memory["history"]) == 2 # Should have both interactions
def test_fashion_knowledge_tool():
"""Test the fashion knowledge tool's ability to provide relevant information."""
airis = AIris()
knowledge = airis.fashion_knowledge("What should I wear to a beach wedding?")
assert "beach" in knowledge.lower()
assert "wedding" in knowledge.lower()
def test_style_analyzer_tool():
"""Test the style analyzer's ability to extract preferences."""
airis = AIris()
analysis = airis.style_analyzer("I want a bohemian summer dress for a beach party")
assert "bohemian" in analysis.lower()
assert "summer" in analysis.lower()
assert "beach" in analysis.lower()
def test_contextual_advice():
"""Test AIris's ability to provide contextual advice."""
airis = AIris(offline_mode=True)
# First establish some preferences
airis.get_outfit_advice("I prefer minimalist style with neutral colors")
# Second request should incorporate previous preferences
response = airis.get_outfit_advice("What should I wear to a business meeting?")
assert "Agent is running in offline mode" in response
# Check if memory was maintained
memory = airis.get_memory()
assert "minimalist" in str(memory["preferences"]).lower()
def test_multi_step_planning():
"""Test AIris's ability to plan and execute multi-step responses."""
airis = AIris(offline_mode=True)
# Complex request requiring multiple steps
response = airis.get_outfit_advice(
"I need help building a capsule wardrobe for fall. "
"I work in a business casual office and like to go hiking on weekends."
)
assert "Agent is running in offline mode" in response
# Verify that multiple aspects were considered
memory = airis.get_memory()
prefs = str(memory["preferences"]).lower()
assert any(term in prefs for term in ["business casual", "hiking", "fall"])
if __name__ == "__main__":
# Load environment variables
load_dotenv()
test_fashion_advisor()