initial commit
This commit is contained in:
commit
aaba8753ef
36 changed files with 3682 additions and 0 deletions
80
src/examples/test_agent_id.py
Normal file
80
src/examples/test_agent_id.py
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
#!/usr/bin/env python3
|
||||
"""
|
||||
Test script to verify TALESTORM_AGENT_ID usage
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
from src.services.session_service import session_service
|
||||
from src.config import settings
|
||||
|
||||
async def test_agent_id_usage():
|
||||
"""Test that the configured agent ID is being used"""
|
||||
print("Testing TALESTORM_AGENT_ID Usage...")
|
||||
print("=" * 50)
|
||||
|
||||
print(f"Configured Agent ID: {settings.TALESTORM_AGENT_ID}")
|
||||
print(f"Session Service Agent ID: {session_service.agent_id}")
|
||||
|
||||
# Test session creation
|
||||
print("\nCreating session with configured agent...")
|
||||
session_id = await session_service.create_session()
|
||||
|
||||
if session_id:
|
||||
print(f"✅ Session created: {session_id}")
|
||||
|
||||
# Get session details to verify agent
|
||||
session_details = await session_service.get_session(session_id)
|
||||
if session_details:
|
||||
print(f"Session Agent ID: {session_details.get('agent_id')}")
|
||||
print(f"Session Organization ID: {session_details.get('organization_id')}")
|
||||
else:
|
||||
print("⚠️ Could not retrieve session details")
|
||||
else:
|
||||
print("❌ Failed to create session")
|
||||
|
||||
# Test listing agents
|
||||
print("\nListing available agents...")
|
||||
agents = await session_service.list_agents()
|
||||
if agents:
|
||||
print(f"✅ Found {len(agents)} agents:")
|
||||
for i, agent in enumerate(agents, 1):
|
||||
print(f" {i}. {agent.get('name', 'Unknown')} (ID: {agent.get('id')})")
|
||||
|
||||
# Highlight the configured agent
|
||||
if str(agent.get('id')) == settings.TALESTORM_AGENT_ID:
|
||||
print(f" ⭐ This is the configured agent!")
|
||||
else:
|
||||
print("❌ No agents found")
|
||||
|
||||
print("\n✅ Agent ID test completed!")
|
||||
|
||||
async def test_agent_validation():
|
||||
"""Test that the configured agent exists and is accessible"""
|
||||
print("\nTesting Agent Validation...")
|
||||
print("=" * 50)
|
||||
|
||||
if not settings.TALESTORM_AGENT_ID:
|
||||
print("❌ TALESTORM_AGENT_ID not configured")
|
||||
return
|
||||
|
||||
# Try to get the configured agent
|
||||
agent = await session_service.get_default_agent()
|
||||
if agent:
|
||||
print(f"✅ Configured agent found:")
|
||||
print(f" Name: {agent.get('name', 'Unknown')}")
|
||||
print(f" ID: {agent.get('id')}")
|
||||
print(f" Model: {agent.get('model_name', 'Unknown')}")
|
||||
print(f" Provider: {agent.get('model_provider', 'Unknown')}")
|
||||
print(f" RAG Enabled: {agent.get('enable_rag_search', False)}")
|
||||
else:
|
||||
print("❌ Configured agent not found or not accessible")
|
||||
|
||||
print("\n✅ Agent validation completed!")
|
||||
|
||||
async def main():
|
||||
"""Run all tests"""
|
||||
await test_agent_id_usage()
|
||||
await test_agent_validation()
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
Loading…
Add table
Add a link
Reference in a new issue