Rename experimental tool_calls fields to camelCase - #42
Merged
Conversation
Match toolChoice and the rest of the IPA surface with toolCalls / toolCallId before the first release; keep provider wire formats snake_case. Co-authored-by: Cursor <cursoragent@cursor.com>
Implemented a new function to reject OpenAI-style snake_case aliases for tool_calls and tool_call_id, providing clear error messages for users. Updated the validation logic to incorporate this check, ensuring that these fields fail loudly instead of being silently stripped during normalization. Added corresponding tests to verify the correct rejection behavior and error messaging for these legacy fields.
Enhanced the validation logic in `rejectStableToolFields` to include a check for legacy snake_case tool fields, specifically `tool_calls` and `tool_call_id`. This update ensures that these fields are properly rejected, providing clear error messages to users. Additionally, new tests have been added to verify the rejection behavior for these legacy fields, ensuring robust validation in the stable path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tool_calls/tool_call_idtotoolCalls/toolCallIdso they matchtoolChoiceand the rest of the IPA surface.Test plan
npm test— especiallytest/validate.test.jsand provider tool round-trip testsexperimental.requestsnippet in DevTools and confirmdone.message.toolCalls/toolCallIdworktool_calls/tool_call_idonwindow.inference.requestandexperimental.requestfail withinvalid_requestand a rename hintMade with Cursor