forked from ansari-project/ansari-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_ansari_claude.py
More file actions
32 lines (26 loc) · 1.03 KB
/
test_ansari_claude.py
File metadata and controls
32 lines (26 loc) · 1.03 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
#\!/usr/bin/env python
import sys
from ansari.agents.ansari_claude import AnsariClaude
from ansari.config import get_settings
def test_message_structure():
"""Test that message history conversion works properly."""
settings = get_settings()
agent = AnsariClaude(settings)
# Setup test message history with mixed formats
message_history = [
{"role": "user", "content": "Hello, this is a test"},
{"role": "assistant", "content": "This is a plain text response"}, # Plain string content
{"role": "user", "content": "What is the definition of Tashahhud?"}
]
# Process through replace_message_history
try:
generator = agent.replace_message_history(message_history)
# Just run through the generator to process it
for _ in generator:
pass
print("Test passed - no errors in message processing")
except Exception as e:
print(f"Test failed with error: {e}")
sys.exit(1)
if __name__ == "__main__":
test_message_structure()