promptulate icon indicating copy to clipboard operation
promptulate copied to clipboard

Add stream output for Agent

Open Undertone0809 opened this issue 6 months ago • 1 comments

Related to #833

Add stream output support for ToolAgent.

  • ToolAgent Class:

    • Add stream parameter to the run method.
    • Implement logic to handle the stream parameter.
    • Modify the _run method to support streaming output.
    • Raise error if stream=True and output_schema is not provided.
  • BaseAgent Class:

    • Add stream parameter to the run method.
    • Implement _run_stream method to handle streaming output.
  • Example:

    • Update example/agent/tool_agent_usage.py to demonstrate the usage of agent.run(..., stream=True).
  • Tests:

    • Add tests in tests/agents/test_tool_agent.py to verify the stream mode output functionality.

For more details, open the Copilot Workspace session.

Summary by CodeRabbit

  • New Features

    • Introduced streaming capabilities for the agent, allowing real-time output during execution.
    • Enhanced the tool agent to process multiple responses dynamically.
  • Bug Fixes

    • Added validation to ensure necessary parameters for streaming operations are provided.
  • Tests

    • Added a new test to validate the tool agent's behavior in stream mode.

Undertone0809 avatar Aug 03 '24 08:08 Undertone0809