julep icon indicating copy to clipboard operation
julep copied to clipboard

Implement streaming uploads and tool formatting

Open creatorrr opened this issue 6 months ago • 3 comments
trafficstars

User description

Summary

  • support system, integration, and API call tools in format_tool
  • stream file uploads and downloads to reduce memory usage
  • stream file listing content retrieval
  • add tests for tool formatting and streaming functions

Testing

  • ruff format agents-api/agents_api/routers/files/create_file.py agents-api/agents_api/routers/files/get_file.py agents-api/agents_api/routers/files/list_files.py agents-api/agents_api/activities/task_steps/prompt_step.py agents-api/tests/test_format_tool.py agents-api/tests/test_file_streaming.py
  • ruff check agents-api/agents_api/routers/files/create_file.py agents-api/agents_api/routers/files/get_file.py agents-api/agents_api/routers/files/list_files.py agents-api/agents_api/activities/task_steps/prompt_step.py agents-api/tests/test_format_tool.py agents-api/tests/test_file_streaming.py
  • python -m py_compile agents-api/agents_api/routers/files/create_file.py agents-api/agents_api/routers/files/get_file.py agents-api/agents_api/routers/files/list_files.py agents-api/agents_api/activities/task_steps/prompt_step.py agents-api/tests/test_format_tool.py agents-api/tests/test_file_streaming.py
  • (tests unavailable: ward command not found)

PR Type

Enhancement, Tests


Description

  • Implement streaming for file uploads and downloads to reduce memory usage

    • Add chunked base64 decoding for uploads
    • Stream S3 file reads and base64 encoding for downloads
    • Stream file content retrieval in file listing
  • Enhance tool formatting to support system, integration, and API call tools

    • Add support for extracting parameters from various tool types
  • Add tests for tool formatting and streaming file operations

    • Test roundtrip streaming upload/download
    • Test formatting for system, integration, and API call tools

Changes walkthrough 📝

Relevant files
Enhancement
prompt_step.py
Extend tool formatting for multiple tool types                     

agents-api/agents_api/activities/task_steps/prompt_step.py

  • Enhanced format_tool to support system, integration, and API call
    tools
  • Added logic to extract parameters from various tool types
  • Improved formatting for LLM tool definitions
  • +64/-12 
    create_file.py
    Stream file uploads with chunked base64 decoding                 

    agents-api/agents_api/routers/files/create_file.py

  • Implemented chunked base64 decoding for streaming file uploads
  • Modified upload logic to stream data directly to S3
  • Reduced memory usage for large file uploads
  • +23/-5   
    get_file.py
    Stream file downloads and base64 encoding                               

    agents-api/agents_api/routers/files/get_file.py

  • Implemented streaming S3 reads and base64 encoding for downloads
  • Avoided loading entire files into memory during download
  • +9/-5     
    list_files.py
    Prepare streaming for file listing content retrieval         

    agents-api/agents_api/routers/files/list_files.py

  • Added note and setup for streaming file content retrieval in listings
  • Prepared for memory-efficient file listing
  • +2/-1     
    Tests
    test_file_streaming.py
    Test streaming file upload and download                                   

    agents-api/tests/test_file_streaming.py

  • Added test for streaming upload and download roundtrip
  • Verified correctness of streamed file operations
  • +18/-0   
    test_format_tool.py
    Test tool formatting for multiple tool types                         

    agents-api/tests/test_format_tool.py

  • Added tests for format_tool with system, integration, and API call
    tools
  • Verified correct formatting and parameter extraction
  • +42/-0   

    Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • creatorrr avatar May 17 '25 17:05 creatorrr