Can someone please help me understand how to use structured output when submitting data with the submit_tool_outputs_stream
function? I’m trying to send structured JSON output from my tool, but I need clarification on how to properly format and pass the data to this function.
Hello @ashrafali5177,
You Add "strict": True
and "additionalProperties": False
in your function’s schema definition.
You can follow through the assistant doc:
https://platform.openai.com/docs/assistants/tools/function-calling
The response you send back is just a string-as-message. You can send the AI a JSON, a document, a list – basically anything that can be understood.
For more “how to use”…
For node.js, actual usage, passing the tool return parameters, is digging into code:
/**
* Submit the tool outputs from a previous run and stream the run to a terminal
* state. More information on Run lifecycles can be found here:
* https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps
*/
submitToolOutputsStream(
threadId: string,
runId: string,
body: RunSubmitToolOutputsParamsStream,
options?: Core.RequestOptions,
): AssistantStream {
return AssistantStream.createToolAssistantStream(
threadId,
runId,
this._client.beta.threads.runs,
body,
options,
);
}
}
Where body is just the depicted parameters list for the API endpoint.
@_j @Innovatix i am getting tool output correctly but when pass to submit_tool_outputs_stream sometime changes the output
for example i am getting a link which is in tool output “/chat/chat_id”
but after submit_tool_outputs_stream it change it to “chat/chat_id” (missing / ) can i handle it with structure ouptut as response format is not support with submit_tool_outputs_stream any suggestion what should i do ?also i am submitting output as string .