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/llama-stack-spec.html
vendored
206
docs/static/llama-stack-spec.html
vendored
|
@ -8220,10 +8220,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,
|
||||
|
@ -8231,7 +8292,8 @@
|
|||
"type",
|
||||
"text"
|
||||
],
|
||||
"title": "OpenAIResponseContentPartOutputText"
|
||||
"title": "OpenAIResponseContentPartReasoningText",
|
||||
"description": "Reasoning text emitted as part of a streamed response."
|
||||
},
|
||||
"OpenAIResponseContentPartRefusal": {
|
||||
"type": "object",
|
||||
|
@ -8239,10 +8301,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,
|
||||
|
@ -8250,13 +8314,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"
|
||||
},
|
||||
|
@ -8314,6 +8382,12 @@
|
|||
{
|
||||
"$ref": "#/components/schemas/OpenAIResponseObjectStreamResponseContentPartDone"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/OpenAIResponseObjectStreamResponseIncomplete"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/OpenAIResponseObjectStreamResponseFailed"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/OpenAIResponseObjectStreamResponseCompleted"
|
||||
}
|
||||
|
@ -8322,6 +8396,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",
|
||||
|
@ -8341,6 +8416,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"
|
||||
}
|
||||
}
|
||||
|
@ -8350,7 +8427,7 @@
|
|||
"properties": {
|
||||
"response": {
|
||||
"$ref": "#/components/schemas/OpenAIResponseObject",
|
||||
"description": "The completed response object"
|
||||
"description": "Completed response object"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
|
@ -8370,6 +8447,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"
|
||||
|
@ -8378,6 +8459,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": [
|
||||
{
|
||||
|
@ -8385,13 +8470,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"
|
||||
|
@ -8409,8 +8498,10 @@
|
|||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"content_index",
|
||||
"response_id",
|
||||
"item_id",
|
||||
"output_index",
|
||||
"part",
|
||||
"sequence_number",
|
||||
"type"
|
||||
|
@ -8421,6 +8512,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"
|
||||
|
@ -8429,6 +8524,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": [
|
||||
{
|
||||
|
@ -8436,13 +8535,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"
|
||||
|
@ -8460,8 +8563,10 @@
|
|||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"content_index",
|
||||
"response_id",
|
||||
"item_id",
|
||||
"output_index",
|
||||
"part",
|
||||
"sequence_number",
|
||||
"type"
|
||||
|
@ -8474,7 +8579,7 @@
|
|||
"properties": {
|
||||
"response": {
|
||||
"$ref": "#/components/schemas/OpenAIResponseObject",
|
||||
"description": "The newly created response object"
|
||||
"description": "The response object that was created"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
|
@ -8491,6 +8596,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": {
|
||||
|
@ -8565,6 +8697,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