Skip to content

Conversation

pamelafox
Copy link
Contributor

Purpose

For the Monday session

Does this introduce a breaking change?

[ ] Yes
[X] No

Pull Request Type

What kind of change does this Pull Request introduce?

[ ] Bugfix
[X] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:

How to Test

  • Run them

@madebygps
Copy link
Collaborator

@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.

@pamelafox
Copy link
Contributor Author

@madebygps Your edits are correct, I've made them to en as well.

@pamelafox pamelafox requested a review from Copilot October 20, 2025 21:30
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 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.

@pamelafox
Copy link
Contributor Author

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.

@pamelafox pamelafox requested a review from Copilot October 20, 2025 22:01
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

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}}',
Copy link

Copilot AI Oct 20, 2025

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.

@pamelafox
Copy link
Contributor Author

@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.

@pamelafox pamelafox merged commit f45ef52 into main Oct 20, 2025
2 checks passed
@pamelafox pamelafox deleted the funccalling branch October 20, 2025 22:09
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.

2 participants