-
Notifications
You must be signed in to change notification settings - Fork 162
More function calling examples #12
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
Conversation
@pamelafox pushed updates to function calling Spanish scripts. the function_calling_fewshots.py is 400’ing (“messages[2].role” missing), missing the role parameter, was that the intent? works when I add it. |
@madebygps Your edits are correct, I've made them to en as well. |
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 adds new function calling example scripts in both English and Spanish to demonstrate progressively advanced patterns including error handling, few-shot learning, and iterative conversational loops. It also updates README documentation to reflect these new examples and corrects minor inconsistencies in existing examples.
Key Changes:
- Added three new function calling examples with Spanish translations demonstrating error handling, while-loop iteration, and few-shot patterns
- Updated documentation in README.md, spanish/README.md, and AGENTS.md to reference the new examples
- Fixed minor inconsistencies in existing function_calling_call.py and function_calling_basic.py
Reviewed Changes
Copilot reviewed 12 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
spanish/function_calling_while_loop.py | New Spanish example demonstrating iterative conversation loop with sequential tool calls |
spanish/function_calling_fewshots.py | New Spanish example showing function calling with few-shot learning pattern |
spanish/function_calling_errors.py | New Spanish example with robust error handling for function calling |
spanish/function_calling_call.py | Minor text corrections in Spanish comments and user prompt |
spanish/function_calling_basic.py | Minor text correction in Spanish function description |
spanish/README.md | Updated documentation with new function calling examples and corrected file path references |
function_calling_while_loop.py | New English example demonstrating iterative conversation loop with sequential tool calls |
function_calling_fewshots.py | New English example showing function calling with few-shot learning pattern |
function_calling_errors.py | New English example with robust error handling for function calling |
function_calling_call.py | Added else clause to handle non-tool-call responses and updated user prompt |
function_calling_basic.py | Added logging configuration for debugging |
README.md | Updated documentation to include new function calling examples |
AGENTS.md | Updated documentation to include new function calling examples |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
I am removing the error handling from the while loop example in both en/es since that comes earlier in the presentation, and the error handling makes it harder to follow. |
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
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
"type": "function", | ||
"function": { | ||
"name": "search_database", | ||
"arguments": '{"search_query":"tenis","price_filter":{"comparison_operator":"<","value":50}}', |
Copilot
AI
Oct 20, 2025
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.
In Spanish, 'tenis' typically means tennis, but in the context of searching for shoes (as indicated by the English version), the correct word should be 'zapatos' or 'zapatillas' (tennis shoes/sneakers). The English version uses 'shoes' which is the appropriate term.
Copilot uses AI. Check for mistakes.
@madebygps I added function execution to the parallel example, so that it's a clearer contrast to the loop example. I used ThreadPoolExecutor but asyncio.taskgroup would also be a good fit in prod, since most tool funcs would be async. |
Purpose
For the Monday session
Does this introduce a breaking change?
Pull Request Type
What kind of change does this Pull Request introduce?
How to Test