Skip to content

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Feature/tool calling #4

wants to merge 7 commits into from

Conversation

mcherukara
Copy link
Member

No description provided.

- 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
@mcherukara mcherukara requested review from Copilot and Linked-Liszt and removed request for Copilot August 9, 2025 03:17
@mcherukara mcherukara assigned mcherukara and unassigned mcherukara Aug 9, 2025
Copy link

@Copilot Copilot AI left a 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'
Copy link
Preview

Copilot AI Aug 9, 2025

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.

Suggested change
'toolu_vrtx_01LiZkD1myhnDz7gcoEe4Y5A'
'toolu_b9krJaIcuBM4lej3IyI5heVcY5A'

Copilot uses AI. Check for mistakes.

Comment on lines +215 to +217
# Remove parallel_tool_calls from data for now
# TODO: Implement parallel tool calls handling later
parallel_tool_calls = data.pop("parallel_tool_calls", False)
Copy link
Preview

Copilot AI Aug 9, 2025

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.

Suggested change
# 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.

mcherukara and others added 5 commits August 8, 2025 22:21
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant