fix(streaming): expose "toolCallResultId" in the streamed data#908
Open
joao-salomao wants to merge 2 commits intoprism-php:mainfrom
Open
fix(streaming): expose "toolCallResultId" in the streamed data#908joao-salomao wants to merge 2 commits intoprism-php:mainfrom
joao-salomao wants to merge 2 commits intoprism-php:mainfrom
Conversation
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.
Description
Add
tool_call_result_id(thecall_idfrom the model's function call) to theToolResultEvent::toArray()payload so clients can use it when replaying tool-call history.The OpenAI Responses API ties
function_call_outputto a model tool call viacall_id. When replaying conversations, eachfunction_call_outputmust use the samecall_idthe model returned. Prism’sToolResultalready stores this astoolCallResultId, butToolResultEvent::toArray()does not expose it.Without it, clients that need to replay history (e.g. chat UIs that send prior turns back to the API) cannot reliably link tool results to tool calls. They end up with custom SSE/stream adapters that add
tool_call_result_idfrom$event->toolResult->toolCallResultId:The frontend receives tool results via
ToolResultEvent, so it needstool_call_result_idintoArray()to store it and send it back asresultIdwhen replaying history.Breaking Changes
None