-
Notifications
You must be signed in to change notification settings - Fork 2
Feature/tool calling #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Add complete tool calling module with universal middleware pattern - Support for OpenAI, Anthropic, and Google function calling APIs - Implement native and prompt-based tool calling with automatic fallback - Add Pydantic models for type-safe API format conversion - Integrate tool calling into Flask server routes - Add comprehensive test suite with multiple scenarios - Include documentation and examples - Rename types/ to tool_types/ to avoid import conflicts Key components: - tool_calls/handler.py: Main tool calling logic - tool_calls/input_handle.py: Request processing - tool_calls/output_handle.py: Response formatting - tool_calls/utils.py: Helper functions and model detection - tool_calls/tool_prompts.py: Prompt templates - tool_types/function_call.py: Pydantic type definitions - examples/tool_calling_example.py: Comprehensive test suite - TOOL_CALLING.md: Implementation documentation
- Add centralized logging configuration (logging_config.py) - Replace print statements with proper logging in tool_calls modules - Update argo_bridge.py to use structured summary logging - Add environment variable control for verbose mode (ARGO_VERBOSE) - Create comprehensive logging documentation (LOGGING.md) - Default behavior: console shows WARNING+ only, file shows INFO+ - Verbose mode available via ARGO_VERBOSE=true for debugging
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a comprehensive tool calling feature for the Argo Bridge project, adding support for OpenAI-compatible function calling across multiple LLM providers with both native and prompt-based fallback approaches.
Key changes include:
- Complete tool calling infrastructure with universal middleware classes for format conversion
- Input/output processing modules for request transformation and response extraction
- Centralized logging system with configurable verbosity levels
Reviewed Changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated 5 comments.
Show a summary per file
File | Description |
---|---|
tool_types/function_call.py | Pydantic type definitions for OpenAI, Anthropic, and Google function calling APIs |
tool_types/init.py | Type exports for function calling models |
tool_calls/utils.py | Utility functions for model detection, ID generation, and validation |
tool_calls/tool_prompts.py | Model-specific prompt templates for fallback scenarios |
tool_calls/output_handle.py | Response processing and tool call extraction logic |
tool_calls/input_handle.py | Request processing and tool format conversion |
tool_calls/handler.py | Universal middleware classes for tool call conversion between API formats |
tool_calls/init.py | Module exports for tool calling functionality |
memory-bank/techContext.md | Technical documentation for technology stack and architecture |
memory-bank/systemPatterns.md | System architecture patterns and design decisions |
memory-bank/projectbrief.md | Project overview and purpose documentation |
memory-bank/progress.md | Implementation progress tracking |
memory-bank/productContext.md | Product context and problem statement |
memory-bank/activeContext.md | Current project state and development priorities |
logging_config.py | Centralized logging configuration with environment variable support |
examples/tool_calling_example.py | Comprehensive test suite demonstrating tool calling functionality |
argo_bridge.py | Main Flask application integrated with tool calling functionality |
TOOL_CALLING.md | Detailed implementation documentation |
LOGGING.md | Logging configuration documentation |
'fc_68600a8868248199a436492a47a75e440766032408f75a09' | ||
|
||
>>> generate_id(mode='anthropic') | ||
'toolu_vrtx_01LiZkD1myhnDz7gcoEe4Y5A' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docstring example shows 'toolu_vrtx_01LiZkD1myhnDz7gcoEe4Y5A' but the implementation generates 'toolu_{24-char base62}' without the 'vrtx_01' prefix. Update the example to match the actual implementation.
'toolu_vrtx_01LiZkD1myhnDz7gcoEe4Y5A' | |
'toolu_b9krJaIcuBM4lej3IyI5heVcY5A' |
Copilot uses AI. Check for mistakes.
# Remove parallel_tool_calls from data for now | ||
# TODO: Implement parallel tool calls handling later | ||
parallel_tool_calls = data.pop("parallel_tool_calls", False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parallel_tool_calls parameter is removed with a TODO comment, but it's still documented and used in other parts of the codebase. Consider either implementing this feature or updating documentation to reflect its current unsupported status.
# Remove parallel_tool_calls from data for now | |
# TODO: Implement parallel tool calls handling later | |
parallel_tool_calls = data.pop("parallel_tool_calls", False) | |
# parallel_tool_calls parameter is not currently supported | |
# TODO: Implement parallel tool calls handling if/when supported |
Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
- Convert Pydantic models to dictionaries using .model_dump() before JSON serialization - Fixes TypeError when tool calls are returned from Anthropic models - Ensures compatibility with Flask's jsonify function
…tonSource/argo_bridge into feature/tool-calling Did not pull before editing
No description provided.