-
Notifications
You must be signed in to change notification settings - Fork 341
Closed
Labels
area: responsesThis item is related to ResponsesThis item is related to Responsesissue-addressedWorkflow: The OpenAI maintainers believe the issue to be addressed and ready to close.Workflow: The OpenAI maintainers believe the issue to be addressed and ready to close.questionCategory: The issue is seeking information about the library or its usage.Category: The issue is seeking information about the library or its usage.
Description
I am using Response and Stream, and I want to get data like:
event: response.output_text.delta data: {"type":"response.output_text.delta","item_id":"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654","output_index":0,"content_index":0,"delta":"Hi"}
or
{"type":"response.output_text.delta","item_id":"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654","output_index":0,"content_index":0,"delta":"Hi"}
primitive data structure, save in my database for logging purposes.
I know I can output each property individually to assemble them, but I still prefer ToJson() or System.Text.Json.JsonSerializer.Serialize(update) .
await foreach (var update in client.CreateResponseStreamingAsync(question, options))
{
switch (update)
{
case StreamingResponseCompletedUpdate chatCompletion:
// System.Text.Json.JsonSerializer.Serialize(chatCompletion)
foreach (var responseItme in chatCompletion.Response.OutputItems)
{
switch (responseItme)
{
case FunctionCallResponseItem functionCall:
// System.Text.Json.JsonSerializer.Serialize(functionCall)
break;
}
}
break;
}
}
Metadata
Metadata
Assignees
Labels
area: responsesThis item is related to ResponsesThis item is related to Responsesissue-addressedWorkflow: The OpenAI maintainers believe the issue to be addressed and ready to close.Workflow: The OpenAI maintainers believe the issue to be addressed and ready to close.questionCategory: The issue is seeking information about the library or its usage.Category: The issue is seeking information about the library or its usage.