File size: 879 Bytes
2a2c2ad
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import argparse
import sys
from dotenv import load_dotenv
from stream_utils import StreamResponseHandler

# Load environment variables
load_dotenv()

def main():
    # Create a console for rich output
    handler = StreamResponseHandler()
    
    # Parse command line arguments
    parser = argparse.ArgumentParser(description="Test the generic agent streaming API.")
    parser.add_argument("--query", "-q", required=True, help="The query or message to send to the generic agent.")
    
    args = parser.parse_args()
    
    # Check if the server is running
    if not handler.check_server_health():
        sys.exit(1)
    
    # Stream the generic request
    endpoint_url = "http://localhost:8000/test/stream"
    params = {"query": args.query}
    handler.stream_response(endpoint_url, params=params, title="Generic Agent Response")

if __name__ == "__main__":
    main()