Skip to content

Decode weather tool arguments before function feedback - #818

Open
dajiaohuang wants to merge 1 commit into
dair-ai:mainfrom
dajiaohuang:fix/function-feedback-arguments-20261015
Open

dajiaohuang wants to merge 1 commit into
dair-ai:mainfrom
dajiaohuang:fix/function-feedback-arguments-20261015

Conversation

@dajiaohuang

Copy link
Copy Markdown

Problem

In pe-function-calling.ipynb, the final tool-feedback example passes function.arguments directly into get_current_weather(location, unit="fahrenheit").

Those arguments are JSON text, not a location string. For a supported tool call with {"location":"Boston","unit":"celsius"}, the tool result instead contains the entire JSON string as location and silently uses fahrenheit. The notebook's saved messages output already shows the nested-JSON location for its Boston example.

Change

Decode the arguments and unpack them as keyword arguments, matching the earlier args = json.loads(...) / get_current_weather(**args) example in this same notebook and the OpenAI cookbook argument-handling contract. Clear the affected downstream outputs/execution counts rather than present stale results as a new model run. No model/API version changes.

Validation

Offline fixture executes the notebook's actual dummy weather function and tool-feedback cell, with synthetic assistant/tool-call messages:

  • Base fails: location is JSON text and the requested Celsius unit is lost.
  • Fixed passes: location is Boston, unit is Celsius and the tool-call ID is preserved.
  • A location-only call retains the existing Fahrenheit default.
  • All code cells compile; a provider fixture verifies the completion wrapper forwards tools/tool_choice and preserves its existing model default.
  • git diff --check passes.

No LLM/API calls, environment-key reads or real weather requests were performed. Full live notebook execution is not claimed.

@vercel

vercel Bot commented Oct 15, 2026

Copy link
Copy Markdown

@dajiaohuang is attempting to deploy a commit to the DAIR-AI Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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