diff --git a/rfcs/RFC-0001-llama-stack-assets/llama-stack-spec.html b/rfcs/RFC-0001-llama-stack-assets/llama-stack-spec.html index 38efd4ca3..f7d0fa0f7 100644 --- a/rfcs/RFC-0001-llama-stack-assets/llama-stack-spec.html +++ b/rfcs/RFC-0001-llama-stack-assets/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-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": "" @@ -6024,6 +6096,10 @@ "name": "Attachment", "description": "" }, + { + "name": "CreateAgenticSystemTurnRequest", + "description": "" + }, { "name": "AgenticSystemTurnResponseEvent", "description": "Streamed agent execution response.\n\n" @@ -6212,6 +6288,10 @@ "name": "LogSearchRequest", "description": "" }, + { + "name": "GetLogsRequest", + "description": "" + }, { "name": "Log", "description": "" @@ -6276,6 +6356,10 @@ "name": "TrainingConfig", "description": "" }, + { + "name": "PreferenceOptimizeRequest", + "description": "" + }, { "name": "QueryDocumentsRequest", "description": "" @@ -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" }, + { + "name": "RewardScoreRequest", + "description": "" + }, { "name": "RewardScoringResponse", "description": "Response from the reward scoring. Batch of (prompt, response, score) tuples that pass the threshold.\n\n" @@ -6324,10 +6412,18 @@ "name": "QLoraFinetuningConfig", "description": "" }, + { + "name": "SupervisedFineTuneRequest", + "description": "" + }, { "name": "SyntheticDataGenerationRequest", "description": "Request to generate synthetic data. A small batch of prompts and a filtering function\n\n" }, + { + "name": "SyntheticDataGenerateRequest", + "description": "" + }, { "name": "SyntheticDataGenerationResponse", "description": "Response from the synthetic data generation. Batch of (prompt, response, score) tuples that pass the threshold.\n\n" @@ -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", diff --git a/rfcs/RFC-0001-llama-stack-assets/llama-stack-spec.yaml b/rfcs/RFC-0001-llama-stack-assets/llama-stack-spec.yaml index 11f092549..2f0d6918c 100644 --- a/rfcs/RFC-0001-llama-stack-assets/llama-stack-spec.yaml +++ b/rfcs/RFC-0001-llama-stack-assets/llama-stack-spec.yaml @@ -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: name: BatchChatCompletionRequest @@ -3711,6 +3759,9 @@ tags: name: AgenticSystemTurnCreateRequest - description: name: Attachment +- description: + name: CreateAgenticSystemTurnRequest - description: 'Streamed agent execution response. @@ -3867,6 +3918,8 @@ tags: - description: name: LogSearchRequest +- description: + name: GetLogsRequest - description: name: Log - description: @@ -3921,6 +3974,9 @@ tags: name: RLHFAlgorithm - description: name: TrainingConfig +- description: + name: PreferenceOptimizeRequest - description: name: QueryDocumentsRequest @@ -3936,6 +3992,9 @@ tags: ' name: RewardScoringRequest +- description: + name: RewardScoreRequest - description: 'Response from the reward scoring. Batch of (prompt, response, score) tuples that pass the threshold. @@ -3964,6 +4023,9 @@ tags: - description: name: QLoraFinetuningConfig +- description: + name: SupervisedFineTuneRequest - description: 'Request to generate synthetic data. A small batch of prompts and a filtering function @@ -3971,6 +4033,9 @@ tags: ' name: SyntheticDataGenerationRequest +- description: + 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 diff --git a/rfcs/openapi_generator/pyopenapi/generator.py b/rfcs/openapi_generator/pyopenapi/generator.py index e1450074b..dcb4810c7 100644 --- a/rfcs/openapi_generator/pyopenapi/generator.py +++ b/rfcs/openapi_generator/pyopenapi/generator.py @@ -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={