From 95db0653e1fb6711ca21eb77553a411a48bf3bd1 Mon Sep 17 00:00:00 2001 From: Ashwin Bharambe Date: Thu, 31 Oct 2024 14:29:53 -0700 Subject: [PATCH] Add docstring which fixes openapi generator :/ --- docs/resources/llama-stack-spec.html | 341 +++++++++++++++++++++++---- docs/resources/llama-stack-spec.yaml | 202 ++++++++++++++-- llama_stack/apis/agents/agents.py | 2 + 3 files changed, 483 insertions(+), 62 deletions(-) diff --git a/docs/resources/llama-stack-spec.html b/docs/resources/llama-stack-spec.html index de52131b5..363d968f9 100644 --- a/docs/resources/llama-stack-spec.html +++ b/docs/resources/llama-stack-spec.html @@ -21,7 +21,7 @@ "info": { "title": "[DRAFT] Llama Stack Specification", "version": "0.0.1", - "description": "This is the specification of the llama stack that provides\n a set of endpoints and their corresponding interfaces that are tailored to\n best leverage Llama Models. The specification is still in draft and subject to change.\n Generated at 2024-10-31 10:35:38.305313" + "description": "This is the specification of the llama stack that provides\n a set of endpoints and their corresponding interfaces that are tailored to\n best leverage Llama Models. The specification is still in draft and subject to change.\n Generated at 2024-10-31 14:28:52.128905" }, "servers": [ { @@ -320,11 +320,18 @@ "post": { "responses": { "200": { - "description": "A single turn in an interaction with an Agentic System.", + "description": "A single turn in an interaction with an Agentic System. **OR** streamed agent turn completion response.", "content": { "text/event-stream": { "schema": { - "$ref": "#/components/schemas/Turn" + "oneOf": [ + { + "$ref": "#/components/schemas/Turn" + }, + { + "$ref": "#/components/schemas/AgentTurnResponseStreamChunk" + } + ] } } } @@ -3832,6 +3839,215 @@ "messages" ] }, + "AgentTurnResponseEvent": { + "type": "object", + "properties": { + "payload": { + "oneOf": [ + { + "$ref": "#/components/schemas/AgentTurnResponseStepStartPayload" + }, + { + "$ref": "#/components/schemas/AgentTurnResponseStepProgressPayload" + }, + { + "$ref": "#/components/schemas/AgentTurnResponseStepCompletePayload" + }, + { + "$ref": "#/components/schemas/AgentTurnResponseTurnStartPayload" + }, + { + "$ref": "#/components/schemas/AgentTurnResponseTurnCompletePayload" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "payload" + ], + "title": "Streamed agent execution response." + }, + "AgentTurnResponseStepCompletePayload": { + "type": "object", + "properties": { + "event_type": { + "type": "string", + "const": "step_complete", + "default": "step_complete" + }, + "step_type": { + "type": "string", + "enum": [ + "inference", + "tool_execution", + "shield_call", + "memory_retrieval" + ] + }, + "step_details": { + "oneOf": [ + { + "$ref": "#/components/schemas/InferenceStep" + }, + { + "$ref": "#/components/schemas/ToolExecutionStep" + }, + { + "$ref": "#/components/schemas/ShieldCallStep" + }, + { + "$ref": "#/components/schemas/MemoryRetrievalStep" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "event_type", + "step_type", + "step_details" + ] + }, + "AgentTurnResponseStepProgressPayload": { + "type": "object", + "properties": { + "event_type": { + "type": "string", + "const": "step_progress", + "default": "step_progress" + }, + "step_type": { + "type": "string", + "enum": [ + "inference", + "tool_execution", + "shield_call", + "memory_retrieval" + ] + }, + "step_id": { + "type": "string" + }, + "model_response_text_delta": { + "type": "string" + }, + "tool_call_delta": { + "$ref": "#/components/schemas/ToolCallDelta" + }, + "tool_response_text_delta": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "event_type", + "step_type", + "step_id" + ] + }, + "AgentTurnResponseStepStartPayload": { + "type": "object", + "properties": { + "event_type": { + "type": "string", + "const": "step_start", + "default": "step_start" + }, + "step_type": { + "type": "string", + "enum": [ + "inference", + "tool_execution", + "shield_call", + "memory_retrieval" + ] + }, + "step_id": { + "type": "string" + }, + "metadata": { + "type": "object", + "additionalProperties": { + "oneOf": [ + { + "type": "null" + }, + { + "type": "boolean" + }, + { + "type": "number" + }, + { + "type": "string" + }, + { + "type": "array" + }, + { + "type": "object" + } + ] + } + } + }, + "additionalProperties": false, + "required": [ + "event_type", + "step_type", + "step_id" + ] + }, + "AgentTurnResponseStreamChunk": { + "type": "object", + "properties": { + "event": { + "$ref": "#/components/schemas/AgentTurnResponseEvent" + } + }, + "additionalProperties": false, + "required": [ + "event" + ], + "title": "streamed agent turn completion response." + }, + "AgentTurnResponseTurnCompletePayload": { + "type": "object", + "properties": { + "event_type": { + "type": "string", + "const": "turn_complete", + "default": "turn_complete" + }, + "turn": { + "$ref": "#/components/schemas/Turn" + } + }, + "additionalProperties": false, + "required": [ + "event_type", + "turn" + ] + }, + "AgentTurnResponseTurnStartPayload": { + "type": "object", + "properties": { + "event_type": { + "type": "string", + "const": "turn_start", + "default": "turn_start" + }, + "turn_id": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "event_type", + "turn_id" + ] + }, "InferenceStep": { "type": "object", "properties": { @@ -6846,57 +7062,57 @@ } ], "tags": [ - { - "name": "Safety" - }, - { - "name": "Scoring" - }, - { - "name": "BatchInference" - }, - { - "name": "DatasetIO" - }, - { - "name": "Models" - }, - { - "name": "Eval" - }, - { - "name": "Telemetry" - }, - { - "name": "Shields" - }, - { - "name": "Datasets" - }, { "name": "Memory" }, - { - "name": "PostTraining" - }, - { - "name": "ScoringFunctions" - }, - { - "name": "SyntheticDataGeneration" - }, - { - "name": "Inspect" - }, - { - "name": "MemoryBanks" - }, { "name": "Inference" }, + { + "name": "Eval" + }, + { + "name": "MemoryBanks" + }, + { + "name": "Models" + }, + { + "name": "BatchInference" + }, + { + "name": "PostTraining" + }, { "name": "Agents" }, + { + "name": "Shields" + }, + { + "name": "Telemetry" + }, + { + "name": "Inspect" + }, + { + "name": "DatasetIO" + }, + { + "name": "SyntheticDataGeneration" + }, + { + "name": "Datasets" + }, + { + "name": "Scoring" + }, + { + "name": "ScoringFunctions" + }, + { + "name": "Safety" + }, { "name": "BuiltinTool", "description": "" @@ -7081,6 +7297,34 @@ "name": "CreateAgentTurnRequest", "description": "" }, + { + "name": "AgentTurnResponseEvent", + "description": "Streamed agent execution response.\n\n" + }, + { + "name": "AgentTurnResponseStepCompletePayload", + "description": "" + }, + { + "name": "AgentTurnResponseStepProgressPayload", + "description": "" + }, + { + "name": "AgentTurnResponseStepStartPayload", + "description": "" + }, + { + "name": "AgentTurnResponseStreamChunk", + "description": "streamed agent turn completion response.\n\n" + }, + { + "name": "AgentTurnResponseTurnCompletePayload", + "description": "" + }, + { + "name": "AgentTurnResponseTurnStartPayload", + "description": "" + }, { "name": "InferenceStep", "description": "" @@ -7429,6 +7673,13 @@ "AgentCreateResponse", "AgentSessionCreateResponse", "AgentStepResponse", + "AgentTurnResponseEvent", + "AgentTurnResponseStepCompletePayload", + "AgentTurnResponseStepProgressPayload", + "AgentTurnResponseStepStartPayload", + "AgentTurnResponseStreamChunk", + "AgentTurnResponseTurnCompletePayload", + "AgentTurnResponseTurnStartPayload", "Attachment", "BatchChatCompletionRequest", "BatchChatCompletionResponse", diff --git a/docs/resources/llama-stack-spec.yaml b/docs/resources/llama-stack-spec.yaml index 0cf378168..7dd231965 100644 --- a/docs/resources/llama-stack-spec.yaml +++ b/docs/resources/llama-stack-spec.yaml @@ -86,6 +86,138 @@ components: required: - step type: object + AgentTurnResponseEvent: + additionalProperties: false + properties: + payload: + oneOf: + - $ref: '#/components/schemas/AgentTurnResponseStepStartPayload' + - $ref: '#/components/schemas/AgentTurnResponseStepProgressPayload' + - $ref: '#/components/schemas/AgentTurnResponseStepCompletePayload' + - $ref: '#/components/schemas/AgentTurnResponseTurnStartPayload' + - $ref: '#/components/schemas/AgentTurnResponseTurnCompletePayload' + required: + - payload + title: Streamed agent execution response. + type: object + AgentTurnResponseStepCompletePayload: + additionalProperties: false + properties: + event_type: + const: step_complete + default: step_complete + type: string + step_details: + oneOf: + - $ref: '#/components/schemas/InferenceStep' + - $ref: '#/components/schemas/ToolExecutionStep' + - $ref: '#/components/schemas/ShieldCallStep' + - $ref: '#/components/schemas/MemoryRetrievalStep' + step_type: + enum: + - inference + - tool_execution + - shield_call + - memory_retrieval + type: string + required: + - event_type + - step_type + - step_details + type: object + AgentTurnResponseStepProgressPayload: + additionalProperties: false + properties: + event_type: + const: step_progress + default: step_progress + type: string + model_response_text_delta: + type: string + step_id: + type: string + step_type: + enum: + - inference + - tool_execution + - shield_call + - memory_retrieval + type: string + tool_call_delta: + $ref: '#/components/schemas/ToolCallDelta' + tool_response_text_delta: + type: string + required: + - event_type + - step_type + - step_id + type: object + AgentTurnResponseStepStartPayload: + additionalProperties: false + properties: + event_type: + const: step_start + default: step_start + type: string + metadata: + additionalProperties: + oneOf: + - type: 'null' + - type: boolean + - type: number + - type: string + - type: array + - type: object + type: object + step_id: + type: string + step_type: + enum: + - inference + - tool_execution + - shield_call + - memory_retrieval + type: string + required: + - event_type + - step_type + - step_id + type: object + AgentTurnResponseStreamChunk: + additionalProperties: false + properties: + event: + $ref: '#/components/schemas/AgentTurnResponseEvent' + required: + - event + title: streamed agent turn completion response. + type: object + AgentTurnResponseTurnCompletePayload: + additionalProperties: false + properties: + event_type: + const: turn_complete + default: turn_complete + type: string + turn: + $ref: '#/components/schemas/Turn' + required: + - event_type + - turn + type: object + AgentTurnResponseTurnStartPayload: + additionalProperties: false + properties: + event_type: + const: turn_start + default: turn_start + type: string + turn_id: + type: string + required: + - event_type + - turn_id + type: object Attachment: additionalProperties: false properties: @@ -2866,7 +2998,7 @@ info: description: "This is the specification of the llama stack that provides\n \ \ a set of endpoints and their corresponding interfaces that are tailored\ \ to\n best leverage Llama Models. The specification is still in\ - \ draft and subject to change.\n Generated at 2024-10-31 10:35:38.305313" + \ draft and subject to change.\n Generated at 2024-10-31 14:28:52.128905" title: '[DRAFT] Llama Stack Specification' version: 0.0.1 jsonSchemaDialect: https://json-schema.org/draft/2020-12/schema @@ -3059,8 +3191,11 @@ paths: content: text/event-stream: schema: - $ref: '#/components/schemas/Turn' - description: A single turn in an interaction with an Agentic System. + oneOf: + - $ref: '#/components/schemas/Turn' + - $ref: '#/components/schemas/AgentTurnResponseStreamChunk' + description: A single turn in an interaction with an Agentic System. **OR** + streamed agent turn completion response. tags: - Agents /agents/turn/get: @@ -4145,23 +4280,23 @@ security: servers: - url: http://any-hosted-llama-stack.com tags: -- name: Safety -- name: Scoring -- name: BatchInference -- name: DatasetIO -- name: Models -- name: Eval -- name: Telemetry -- name: Shields -- name: Datasets - name: Memory -- name: PostTraining -- name: ScoringFunctions -- name: SyntheticDataGeneration -- name: Inspect -- name: MemoryBanks - name: Inference +- name: Eval +- name: MemoryBanks +- name: Models +- name: BatchInference +- name: PostTraining - name: Agents +- name: Shields +- name: Telemetry +- name: Inspect +- name: DatasetIO +- name: SyntheticDataGeneration +- name: Datasets +- name: Scoring +- name: ScoringFunctions +- name: Safety - description: name: BuiltinTool - description: name: CreateAgentTurnRequest +- description: 'Streamed agent execution response. + + + ' + name: AgentTurnResponseEvent +- description: + name: AgentTurnResponseStepCompletePayload +- description: + name: AgentTurnResponseStepProgressPayload +- description: + name: AgentTurnResponseStepStartPayload +- description: 'streamed agent turn completion response. + + + ' + name: AgentTurnResponseStreamChunk +- description: + name: AgentTurnResponseTurnCompletePayload +- description: + name: AgentTurnResponseTurnStartPayload - description: name: InferenceStep - description: