Spaces:
No application file
No application file
File size: 2,978 Bytes
bce4c09 |
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 87 88 89 90 91 92 93 |
#!/usr/bin/env python3
"""
Test script for the integrated memory and evaluation system
"""
import asyncio
from agents.brown import AgentBrown, StoryboardRequest
from agents.bayko import AgentBayko
async def test_integration():
"""Test the integrated memory and evaluation system"""
print("π Testing Bayko & Brown Integration")
print("=" * 50)
# Create agents
brown = AgentBrown(max_iterations=3)
bayko = AgentBayko()
# Create test request
request = StoryboardRequest(
prompt="A cat discovers a magical portal in the garden",
style_preference="studio_ghibli",
panels=3,
language="english",
extras=["narration", "subtitles"],
)
print(f"π User prompt: {request.prompt}")
print(f"π¨ Style: {request.style_preference}")
print(f"π Panels: {request.panels}")
print()
# Step 1: Brown processes the request
print("π€ Brown processing request...")
brown_message = brown.process_request(request)
if brown_message.message_type == "validation_error":
print(f"β Validation failed: {brown_message.payload}")
return
print(f"β
Brown created request for Bayko")
print(f"π§ Brown memory size: {brown.get_session_info()['memory_size']}")
print()
# Step 2: Bayko generates content
print("π¨ Bayko generating content...")
bayko_result = await bayko.process_generation_request(
brown_message.to_dict()
)
print(f"β
Bayko generated {len(bayko_result.panels)} panels")
print(f"β±οΈ Total time: {bayko_result.total_time:.2f}s")
print()
# Step 3: Brown evaluates the result
print("π Brown evaluating Bayko's output...")
review_result = brown.review_output(bayko_result.to_dict(), request)
if review_result:
print(f"π Review result: {review_result.message_type}")
if review_result.message_type == "final_approval":
print("π Content approved!")
elif review_result.message_type == "refinement_request":
print("π Refinement requested")
else:
print("β Content rejected")
print()
print("π Final Session Info:")
session_info = brown.get_session_info()
for key, value in session_info.items():
print(f" {key}: {value}")
print()
print("π§ Memory Integration Test:")
if brown.memory:
history = brown.memory.get_history()
print(f" Brown memory entries: {len(history)}")
for i, entry in enumerate(history[-3:], 1): # Show last 3 entries
print(f" {i}. {entry.role}: {entry.content[:50]}...")
if bayko.memory:
history = bayko.memory.get_history()
print(f" Bayko memory entries: {len(history)}")
for i, entry in enumerate(history[-3:], 1): # Show last 3 entries
print(f" {i}. {entry.role}: {entry.content[:50]}...")
if __name__ == "__main__":
asyncio.run(test_integration())
|