openapi in readthedocs

This commit is contained in:
Xi Yan 2024-11-22 17:22:45 -08:00
parent 72a0dbb15a
commit dbd4b9ecce
4 changed files with 57 additions and 49 deletions

View file

@ -52,12 +52,11 @@ def main(output_dir: str):
Options( Options(
server=Server(url="http://any-hosted-llama-stack.com"), server=Server(url="http://any-hosted-llama-stack.com"),
info=Info( info=Info(
title="[DRAFT] Llama Stack Specification", title="Llama Stack Specification",
version=LLAMA_STACK_API_VERSION, version=LLAMA_STACK_API_VERSION,
description="""This is the specification of the llama stack that provides description="""This is the specification of the Llama Stack that provides
a set of endpoints and their corresponding interfaces that are tailored to a set of endpoints and their corresponding interfaces that are tailored to
best leverage Llama Models. The specification is still in draft and subject to change. best leverage Llama Models. Generated at """
Generated at """
+ now, + now,
), ),
), ),

View file

@ -438,6 +438,14 @@ class Generator:
return extra_tags return extra_tags
def _build_operation(self, op: EndpointOperation) -> Operation: def _build_operation(self, op: EndpointOperation) -> Operation:
if op.defining_class.__name__ in [
"SyntheticDataGeneration",
"PostTraining",
"BatchInference",
]:
op.defining_class.__name__ = f"(Coming Soon) {op.defining_class.__name__}"
print(op.defining_class.__name__)
doc_string = parse_type(op.func_ref) doc_string = parse_type(op.func_ref)
doc_params = dict( doc_params = dict(
(param.name, param.description) for param in doc_string.params.values() (param.name, param.description) for param in doc_string.params.values()

View file

@ -19,9 +19,9 @@
spec = { spec = {
"openapi": "3.1.0", "openapi": "3.1.0",
"info": { "info": {
"title": "[DRAFT] Llama Stack Specification", "title": "Llama Stack Specification",
"version": "alpha", "version": "alpha",
"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-11-19 09:14:01.145131" "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. Generated at 2024-11-22 17:22:31.150049"
}, },
"servers": [ "servers": [
{ {
@ -44,7 +44,7 @@
} }
}, },
"tags": [ "tags": [
"BatchInference" "(Coming Soon) BatchInference"
], ],
"parameters": [ "parameters": [
{ {
@ -84,7 +84,7 @@
} }
}, },
"tags": [ "tags": [
"BatchInference" "(Coming Soon) BatchInference"
], ],
"parameters": [ "parameters": [
{ {
@ -117,7 +117,7 @@
} }
}, },
"tags": [ "tags": [
"PostTraining" "(Coming Soon) PostTraining"
], ],
"parameters": [ "parameters": [
{ {
@ -1079,7 +1079,7 @@
} }
}, },
"tags": [ "tags": [
"PostTraining" "(Coming Soon) PostTraining"
], ],
"parameters": [ "parameters": [
{ {
@ -1117,7 +1117,7 @@
} }
}, },
"tags": [ "tags": [
"PostTraining" "(Coming Soon) PostTraining"
], ],
"parameters": [ "parameters": [
{ {
@ -1155,7 +1155,7 @@
} }
}, },
"tags": [ "tags": [
"PostTraining" "(Coming Soon) PostTraining"
], ],
"parameters": [ "parameters": [
{ {
@ -1193,7 +1193,7 @@
} }
}, },
"tags": [ "tags": [
"PostTraining" "(Coming Soon) PostTraining"
], ],
"parameters": [ "parameters": [
{ {
@ -1713,7 +1713,7 @@
} }
}, },
"tags": [ "tags": [
"PostTraining" "(Coming Soon) PostTraining"
], ],
"parameters": [ "parameters": [
{ {
@ -2161,7 +2161,7 @@
} }
}, },
"tags": [ "tags": [
"PostTraining" "(Coming Soon) PostTraining"
], ],
"parameters": [ "parameters": [
{ {
@ -2201,7 +2201,7 @@
} }
}, },
"tags": [ "tags": [
"SyntheticDataGeneration" "(Coming Soon) SyntheticDataGeneration"
], ],
"parameters": [ "parameters": [
{ {
@ -3861,7 +3861,8 @@
"type": "string", "type": "string",
"enum": [ "enum": [
"bing", "bing",
"brave" "brave",
"tavily"
], ],
"default": "brave" "default": "brave"
}, },
@ -7926,6 +7927,15 @@
} }
], ],
"tags": [ "tags": [
{
"name": "(Coming Soon) BatchInference"
},
{
"name": "(Coming Soon) PostTraining"
},
{
"name": "(Coming Soon) SyntheticDataGeneration"
},
{ {
"name": "AgentCandidate", "name": "AgentCandidate",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/AgentCandidate\" />" "description": "<SchemaDefinition schemaRef=\"#/components/schemas/AgentCandidate\" />"
@ -8001,9 +8011,6 @@
"name": "BatchCompletionResponse", "name": "BatchCompletionResponse",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/BatchCompletionResponse\" />" "description": "<SchemaDefinition schemaRef=\"#/components/schemas/BatchCompletionResponse\" />"
}, },
{
"name": "BatchInference"
},
{ {
"name": "BenchmarkEvalTaskConfig", "name": "BenchmarkEvalTaskConfig",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/BenchmarkEvalTaskConfig\" />" "description": "<SchemaDefinition schemaRef=\"#/components/schemas/BenchmarkEvalTaskConfig\" />"
@ -8255,9 +8262,6 @@
"name": "PhotogenToolDefinition", "name": "PhotogenToolDefinition",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/PhotogenToolDefinition\" />" "description": "<SchemaDefinition schemaRef=\"#/components/schemas/PhotogenToolDefinition\" />"
}, },
{
"name": "PostTraining"
},
{ {
"name": "PostTrainingJob", "name": "PostTrainingJob",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/PostTrainingJob\" />" "description": "<SchemaDefinition schemaRef=\"#/components/schemas/PostTrainingJob\" />"
@ -8446,9 +8450,6 @@
"name": "SyntheticDataGenerateRequest", "name": "SyntheticDataGenerateRequest",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/SyntheticDataGenerateRequest\" />" "description": "<SchemaDefinition schemaRef=\"#/components/schemas/SyntheticDataGenerateRequest\" />"
}, },
{
"name": "SyntheticDataGeneration"
},
{ {
"name": "SyntheticDataGenerationResponse", "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\" />" "description": "Response from the synthetic data generation. Batch of (prompt, response, score) tuples that pass the threshold.\n\n<SchemaDefinition schemaRef=\"#/components/schemas/SyntheticDataGenerationResponse\" />"
@ -8557,8 +8558,10 @@
{ {
"name": "Operations", "name": "Operations",
"tags": [ "tags": [
"(Coming Soon) BatchInference",
"(Coming Soon) PostTraining",
"(Coming Soon) SyntheticDataGeneration",
"Agents", "Agents",
"BatchInference",
"DatasetIO", "DatasetIO",
"Datasets", "Datasets",
"Eval", "Eval",
@ -8568,12 +8571,10 @@
"Memory", "Memory",
"MemoryBanks", "MemoryBanks",
"Models", "Models",
"PostTraining",
"Safety", "Safety",
"Scoring", "Scoring",
"ScoringFunctions", "ScoringFunctions",
"Shields", "Shields",
"SyntheticDataGeneration",
"Telemetry" "Telemetry"
] ]
}, },

View file

@ -2629,6 +2629,7 @@ components:
enum: enum:
- bing - bing
- brave - brave
- tavily
type: string type: string
input_shields: input_shields:
items: items:
@ -3397,11 +3398,10 @@ components:
- api_key - api_key
type: object type: object
info: info:
description: "This is the specification of the llama stack that provides\n \ description: "This is the specification of the Llama Stack that provides\n \
\ a set of endpoints and their corresponding interfaces that are tailored\ \ a set of endpoints and their corresponding interfaces that are tailored\
\ to\n best leverage Llama Models. The specification is still in\ \ to\n best leverage Llama Models. Generated at 2024-11-22 17:22:31.150049"
\ draft and subject to change.\n Generated at 2024-11-19 09:14:01.145131" title: Llama Stack Specification
title: '[DRAFT] Llama Stack Specification'
version: alpha version: alpha
jsonSchemaDialect: https://json-schema.org/draft/2020-12/schema jsonSchemaDialect: https://json-schema.org/draft/2020-12/schema
openapi: 3.1.0 openapi: 3.1.0
@ -3658,7 +3658,7 @@ paths:
$ref: '#/components/schemas/BatchChatCompletionResponse' $ref: '#/components/schemas/BatchChatCompletionResponse'
description: OK description: OK
tags: tags:
- BatchInference - (Coming Soon) BatchInference
/alpha/batch-inference/completion: /alpha/batch-inference/completion:
post: post:
parameters: parameters:
@ -3683,7 +3683,7 @@ paths:
$ref: '#/components/schemas/BatchCompletionResponse' $ref: '#/components/schemas/BatchCompletionResponse'
description: OK description: OK
tags: tags:
- BatchInference - (Coming Soon) BatchInference
/alpha/datasetio/get-rows-paginated: /alpha/datasetio/get-rows-paginated:
get: get:
parameters: parameters:
@ -4337,7 +4337,7 @@ paths:
$ref: '#/components/schemas/PostTrainingJobArtifactsResponse' $ref: '#/components/schemas/PostTrainingJobArtifactsResponse'
description: OK description: OK
tags: tags:
- PostTraining - (Coming Soon) PostTraining
/alpha/post-training/job/cancel: /alpha/post-training/job/cancel:
post: post:
parameters: parameters:
@ -4358,7 +4358,7 @@ paths:
'200': '200':
description: OK description: OK
tags: tags:
- PostTraining - (Coming Soon) PostTraining
/alpha/post-training/job/logs: /alpha/post-training/job/logs:
get: get:
parameters: parameters:
@ -4382,7 +4382,7 @@ paths:
$ref: '#/components/schemas/PostTrainingJobLogStream' $ref: '#/components/schemas/PostTrainingJobLogStream'
description: OK description: OK
tags: tags:
- PostTraining - (Coming Soon) PostTraining
/alpha/post-training/job/status: /alpha/post-training/job/status:
get: get:
parameters: parameters:
@ -4406,7 +4406,7 @@ paths:
$ref: '#/components/schemas/PostTrainingJobStatusResponse' $ref: '#/components/schemas/PostTrainingJobStatusResponse'
description: OK description: OK
tags: tags:
- PostTraining - (Coming Soon) PostTraining
/alpha/post-training/jobs: /alpha/post-training/jobs:
get: get:
parameters: parameters:
@ -4425,7 +4425,7 @@ paths:
$ref: '#/components/schemas/PostTrainingJob' $ref: '#/components/schemas/PostTrainingJob'
description: OK description: OK
tags: tags:
- PostTraining - (Coming Soon) PostTraining
/alpha/post-training/preference-optimize: /alpha/post-training/preference-optimize:
post: post:
parameters: parameters:
@ -4450,7 +4450,7 @@ paths:
$ref: '#/components/schemas/PostTrainingJob' $ref: '#/components/schemas/PostTrainingJob'
description: OK description: OK
tags: tags:
- PostTraining - (Coming Soon) PostTraining
/alpha/post-training/supervised-fine-tune: /alpha/post-training/supervised-fine-tune:
post: post:
parameters: parameters:
@ -4475,7 +4475,7 @@ paths:
$ref: '#/components/schemas/PostTrainingJob' $ref: '#/components/schemas/PostTrainingJob'
description: OK description: OK
tags: tags:
- PostTraining - (Coming Soon) PostTraining
/alpha/providers/list: /alpha/providers/list:
get: get:
parameters: parameters:
@ -4755,7 +4755,7 @@ paths:
$ref: '#/components/schemas/SyntheticDataGenerationResponse' $ref: '#/components/schemas/SyntheticDataGenerationResponse'
description: OK description: OK
tags: tags:
- SyntheticDataGeneration - (Coming Soon) SyntheticDataGeneration
/alpha/telemetry/get-trace: /alpha/telemetry/get-trace:
get: get:
parameters: parameters:
@ -4806,6 +4806,9 @@ security:
servers: servers:
- url: http://any-hosted-llama-stack.com - url: http://any-hosted-llama-stack.com
tags: tags:
- name: (Coming Soon) BatchInference
- name: (Coming Soon) PostTraining
- name: (Coming Soon) SyntheticDataGeneration
- description: <SchemaDefinition schemaRef="#/components/schemas/AgentCandidate" /> - description: <SchemaDefinition schemaRef="#/components/schemas/AgentCandidate" />
name: AgentCandidate name: AgentCandidate
- description: <SchemaDefinition schemaRef="#/components/schemas/AgentConfig" /> - description: <SchemaDefinition schemaRef="#/components/schemas/AgentConfig" />
@ -4863,7 +4866,6 @@ tags:
- description: <SchemaDefinition schemaRef="#/components/schemas/BatchCompletionResponse" - description: <SchemaDefinition schemaRef="#/components/schemas/BatchCompletionResponse"
/> />
name: BatchCompletionResponse name: BatchCompletionResponse
- name: BatchInference
- description: <SchemaDefinition schemaRef="#/components/schemas/BenchmarkEvalTaskConfig" - description: <SchemaDefinition schemaRef="#/components/schemas/BenchmarkEvalTaskConfig"
/> />
name: BenchmarkEvalTaskConfig name: BenchmarkEvalTaskConfig
@ -5044,7 +5046,6 @@ tags:
- description: <SchemaDefinition schemaRef="#/components/schemas/PhotogenToolDefinition" - description: <SchemaDefinition schemaRef="#/components/schemas/PhotogenToolDefinition"
/> />
name: PhotogenToolDefinition name: PhotogenToolDefinition
- name: PostTraining
- description: <SchemaDefinition schemaRef="#/components/schemas/PostTrainingJob" - description: <SchemaDefinition schemaRef="#/components/schemas/PostTrainingJob"
/> />
name: PostTrainingJob name: PostTrainingJob
@ -5179,7 +5180,6 @@ tags:
- description: <SchemaDefinition schemaRef="#/components/schemas/SyntheticDataGenerateRequest" - description: <SchemaDefinition schemaRef="#/components/schemas/SyntheticDataGenerateRequest"
/> />
name: SyntheticDataGenerateRequest name: SyntheticDataGenerateRequest
- name: SyntheticDataGeneration
- description: 'Response from the synthetic data generation. Batch of (prompt, response, - description: 'Response from the synthetic data generation. Batch of (prompt, response,
score) tuples that pass the threshold. score) tuples that pass the threshold.
@ -5261,8 +5261,10 @@ tags:
x-tagGroups: x-tagGroups:
- name: Operations - name: Operations
tags: tags:
- (Coming Soon) BatchInference
- (Coming Soon) PostTraining
- (Coming Soon) SyntheticDataGeneration
- Agents - Agents
- BatchInference
- DatasetIO - DatasetIO
- Datasets - Datasets
- Eval - Eval
@ -5272,12 +5274,10 @@ x-tagGroups:
- Memory - Memory
- MemoryBanks - MemoryBanks
- Models - Models
- PostTraining
- Safety - Safety
- Scoring - Scoring
- ScoringFunctions - ScoringFunctions
- Shields - Shields
- SyntheticDataGeneration
- Telemetry - Telemetry
- name: Types - name: Types
tags: tags: