mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-11 13:44:38 +00:00
feat(responses)!: add in_progress, failed, content part events (#3765)
## Summary - add schema + runtime support for response.in_progress / response.failed / response.incomplete - stream content parts with proper indexes and reasoning slots - align tests + docs with the richer event payloads ## Testing - uv run pytest tests/unit/providers/agents/meta_reference/test_openai_responses.py::test_create_openai_response_with_string_input - uv run pytest tests/unit/providers/agents/meta_reference/test_response_conversion_utils.py
This commit is contained in:
parent
a548169b99
commit
e039b61d26
12 changed files with 1431 additions and 221 deletions
206
docs/static/deprecated-llama-stack-spec.html
vendored
206
docs/static/deprecated-llama-stack-spec.html
vendored
|
@ -10125,10 +10125,71 @@
|
|||
"type": {
|
||||
"type": "string",
|
||||
"const": "output_text",
|
||||
"default": "output_text"
|
||||
"default": "output_text",
|
||||
"description": "Content part type identifier, always \"output_text\""
|
||||
},
|
||||
"text": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"description": "Text emitted for this content part"
|
||||
},
|
||||
"annotations": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/OpenAIResponseAnnotations"
|
||||
},
|
||||
"description": "Structured annotations associated with the text"
|
||||
},
|
||||
"logprobs": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "null"
|
||||
},
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "array"
|
||||
},
|
||||
{
|
||||
"type": "object"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"description": "(Optional) Token log probability details"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"type",
|
||||
"text",
|
||||
"annotations"
|
||||
],
|
||||
"title": "OpenAIResponseContentPartOutputText",
|
||||
"description": "Text content within a streamed response part."
|
||||
},
|
||||
"OpenAIResponseContentPartReasoningText": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string",
|
||||
"const": "reasoning_text",
|
||||
"default": "reasoning_text",
|
||||
"description": "Content part type identifier, always \"reasoning_text\""
|
||||
},
|
||||
"text": {
|
||||
"type": "string",
|
||||
"description": "Reasoning text supplied by the model"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
|
@ -10136,7 +10197,8 @@
|
|||
"type",
|
||||
"text"
|
||||
],
|
||||
"title": "OpenAIResponseContentPartOutputText"
|
||||
"title": "OpenAIResponseContentPartReasoningText",
|
||||
"description": "Reasoning text emitted as part of a streamed response."
|
||||
},
|
||||
"OpenAIResponseContentPartRefusal": {
|
||||
"type": "object",
|
||||
|
@ -10144,10 +10206,12 @@
|
|||
"type": {
|
||||
"type": "string",
|
||||
"const": "refusal",
|
||||
"default": "refusal"
|
||||
"default": "refusal",
|
||||
"description": "Content part type identifier, always \"refusal\""
|
||||
},
|
||||
"refusal": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"description": "Refusal text supplied by the model"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
|
@ -10155,13 +10219,17 @@
|
|||
"type",
|
||||
"refusal"
|
||||
],
|
||||
"title": "OpenAIResponseContentPartRefusal"
|
||||
"title": "OpenAIResponseContentPartRefusal",
|
||||
"description": "Refusal content within a streamed response part."
|
||||
},
|
||||
"OpenAIResponseObjectStream": {
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/OpenAIResponseObjectStreamResponseCreated"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/OpenAIResponseObjectStreamResponseInProgress"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/OpenAIResponseObjectStreamResponseOutputItemAdded"
|
||||
},
|
||||
|
@ -10219,6 +10287,12 @@
|
|||
{
|
||||
"$ref": "#/components/schemas/OpenAIResponseObjectStreamResponseContentPartDone"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/OpenAIResponseObjectStreamResponseIncomplete"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/OpenAIResponseObjectStreamResponseFailed"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/OpenAIResponseObjectStreamResponseCompleted"
|
||||
}
|
||||
|
@ -10227,6 +10301,7 @@
|
|||
"propertyName": "type",
|
||||
"mapping": {
|
||||
"response.created": "#/components/schemas/OpenAIResponseObjectStreamResponseCreated",
|
||||
"response.in_progress": "#/components/schemas/OpenAIResponseObjectStreamResponseInProgress",
|
||||
"response.output_item.added": "#/components/schemas/OpenAIResponseObjectStreamResponseOutputItemAdded",
|
||||
"response.output_item.done": "#/components/schemas/OpenAIResponseObjectStreamResponseOutputItemDone",
|
||||
"response.output_text.delta": "#/components/schemas/OpenAIResponseObjectStreamResponseOutputTextDelta",
|
||||
|
@ -10246,6 +10321,8 @@
|
|||
"response.mcp_call.completed": "#/components/schemas/OpenAIResponseObjectStreamResponseMcpCallCompleted",
|
||||
"response.content_part.added": "#/components/schemas/OpenAIResponseObjectStreamResponseContentPartAdded",
|
||||
"response.content_part.done": "#/components/schemas/OpenAIResponseObjectStreamResponseContentPartDone",
|
||||
"response.incomplete": "#/components/schemas/OpenAIResponseObjectStreamResponseIncomplete",
|
||||
"response.failed": "#/components/schemas/OpenAIResponseObjectStreamResponseFailed",
|
||||
"response.completed": "#/components/schemas/OpenAIResponseObjectStreamResponseCompleted"
|
||||
}
|
||||
}
|
||||
|
@ -10255,7 +10332,7 @@
|
|||
"properties": {
|
||||
"response": {
|
||||
"$ref": "#/components/schemas/OpenAIResponseObject",
|
||||
"description": "The completed response object"
|
||||
"description": "Completed response object"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
|
@ -10275,6 +10352,10 @@
|
|||
"OpenAIResponseObjectStreamResponseContentPartAdded": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"content_index": {
|
||||
"type": "integer",
|
||||
"description": "Index position of the part within the content array"
|
||||
},
|
||||
"response_id": {
|
||||
"type": "string",
|
||||
"description": "Unique identifier of the response containing this content"
|
||||
|
@ -10283,6 +10364,10 @@
|
|||
"type": "string",
|
||||
"description": "Unique identifier of the output item containing this content part"
|
||||
},
|
||||
"output_index": {
|
||||
"type": "integer",
|
||||
"description": "Index position of the output item in the response"
|
||||
},
|
||||
"part": {
|
||||
"oneOf": [
|
||||
{
|
||||
|
@ -10290,13 +10375,17 @@
|
|||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/OpenAIResponseContentPartRefusal"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/OpenAIResponseContentPartReasoningText"
|
||||
}
|
||||
],
|
||||
"discriminator": {
|
||||
"propertyName": "type",
|
||||
"mapping": {
|
||||
"output_text": "#/components/schemas/OpenAIResponseContentPartOutputText",
|
||||
"refusal": "#/components/schemas/OpenAIResponseContentPartRefusal"
|
||||
"refusal": "#/components/schemas/OpenAIResponseContentPartRefusal",
|
||||
"reasoning_text": "#/components/schemas/OpenAIResponseContentPartReasoningText"
|
||||
}
|
||||
},
|
||||
"description": "The content part that was added"
|
||||
|
@ -10314,8 +10403,10 @@
|
|||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"content_index",
|
||||
"response_id",
|
||||
"item_id",
|
||||
"output_index",
|
||||
"part",
|
||||
"sequence_number",
|
||||
"type"
|
||||
|
@ -10326,6 +10417,10 @@
|
|||
"OpenAIResponseObjectStreamResponseContentPartDone": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"content_index": {
|
||||
"type": "integer",
|
||||
"description": "Index position of the part within the content array"
|
||||
},
|
||||
"response_id": {
|
||||
"type": "string",
|
||||
"description": "Unique identifier of the response containing this content"
|
||||
|
@ -10334,6 +10429,10 @@
|
|||
"type": "string",
|
||||
"description": "Unique identifier of the output item containing this content part"
|
||||
},
|
||||
"output_index": {
|
||||
"type": "integer",
|
||||
"description": "Index position of the output item in the response"
|
||||
},
|
||||
"part": {
|
||||
"oneOf": [
|
||||
{
|
||||
|
@ -10341,13 +10440,17 @@
|
|||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/OpenAIResponseContentPartRefusal"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/OpenAIResponseContentPartReasoningText"
|
||||
}
|
||||
],
|
||||
"discriminator": {
|
||||
"propertyName": "type",
|
||||
"mapping": {
|
||||
"output_text": "#/components/schemas/OpenAIResponseContentPartOutputText",
|
||||
"refusal": "#/components/schemas/OpenAIResponseContentPartRefusal"
|
||||
"refusal": "#/components/schemas/OpenAIResponseContentPartRefusal",
|
||||
"reasoning_text": "#/components/schemas/OpenAIResponseContentPartReasoningText"
|
||||
}
|
||||
},
|
||||
"description": "The completed content part"
|
||||
|
@ -10365,8 +10468,10 @@
|
|||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"content_index",
|
||||
"response_id",
|
||||
"item_id",
|
||||
"output_index",
|
||||
"part",
|
||||
"sequence_number",
|
||||
"type"
|
||||
|
@ -10379,7 +10484,7 @@
|
|||
"properties": {
|
||||
"response": {
|
||||
"$ref": "#/components/schemas/OpenAIResponseObject",
|
||||
"description": "The newly created response object"
|
||||
"description": "The response object that was created"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
|
@ -10396,6 +10501,33 @@
|
|||
"title": "OpenAIResponseObjectStreamResponseCreated",
|
||||
"description": "Streaming event indicating a new response has been created."
|
||||
},
|
||||
"OpenAIResponseObjectStreamResponseFailed": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"response": {
|
||||
"$ref": "#/components/schemas/OpenAIResponseObject",
|
||||
"description": "Response object describing the failure"
|
||||
},
|
||||
"sequence_number": {
|
||||
"type": "integer",
|
||||
"description": "Sequential number for ordering streaming events"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"const": "response.failed",
|
||||
"default": "response.failed",
|
||||
"description": "Event type identifier, always \"response.failed\""
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"response",
|
||||
"sequence_number",
|
||||
"type"
|
||||
],
|
||||
"title": "OpenAIResponseObjectStreamResponseFailed",
|
||||
"description": "Streaming event emitted when a response fails."
|
||||
},
|
||||
"OpenAIResponseObjectStreamResponseFunctionCallArgumentsDelta": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
@ -10470,6 +10602,60 @@
|
|||
"title": "OpenAIResponseObjectStreamResponseFunctionCallArgumentsDone",
|
||||
"description": "Streaming event for when function call arguments are completed."
|
||||
},
|
||||
"OpenAIResponseObjectStreamResponseInProgress": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"response": {
|
||||
"$ref": "#/components/schemas/OpenAIResponseObject",
|
||||
"description": "Current response state while in progress"
|
||||
},
|
||||
"sequence_number": {
|
||||
"type": "integer",
|
||||
"description": "Sequential number for ordering streaming events"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"const": "response.in_progress",
|
||||
"default": "response.in_progress",
|
||||
"description": "Event type identifier, always \"response.in_progress\""
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"response",
|
||||
"sequence_number",
|
||||
"type"
|
||||
],
|
||||
"title": "OpenAIResponseObjectStreamResponseInProgress",
|
||||
"description": "Streaming event indicating the response remains in progress."
|
||||
},
|
||||
"OpenAIResponseObjectStreamResponseIncomplete": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"response": {
|
||||
"$ref": "#/components/schemas/OpenAIResponseObject",
|
||||
"description": "Response object describing the incomplete state"
|
||||
},
|
||||
"sequence_number": {
|
||||
"type": "integer",
|
||||
"description": "Sequential number for ordering streaming events"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"const": "response.incomplete",
|
||||
"default": "response.incomplete",
|
||||
"description": "Event type identifier, always \"response.incomplete\""
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"response",
|
||||
"sequence_number",
|
||||
"type"
|
||||
],
|
||||
"title": "OpenAIResponseObjectStreamResponseIncomplete",
|
||||
"description": "Streaming event emitted when a response ends in an incomplete state."
|
||||
},
|
||||
"OpenAIResponseObjectStreamResponseMcpCallArgumentsDelta": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue