update generator & yaml spec

This commit is contained in:
Xi Yan 2024-09-09 10:39:29 -07:00
parent ee32de4c3f
commit 838ab91ebf
3 changed files with 214 additions and 45 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-07 15:23:29.488676"
"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-09 10:38:33.954536"
},
"servers": [
{
@ -277,7 +277,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AgenticSystemTurnCreateRequest"
"$ref": "#/components/schemas/CreateAgenticSystemTurnRequest"
}
}
},
@ -1024,7 +1024,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/LogSearchRequest"
"$ref": "#/components/schemas/GetLogsRequest"
}
}
},
@ -1365,7 +1365,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PostTrainingRLHFRequest"
"$ref": "#/components/schemas/PreferenceOptimizeRequest"
}
}
},
@ -1425,7 +1425,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RewardScoringRequest"
"$ref": "#/components/schemas/RewardScoreRequest"
}
}
},
@ -1455,7 +1455,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PostTrainingSFTRequest"
"$ref": "#/components/schemas/SupervisedFineTuneRequest"
}
}
},
@ -1485,7 +1485,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SyntheticDataGenerationRequest"
"$ref": "#/components/schemas/SyntheticDataGenerateRequest"
}
}
},
@ -3181,6 +3181,18 @@
"mime_type"
]
},
"CreateAgenticSystemTurnRequest": {
"type": "object",
"properties": {
"request": {
"$ref": "#/components/schemas/AgenticSystemTurnCreateRequest"
}
},
"additionalProperties": false,
"required": [
"request"
]
},
"AgenticSystemTurnResponseEvent": {
"type": "object",
"properties": {
@ -4643,6 +4655,18 @@
"query"
]
},
"GetLogsRequest": {
"type": "object",
"properties": {
"request": {
"$ref": "#/components/schemas/LogSearchRequest"
}
},
"additionalProperties": false,
"required": [
"request"
]
},
"Log": {
"type": "object",
"properties": {
@ -5109,6 +5133,18 @@
"fsdp_cpu_offload"
]
},
"PreferenceOptimizeRequest": {
"type": "object",
"properties": {
"request": {
"$ref": "#/components/schemas/PostTrainingRLHFRequest"
}
},
"additionalProperties": false,
"required": [
"request"
]
},
"QueryDocumentsRequest": {
"type": "object",
"properties": {
@ -5277,6 +5313,18 @@
],
"title": "Request to score a reward function. A list of prompts and a list of responses per prompt."
},
"RewardScoreRequest": {
"type": "object",
"properties": {
"request": {
"$ref": "#/components/schemas/RewardScoringRequest"
}
},
"additionalProperties": false,
"required": [
"request"
]
},
"RewardScoringResponse": {
"type": "object",
"properties": {
@ -5562,6 +5610,18 @@
"alpha"
]
},
"SupervisedFineTuneRequest": {
"type": "object",
"properties": {
"request": {
"$ref": "#/components/schemas/PostTrainingSFTRequest"
}
},
"additionalProperties": false,
"required": [
"request"
]
},
"SyntheticDataGenerationRequest": {
"type": "object",
"properties": {
@ -5607,6 +5667,18 @@
],
"title": "Request to generate synthetic data. A small batch of prompts and a filtering function"
},
"SyntheticDataGenerateRequest": {
"type": "object",
"properties": {
"request": {
"$ref": "#/components/schemas/SyntheticDataGenerationRequest"
}
},
"additionalProperties": false,
"required": [
"request"
]
},
"SyntheticDataGenerationResponse": {
"type": "object",
"properties": {
@ -5810,36 +5882,36 @@
}
],
"tags": [
{
"name": "Memory"
},
{
"name": "Telemetry"
},
{
"name": "Evaluations"
},
{
"name": "AgenticSystem"
},
{
"name": "Inference"
},
{
"name": "BatchInference"
},
{
"name": "PostTraining"
},
{
"name": "Datasets"
},
{
"name": "Memory"
"name": "PostTraining"
},
{
"name": "SyntheticDataGeneration"
},
{
"name": "Inference"
},
{
"name": "Evaluations"
},
{
"name": "BatchInference"
},
{
"name": "RewardScoring"
},
{
"name": "AgenticSystem"
},
{
"name": "BatchChatCompletionRequest",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/BatchChatCompletionRequest\" />"
@ -6024,6 +6096,10 @@
"name": "Attachment",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/Attachment\" />"
},
{
"name": "CreateAgenticSystemTurnRequest",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/CreateAgenticSystemTurnRequest\" />"
},
{
"name": "AgenticSystemTurnResponseEvent",
"description": "Streamed agent execution response.\n\n<SchemaDefinition schemaRef=\"#/components/schemas/AgenticSystemTurnResponseEvent\" />"
@ -6212,6 +6288,10 @@
"name": "LogSearchRequest",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/LogSearchRequest\" />"
},
{
"name": "GetLogsRequest",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/GetLogsRequest\" />"
},
{
"name": "Log",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/Log\" />"
@ -6276,6 +6356,10 @@
"name": "TrainingConfig",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/TrainingConfig\" />"
},
{
"name": "PreferenceOptimizeRequest",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/PreferenceOptimizeRequest\" />"
},
{
"name": "QueryDocumentsRequest",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/QueryDocumentsRequest\" />"
@ -6292,6 +6376,10 @@
"name": "RewardScoringRequest",
"description": "Request to score a reward function. A list of prompts and a list of responses per prompt.\n\n<SchemaDefinition schemaRef=\"#/components/schemas/RewardScoringRequest\" />"
},
{
"name": "RewardScoreRequest",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/RewardScoreRequest\" />"
},
{
"name": "RewardScoringResponse",
"description": "Response from the reward scoring. Batch of (prompt, response, score) tuples that pass the threshold.\n\n<SchemaDefinition schemaRef=\"#/components/schemas/RewardScoringResponse\" />"
@ -6324,10 +6412,18 @@
"name": "QLoraFinetuningConfig",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/QLoraFinetuningConfig\" />"
},
{
"name": "SupervisedFineTuneRequest",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/SupervisedFineTuneRequest\" />"
},
{
"name": "SyntheticDataGenerationRequest",
"description": "Request to generate synthetic data. A small batch of prompts and a filtering function\n\n<SchemaDefinition schemaRef=\"#/components/schemas/SyntheticDataGenerationRequest\" />"
},
{
"name": "SyntheticDataGenerateRequest",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/SyntheticDataGenerateRequest\" />"
},
{
"name": "SyntheticDataGenerationResponse",
"description": "Response from the synthetic data generation. Batch of (prompt, response, score) tuples that pass the threshold.\n\n<SchemaDefinition schemaRef=\"#/components/schemas/SyntheticDataGenerationResponse\" />"
@ -6403,6 +6499,7 @@
"CompletionResponseStreamChunk",
"CreateAgenticSystemRequest",
"CreateAgenticSystemSessionRequest",
"CreateAgenticSystemTurnRequest",
"CreateDatasetRequest",
"CreateExperimentRequest",
"CreateMemoryBankRequest",
@ -6430,6 +6527,7 @@
"FunctionCallToolDefinition",
"GetAgenticSystemSessionRequest",
"GetDocumentsRequest",
"GetLogsRequest",
"InferenceStep",
"InsertDocumentsRequest",
"ListArtifactsRequest",
@ -6452,12 +6550,14 @@
"PostTrainingJobStatusResponse",
"PostTrainingRLHFRequest",
"PostTrainingSFTRequest",
"PreferenceOptimizeRequest",
"QLoraFinetuningConfig",
"QueryDocumentsRequest",
"QueryDocumentsResponse",
"RLHFAlgorithm",
"RestAPIExecutionConfig",
"RestAPIMethod",
"RewardScoreRequest",
"RewardScoringRequest",
"RewardScoringResponse",
"Run",
@ -6470,6 +6570,8 @@
"ShieldDefinition",
"ShieldResponse",
"StopReason",
"SupervisedFineTuneRequest",
"SyntheticDataGenerateRequest",
"SyntheticDataGenerationRequest",
"SyntheticDataGenerationResponse",
"SystemMessage",

View file

@ -838,6 +838,14 @@ components:
- agent_id
- session_name
type: object
CreateAgenticSystemTurnRequest:
additionalProperties: false
properties:
request:
$ref: '#/components/schemas/AgenticSystemTurnCreateRequest'
required:
- request
type: object
CreateDatasetRequest:
additionalProperties: false
properties:
@ -1285,6 +1293,14 @@ components:
required:
- document_ids
type: object
GetLogsRequest:
additionalProperties: false
properties:
request:
$ref: '#/components/schemas/LogSearchRequest'
required:
- request
type: object
InferenceStep:
additionalProperties: false
properties:
@ -1796,6 +1812,14 @@ components:
- logger_config
title: Request to finetune a model.
type: object
PreferenceOptimizeRequest:
additionalProperties: false
properties:
request:
$ref: '#/components/schemas/PostTrainingRLHFRequest'
required:
- request
type: object
QLoraFinetuningConfig:
additionalProperties: false
properties:
@ -1908,6 +1932,14 @@ components:
- PUT
- DELETE
type: string
RewardScoreRequest:
additionalProperties: false
properties:
request:
$ref: '#/components/schemas/RewardScoringRequest'
required:
- request
type: object
RewardScoringRequest:
additionalProperties: false
properties:
@ -2116,6 +2148,22 @@ components:
- end_of_message
- out_of_tokens
type: string
SupervisedFineTuneRequest:
additionalProperties: false
properties:
request:
$ref: '#/components/schemas/PostTrainingSFTRequest'
required:
- request
type: object
SyntheticDataGenerateRequest:
additionalProperties: false
properties:
request:
$ref: '#/components/schemas/SyntheticDataGenerationRequest'
required:
- request
type: object
SyntheticDataGenerationRequest:
additionalProperties: false
properties:
@ -2609,7 +2657,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-07 15:23:29.488676"
\ draft and subject to change.\n Generated at 2024-09-09 10:38:33.954536"
title: '[DRAFT] Llama Stack Specification'
version: 0.0.1
jsonSchemaDialect: https://json-schema.org/draft/2020-12/schema
@ -2741,7 +2789,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/AgenticSystemTurnCreateRequest'
$ref: '#/components/schemas/CreateAgenticSystemTurnRequest'
required: true
responses:
'200':
@ -3183,7 +3231,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/LogSearchRequest'
$ref: '#/components/schemas/GetLogsRequest'
required: true
responses:
'200':
@ -3442,7 +3490,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/PostTrainingRLHFRequest'
$ref: '#/components/schemas/PreferenceOptimizeRequest'
required: true
responses:
'200':
@ -3460,7 +3508,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/PostTrainingSFTRequest'
$ref: '#/components/schemas/SupervisedFineTuneRequest'
required: true
responses:
'200':
@ -3478,7 +3526,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/RewardScoringRequest'
$ref: '#/components/schemas/RewardScoreRequest'
required: true
responses:
'200':
@ -3545,7 +3593,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/SyntheticDataGenerationRequest'
$ref: '#/components/schemas/SyntheticDataGenerateRequest'
required: true
responses:
'200':
@ -3561,16 +3609,16 @@ security:
servers:
- url: http://any-hosted-llama-stack.com
tags:
- name: Telemetry
- name: Evaluations
- name: AgenticSystem
- name: Inference
- name: BatchInference
- name: PostTraining
- name: Datasets
- name: Memory
- name: Telemetry
- name: Datasets
- name: PostTraining
- name: SyntheticDataGeneration
- name: Inference
- name: Evaluations
- name: BatchInference
- name: RewardScoring
- name: AgenticSystem
- description: <SchemaDefinition schemaRef="#/components/schemas/BatchChatCompletionRequest"
/>
name: BatchChatCompletionRequest
@ -3711,6 +3759,9 @@ tags:
name: AgenticSystemTurnCreateRequest
- description: <SchemaDefinition schemaRef="#/components/schemas/Attachment" />
name: Attachment
- description: <SchemaDefinition schemaRef="#/components/schemas/CreateAgenticSystemTurnRequest"
/>
name: CreateAgenticSystemTurnRequest
- description: 'Streamed agent execution response.
@ -3867,6 +3918,8 @@ tags:
- description: <SchemaDefinition schemaRef="#/components/schemas/LogSearchRequest"
/>
name: LogSearchRequest
- description: <SchemaDefinition schemaRef="#/components/schemas/GetLogsRequest" />
name: GetLogsRequest
- description: <SchemaDefinition schemaRef="#/components/schemas/Log" />
name: Log
- description: <SchemaDefinition schemaRef="#/components/schemas/Metric" />
@ -3921,6 +3974,9 @@ tags:
name: RLHFAlgorithm
- description: <SchemaDefinition schemaRef="#/components/schemas/TrainingConfig" />
name: TrainingConfig
- description: <SchemaDefinition schemaRef="#/components/schemas/PreferenceOptimizeRequest"
/>
name: PreferenceOptimizeRequest
- description: <SchemaDefinition schemaRef="#/components/schemas/QueryDocumentsRequest"
/>
name: QueryDocumentsRequest
@ -3936,6 +3992,9 @@ tags:
<SchemaDefinition schemaRef="#/components/schemas/RewardScoringRequest" />'
name: RewardScoringRequest
- description: <SchemaDefinition schemaRef="#/components/schemas/RewardScoreRequest"
/>
name: RewardScoreRequest
- description: 'Response from the reward scoring. Batch of (prompt, response, score)
tuples that pass the threshold.
@ -3964,6 +4023,9 @@ tags:
- description: <SchemaDefinition schemaRef="#/components/schemas/QLoraFinetuningConfig"
/>
name: QLoraFinetuningConfig
- description: <SchemaDefinition schemaRef="#/components/schemas/SupervisedFineTuneRequest"
/>
name: SupervisedFineTuneRequest
- description: 'Request to generate synthetic data. A small batch of prompts and a
filtering function
@ -3971,6 +4033,9 @@ tags:
<SchemaDefinition schemaRef="#/components/schemas/SyntheticDataGenerationRequest"
/>'
name: SyntheticDataGenerationRequest
- description: <SchemaDefinition schemaRef="#/components/schemas/SyntheticDataGenerateRequest"
/>
name: SyntheticDataGenerateRequest
- description: 'Response from the synthetic data generation. Batch of (prompt, response,
score) tuples that pass the threshold.
@ -4040,6 +4105,7 @@ x-tagGroups:
- CompletionResponseStreamChunk
- CreateAgenticSystemRequest
- CreateAgenticSystemSessionRequest
- CreateAgenticSystemTurnRequest
- CreateDatasetRequest
- CreateExperimentRequest
- CreateMemoryBankRequest
@ -4067,6 +4133,7 @@ x-tagGroups:
- FunctionCallToolDefinition
- GetAgenticSystemSessionRequest
- GetDocumentsRequest
- GetLogsRequest
- InferenceStep
- InsertDocumentsRequest
- ListArtifactsRequest
@ -4089,12 +4156,14 @@ x-tagGroups:
- PostTrainingJobStatusResponse
- PostTrainingRLHFRequest
- PostTrainingSFTRequest
- PreferenceOptimizeRequest
- QLoraFinetuningConfig
- QueryDocumentsRequest
- QueryDocumentsResponse
- RLHFAlgorithm
- RestAPIExecutionConfig
- RestAPIMethod
- RewardScoreRequest
- RewardScoringRequest
- RewardScoringResponse
- Run
@ -4107,6 +4176,8 @@ x-tagGroups:
- ShieldDefinition
- ShieldResponse
- StopReason
- SupervisedFineTuneRequest
- SyntheticDataGenerateRequest
- SyntheticDataGenerationRequest
- SyntheticDataGenerationResponse
- SystemMessage

View file

@ -468,15 +468,11 @@ class Generator:
builder = ContentBuilder(self.schema_builder)
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
op_name = "".join(word.capitalize() for word in op.name.split("_"))
request_name = f"{op_name}Request"
request_type = make_dataclass(request_name, op.request_params)
from dataclasses import make_dataclass
op_name = "".join(word.capitalize() for word in op.name.split("_"))
request_name = f"{op_name}Request"
request_type = make_dataclass(request_name, op.request_params)
requestBody = RequestBody(
content={