A few more fixes to the OpenAPI generator

This commit is contained in:
Ashwin Bharambe 2024-09-04 10:29:20 -07:00
parent 0167953d2d
commit bfee50aa83
3 changed files with 319 additions and 69 deletions

View file

@ -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-09-04 09:26:21.634687"
"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-09-04 10:28:38.779789"
},
"servers": [
{
@ -104,7 +104,7 @@
"content": {
"application/json": {
"schema": {
"type": "string"
"$ref": "#/components/schemas/CancelEvaluationJobRequest"
}
}
},
@ -127,7 +127,7 @@
"content": {
"application/json": {
"schema": {
"type": "string"
"$ref": "#/components/schemas/CancelTrainingJobRequest"
}
}
},
@ -217,7 +217,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AgentConfig"
"$ref": "#/components/schemas/CreateAgenticSystemRequest"
}
}
},
@ -413,7 +413,7 @@
"content": {
"application/json": {
"schema": {
"type": "string"
"$ref": "#/components/schemas/DeleteAgenticSystemRequest"
}
}
},
@ -459,7 +459,7 @@
"content": {
"application/json": {
"schema": {
"type": "string"
"$ref": "#/components/schemas/DeleteDatasetRequest"
}
}
},
@ -512,7 +512,7 @@
"content": {
"application/json": {
"schema": {
"type": "string"
"$ref": "#/components/schemas/DropMemoryBankRequest"
}
}
},
@ -679,17 +679,7 @@
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "array",
"items": {
"type": "string"
}
},
{
"type": "null"
}
]
"$ref": "#/components/schemas/GetAgenticSystemSessionRequest"
}
}
},
@ -868,10 +858,7 @@
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "string"
}
"$ref": "#/components/schemas/GetDocumentsRequest"
}
}
},
@ -1262,7 +1249,7 @@
"content": {
"application/json": {
"schema": {
"type": "string"
"$ref": "#/components/schemas/ListArtifactsRequest"
}
}
},
@ -2104,6 +2091,30 @@
"completion_message_batch"
]
},
"CancelEvaluationJobRequest": {
"type": "object",
"properties": {
"job_uuid": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"job_uuid"
]
},
"CancelTrainingJobRequest": {
"type": "object",
"properties": {
"job_uuid": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"job_uuid"
]
},
"ChatCompletionRequest": {
"type": "object",
"properties": {
@ -2772,6 +2783,18 @@
"type"
]
},
"CreateAgenticSystemRequest": {
"type": "object",
"properties": {
"agent_config": {
"$ref": "#/components/schemas/AgentConfig"
}
},
"additionalProperties": false,
"required": [
"agent_config"
]
},
"AgenticSystemCreateResponse": {
"type": "object",
"properties": {
@ -3864,6 +3887,18 @@
"metadata"
]
},
"DeleteAgenticSystemRequest": {
"type": "object",
"properties": {
"agent_id": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"agent_id"
]
},
"DeleteAgenticSystemSessionRequest": {
"type": "object",
"properties": {
@ -3880,6 +3915,18 @@
"session_id"
]
},
"DeleteDatasetRequest": {
"type": "object",
"properties": {
"dataset_uuid": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"dataset_uuid"
]
},
"DeleteDocumentsRequest": {
"type": "object",
"properties": {
@ -3899,6 +3946,18 @@
"document_ids"
]
},
"DropMemoryBankRequest": {
"type": "object",
"properties": {
"bank_id": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"bank_id"
]
},
"EmbeddingsRequest": {
"type": "object",
"properties": {
@ -4070,6 +4129,18 @@
],
"title": "Request to evaluate text generation."
},
"GetAgenticSystemSessionRequest": {
"type": "object",
"properties": {
"turn_ids": {
"type": "array",
"items": {
"type": "string"
}
}
},
"additionalProperties": false
},
"Session": {
"type": "object",
"properties": {
@ -4195,6 +4266,21 @@
"other"
]
},
"GetDocumentsRequest": {
"type": "object",
"properties": {
"document_ids": {
"type": "array",
"items": {
"type": "string"
}
}
},
"additionalProperties": false,
"required": [
"document_ids"
]
},
"MemoryBankDocument": {
"type": "object",
"properties": {
@ -4557,6 +4643,18 @@
"documents"
]
},
"ListArtifactsRequest": {
"type": "object",
"properties": {
"experiment_id": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"experiment_id"
]
},
"LogMessagesRequest": {
"type": "object",
"properties": {
@ -5487,31 +5585,31 @@
"name": "Observability"
},
{
"name": "Evaluations"
},
{
"name": "Memory"
},
{
"name": "BatchInference"
},
{
"name": "RewardScoring"
},
{
"name": "SyntheticDataGeneration"
},
{
"name": "PostTraining"
},
{
"name": "AgenticSystem"
"name": "Inference"
},
{
"name": "Datasets"
},
{
"name": "Inference"
"name": "Memory"
},
{
"name": "AgenticSystem"
},
{
"name": "Evaluations"
},
{
"name": "SyntheticDataGeneration"
},
{
"name": "RewardScoring"
},
{
"name": "PostTraining"
},
{
"name": "BatchInference"
},
{
"name": "BatchChatCompletionRequest",
@ -5581,6 +5679,14 @@
"name": "BatchCompletionResponse",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/BatchCompletionResponse\" />"
},
{
"name": "CancelEvaluationJobRequest",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/CancelEvaluationJobRequest\" />"
},
{
"name": "CancelTrainingJobRequest",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/CancelTrainingJobRequest\" />"
},
{
"name": "ChatCompletionRequest",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/ChatCompletionRequest\" />"
@ -5669,6 +5775,10 @@
"name": "WolframAlphaToolDefinition",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/WolframAlphaToolDefinition\" />"
},
{
"name": "CreateAgenticSystemRequest",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/CreateAgenticSystemRequest\" />"
},
{
"name": "AgenticSystemCreateResponse",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/AgenticSystemCreateResponse\" />"
@ -5785,14 +5895,26 @@
"name": "Run",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/Run\" />"
},
{
"name": "DeleteAgenticSystemRequest",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/DeleteAgenticSystemRequest\" />"
},
{
"name": "DeleteAgenticSystemSessionRequest",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/DeleteAgenticSystemSessionRequest\" />"
},
{
"name": "DeleteDatasetRequest",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/DeleteDatasetRequest\" />"
},
{
"name": "DeleteDocumentsRequest",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/DeleteDocumentsRequest\" />"
},
{
"name": "DropMemoryBankRequest",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/DropMemoryBankRequest\" />"
},
{
"name": "EmbeddingsRequest",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/EmbeddingsRequest\" />"
@ -5821,6 +5943,10 @@
"name": "EvaluateTextGenerationRequest",
"description": "Request to evaluate text generation.\n\n<SchemaDefinition schemaRef=\"#/components/schemas/EvaluateTextGenerationRequest\" />"
},
{
"name": "GetAgenticSystemSessionRequest",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/GetAgenticSystemSessionRequest\" />"
},
{
"name": "Session",
"description": "A single session of an interaction with an Agentic System.\n\n<SchemaDefinition schemaRef=\"#/components/schemas/Session\" />"
@ -5837,6 +5963,10 @@
"name": "ArtifactType",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/ArtifactType\" />"
},
{
"name": "GetDocumentsRequest",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/GetDocumentsRequest\" />"
},
{
"name": "MemoryBankDocument",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/MemoryBankDocument\" />"
@ -5889,6 +6019,10 @@
"name": "InsertDocumentsRequest",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/InsertDocumentsRequest\" />"
},
{
"name": "ListArtifactsRequest",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/ListArtifactsRequest\" />"
},
{
"name": "LogMessagesRequest",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/LogMessagesRequest\" />"
@ -6031,6 +6165,8 @@
"BraveSearchToolDefinition",
"BuiltinShield",
"BuiltinTool",
"CancelEvaluationJobRequest",
"CancelTrainingJobRequest",
"ChatCompletionRequest",
"ChatCompletionResponseEvent",
"ChatCompletionResponseEventType",
@ -6040,16 +6176,20 @@
"CompletionMessage",
"CompletionRequest",
"CompletionResponseStreamChunk",
"CreateAgenticSystemRequest",
"CreateAgenticSystemSessionRequest",
"CreateDatasetRequest",
"CreateExperimentRequest",
"CreateMemoryBankRequest",
"CreateRunRequest",
"DPOAlignmentConfig",
"DeleteAgenticSystemRequest",
"DeleteAgenticSystemSessionRequest",
"DeleteDatasetRequest",
"DeleteDocumentsRequest",
"DialogGenerations",
"DoraFinetuningConfig",
"DropMemoryBankRequest",
"EmbeddingsRequest",
"EmbeddingsResponse",
"EvaluateQuestionAnsweringRequest",
@ -6063,8 +6203,11 @@
"ExperimentStatus",
"FinetuningAlgorithm",
"FunctionCallToolDefinition",
"GetAgenticSystemSessionRequest",
"GetDocumentsRequest",
"InferenceStep",
"InsertDocumentsRequest",
"ListArtifactsRequest",
"Log",
"LogMessagesRequest",
"LogMetricsRequest",

View file

@ -413,6 +413,22 @@ components:
- photogen
- code_interpreter
type: string
CancelEvaluationJobRequest:
additionalProperties: false
properties:
job_uuid:
type: string
required:
- job_uuid
type: object
CancelTrainingJobRequest:
additionalProperties: false
properties:
job_uuid:
type: string
required:
- job_uuid
type: object
ChatCompletionRequest:
additionalProperties: false
properties:
@ -571,6 +587,14 @@ components:
- delta
title: streamed completion response.
type: object
CreateAgenticSystemRequest:
additionalProperties: false
properties:
agent_config:
$ref: '#/components/schemas/AgentConfig'
required:
- agent_config
type: object
CreateAgenticSystemSessionRequest:
additionalProperties: false
properties:
@ -700,6 +724,14 @@ components:
- epsilon
- gamma
type: object
DeleteAgenticSystemRequest:
additionalProperties: false
properties:
agent_id:
type: string
required:
- agent_id
type: object
DeleteAgenticSystemSessionRequest:
additionalProperties: false
properties:
@ -711,6 +743,14 @@ components:
- agent_id
- session_id
type: object
DeleteDatasetRequest:
additionalProperties: false
properties:
dataset_uuid:
type: string
required:
- dataset_uuid
type: object
DeleteDocumentsRequest:
additionalProperties: false
properties:
@ -769,6 +809,14 @@ components:
- rank
- alpha
type: object
DropMemoryBankRequest:
additionalProperties: false
properties:
bank_id:
type: string
required:
- bank_id
type: object
EmbeddingsRequest:
additionalProperties: false
properties:
@ -987,6 +1035,24 @@ components:
- description
- parameters
type: object
GetAgenticSystemSessionRequest:
additionalProperties: false
properties:
turn_ids:
items:
type: string
type: array
type: object
GetDocumentsRequest:
additionalProperties: false
properties:
document_ids:
items:
type: string
type: array
required:
- document_ids
type: object
InferenceStep:
additionalProperties: false
properties:
@ -1026,6 +1092,14 @@ components:
- bank_id
- documents
type: object
ListArtifactsRequest:
additionalProperties: false
properties:
experiment_id:
type: string
required:
- experiment_id
type: object
Log:
additionalProperties: false
properties:
@ -2385,7 +2459,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-09-04 09:26:21.634687"
\ draft and subject to change.\n Generated at 2024-09-04 10:28:38.779789"
title: '[DRAFT] Llama Stack Specification'
version: 0.0.1
jsonSchemaDialect: https://json-schema.org/draft/2020-12/schema
@ -2398,7 +2472,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/AgentConfig'
$ref: '#/components/schemas/CreateAgenticSystemRequest'
required: true
responses:
'200':
@ -2416,7 +2490,7 @@ paths:
content:
application/json:
schema:
type: string
$ref: '#/components/schemas/DeleteAgenticSystemRequest'
required: true
responses:
'200':
@ -2472,11 +2546,7 @@ paths:
content:
application/json:
schema:
oneOf:
- items:
type: string
type: array
- type: 'null'
$ref: '#/components/schemas/GetAgenticSystemSessionRequest'
required: true
responses:
'200':
@ -2628,7 +2698,7 @@ paths:
content:
application/json:
schema:
type: string
$ref: '#/components/schemas/DeleteDatasetRequest'
required: true
responses:
'200':
@ -2676,7 +2746,7 @@ paths:
content:
application/json:
schema:
type: string
$ref: '#/components/schemas/CancelEvaluationJobRequest'
required: true
responses:
'200':
@ -2790,7 +2860,7 @@ paths:
content:
application/json:
schema:
type: string
$ref: '#/components/schemas/ListArtifactsRequest'
required: true
responses:
'200':
@ -3014,9 +3084,7 @@ paths:
content:
application/json:
schema:
items:
type: string
type: array
$ref: '#/components/schemas/GetDocumentsRequest'
required: true
responses:
'200':
@ -3098,7 +3166,7 @@ paths:
content:
application/json:
schema:
type: string
$ref: '#/components/schemas/DropMemoryBankRequest'
required: true
responses:
'200':
@ -3164,7 +3232,7 @@ paths:
content:
application/json:
schema:
type: string
$ref: '#/components/schemas/CancelTrainingJobRequest'
required: true
responses:
'200':
@ -3344,15 +3412,15 @@ servers:
- url: http://any-hosted-llama-stack.com
tags:
- name: Observability
- name: Evaluations
- name: Memory
- name: BatchInference
- name: RewardScoring
- name: SyntheticDataGeneration
- name: PostTraining
- name: AgenticSystem
- name: Datasets
- name: Inference
- name: Datasets
- name: Memory
- name: AgenticSystem
- name: Evaluations
- name: SyntheticDataGeneration
- name: RewardScoring
- name: PostTraining
- name: BatchInference
- description: <SchemaDefinition schemaRef="#/components/schemas/BatchChatCompletionRequest"
/>
name: BatchChatCompletionRequest
@ -3404,6 +3472,12 @@ tags:
- description: <SchemaDefinition schemaRef="#/components/schemas/BatchCompletionResponse"
/>
name: BatchCompletionResponse
- description: <SchemaDefinition schemaRef="#/components/schemas/CancelEvaluationJobRequest"
/>
name: CancelEvaluationJobRequest
- description: <SchemaDefinition schemaRef="#/components/schemas/CancelTrainingJobRequest"
/>
name: CancelTrainingJobRequest
- description: <SchemaDefinition schemaRef="#/components/schemas/ChatCompletionRequest"
/>
name: ChatCompletionRequest
@ -3473,6 +3547,9 @@ tags:
- description: <SchemaDefinition schemaRef="#/components/schemas/WolframAlphaToolDefinition"
/>
name: WolframAlphaToolDefinition
- description: <SchemaDefinition schemaRef="#/components/schemas/CreateAgenticSystemRequest"
/>
name: CreateAgenticSystemRequest
- description: <SchemaDefinition schemaRef="#/components/schemas/AgenticSystemCreateResponse"
/>
name: AgenticSystemCreateResponse
@ -3561,12 +3638,21 @@ tags:
name: CreateRunRequest
- description: <SchemaDefinition schemaRef="#/components/schemas/Run" />
name: Run
- description: <SchemaDefinition schemaRef="#/components/schemas/DeleteAgenticSystemRequest"
/>
name: DeleteAgenticSystemRequest
- description: <SchemaDefinition schemaRef="#/components/schemas/DeleteAgenticSystemSessionRequest"
/>
name: DeleteAgenticSystemSessionRequest
- description: <SchemaDefinition schemaRef="#/components/schemas/DeleteDatasetRequest"
/>
name: DeleteDatasetRequest
- description: <SchemaDefinition schemaRef="#/components/schemas/DeleteDocumentsRequest"
/>
name: DeleteDocumentsRequest
- description: <SchemaDefinition schemaRef="#/components/schemas/DropMemoryBankRequest"
/>
name: DropMemoryBankRequest
- description: <SchemaDefinition schemaRef="#/components/schemas/EmbeddingsRequest"
/>
name: EmbeddingsRequest
@ -3598,6 +3684,9 @@ tags:
<SchemaDefinition schemaRef="#/components/schemas/EvaluateTextGenerationRequest"
/>'
name: EvaluateTextGenerationRequest
- description: <SchemaDefinition schemaRef="#/components/schemas/GetAgenticSystemSessionRequest"
/>
name: GetAgenticSystemSessionRequest
- description: 'A single session of an interaction with an Agentic System.
@ -3610,6 +3699,9 @@ tags:
name: Artifact
- description: <SchemaDefinition schemaRef="#/components/schemas/ArtifactType" />
name: ArtifactType
- description: <SchemaDefinition schemaRef="#/components/schemas/GetDocumentsRequest"
/>
name: GetDocumentsRequest
- description: <SchemaDefinition schemaRef="#/components/schemas/MemoryBankDocument"
/>
name: MemoryBankDocument
@ -3658,6 +3750,9 @@ tags:
- description: <SchemaDefinition schemaRef="#/components/schemas/InsertDocumentsRequest"
/>
name: InsertDocumentsRequest
- description: <SchemaDefinition schemaRef="#/components/schemas/ListArtifactsRequest"
/>
name: ListArtifactsRequest
- description: <SchemaDefinition schemaRef="#/components/schemas/LogMessagesRequest"
/>
name: LogMessagesRequest
@ -3785,6 +3880,8 @@ x-tagGroups:
- BraveSearchToolDefinition
- BuiltinShield
- BuiltinTool
- CancelEvaluationJobRequest
- CancelTrainingJobRequest
- ChatCompletionRequest
- ChatCompletionResponseEvent
- ChatCompletionResponseEventType
@ -3794,16 +3891,20 @@ x-tagGroups:
- CompletionMessage
- CompletionRequest
- CompletionResponseStreamChunk
- CreateAgenticSystemRequest
- CreateAgenticSystemSessionRequest
- CreateDatasetRequest
- CreateExperimentRequest
- CreateMemoryBankRequest
- CreateRunRequest
- DPOAlignmentConfig
- DeleteAgenticSystemRequest
- DeleteAgenticSystemSessionRequest
- DeleteDatasetRequest
- DeleteDocumentsRequest
- DialogGenerations
- DoraFinetuningConfig
- DropMemoryBankRequest
- EmbeddingsRequest
- EmbeddingsResponse
- EvaluateQuestionAnsweringRequest
@ -3817,8 +3918,11 @@ x-tagGroups:
- ExperimentStatus
- FinetuningAlgorithm
- FunctionCallToolDefinition
- GetAgenticSystemSessionRequest
- GetDocumentsRequest
- InferenceStep
- InsertDocumentsRequest
- ListArtifactsRequest
- Log
- LogMessagesRequest
- LogMetricsRequest

View file

@ -466,8 +466,11 @@ class Generator:
# data passed in payload
if op.request_params:
builder = ContentBuilder(self.schema_builder)
if len(op.request_params) == 1:
request_name, request_type = op.request_params[0]
first = next(iter(op.request_params))
request_name, request_type = first
if len(op.request_params) == 1 and "Request" in first[1].__name__:
# TODO(ashwin): Undo the "Request" hack and this entire block eventually
request_name, request_type = first
else:
from dataclasses import make_dataclass