Spaces:
Sleeping

File size: 1,722 Bytes
62be02c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""Test all 3 agents directly"""
import asyncio
import sys
if hasattr(sys.stdout, 'reconfigure'):
    sys.stdout.reconfigure(encoding='utf-8', errors='replace')
sys.path.insert(0, 'backend')

async def test_agents():
    # Test 1: Researcher - knowledge mode
    print('===== RESEARCHER (knowledge) =====')
    from agents.researcher import agent as researcher
    r = await researcher.run('What is Section 138 of NIA?', mode='knowledge')
    print('Mode:', r.get('mode_used'))
    print('Laws:', r.get('laws_retrieved'))
    resp = r.get('response', '')
    print('Response preview:', resp[:300])
    print()

    # Test 2: Researcher - pathfinder mode
    print('===== RESEARCHER (pathfinder) =====')
    r2 = await researcher.run('How to file an FIR?', mode='pathfinder')
    print('Mode:', r2.get('mode_used'))
    print('Laws:', r2.get('laws_retrieved'))
    resp2 = r2.get('response', '')
    print('Response preview:', resp2[:300])
    print()

    # Test 3: Drafter
    print('===== DRAFTER =====')
    from agents.drafter import agent as drafter
    d = await drafter.run('Draft a cheque bounce notice for bounced cheque of 5 lakhs', mode='document')
    print('Mode:', d.get('mode_used'))
    print('Doc type:', d.get('document_type'))
    resp3 = d.get('response', '')
    print('Response preview:', resp3[:300])
    print()

    # Test 4: Reviewer - scrutiny
    print('===== REVIEWER (scrutiny) =====')
    from agents.reviewer import agent as reviewer
    v = await reviewer.run('I had a motor accident 2 years ago and want to file a claim now', mode='scrutiny')
    print('Mode:', v.get('mode_used'))
    resp4 = v.get('response', '')
    print('Response preview:', resp4[:300])

asyncio.run(test_agents())