File size: 1,109 Bytes
ff0e97f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""
Test script for bird classifier agent with multiple scenarios
"""
import asyncio
from simple_demo import create_bird_agent

async def test_agent():
    """Test agent with multiple bird images."""

    # Create agent once
    agent = await create_bird_agent()

    test_urls = [
        "https://images.unsplash.com/photo-1555169062-013468b47731?w=400",
        "https://images.unsplash.com/photo-1445820200644-69f87d946277?w=400&auto=format&fit=crop&q=60&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxzZWFyY2h8MTV8fGJpcmR8ZW58MHx8MHx8fDA%3D"
    ]

    for i, url in enumerate(test_urls, 1):
        print("\n"+"="*70)
        print(f"[TEST {i}/{len(test_urls)}]: Testing bird classification...")
        print("="*70+"\n")
        
        result = await agent.ainvoke({
            "messages": [{
                "role": "user",
                "content": f"Classify the bird in this image: {url}"
            }]
        })
        
        print("\n[AGENT RESPONSE]:")
        print(result["messages"][-1].content)
        
    print("\n[DEMO COMPLETE!]")

if __name__ == "__main__":
    asyncio.run(test_agent())