From 79e7253625529d68a4465ef045cece2d95de3125 Mon Sep 17 00:00:00 2001 From: Xi Yan Date: Mon, 10 Feb 2025 11:21:51 -0800 Subject: [PATCH] deprecation in OpenAPI spec --- docs/_static/llama-stack-spec.html | 178 ++++++++++-------- docs/_static/llama-stack-spec.yaml | 110 ++++++----- docs/openapi_generator/pyopenapi/generator.py | 6 +- .../pyopenapi/specification.py | 1 + llama_stack/apis/eval_tasks/eval_tasks.py | 5 + 5 files changed, 173 insertions(+), 127 deletions(-) diff --git a/docs/_static/llama-stack-spec.html b/docs/_static/llama-stack-spec.html index 6d3e5b93b..459071d3f 100644 --- a/docs/_static/llama-stack-spec.html +++ b/docs/_static/llama-stack-spec.html @@ -40,6 +40,28 @@ } ], "paths": { + "/v1/eval-tasks": { + "get": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ListEvalTasksResponse" + } + } + } + } + }, + "tags": [ + "EvalTasks" + ], + "description": "", + "parameters": [], + "deprecated": true + } + }, "/v1/datasetio/rows": { "get": { "responses": { @@ -2365,6 +2387,84 @@ "jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema", "components": { "schemas": { + "EvalTask": { + "type": "object", + "properties": { + "identifier": { + "type": "string" + }, + "provider_resource_id": { + "type": "string" + }, + "provider_id": { + "type": "string" + }, + "type": { + "type": "string", + "const": "eval_task", + "default": "eval_task" + }, + "dataset_id": { + "type": "string" + }, + "scoring_functions": { + "type": "array", + "items": { + "type": "string" + } + }, + "metadata": { + "type": "object", + "additionalProperties": { + "oneOf": [ + { + "type": "null" + }, + { + "type": "boolean" + }, + { + "type": "number" + }, + { + "type": "string" + }, + { + "type": "array" + }, + { + "type": "object" + } + ] + } + } + }, + "additionalProperties": false, + "required": [ + "identifier", + "provider_resource_id", + "provider_id", + "type", + "dataset_id", + "scoring_functions", + "metadata" + ] + }, + "ListEvalTasksResponse": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/EvalTask" + } + } + }, + "additionalProperties": false, + "required": [ + "data" + ] + }, "AppendRowsRequest": { "type": "object", "properties": { @@ -5208,69 +5308,6 @@ "type" ] }, - "EvalTask": { - "type": "object", - "properties": { - "identifier": { - "type": "string" - }, - "provider_resource_id": { - "type": "string" - }, - "provider_id": { - "type": "string" - }, - "type": { - "type": "string", - "const": "eval_task", - "default": "eval_task" - }, - "dataset_id": { - "type": "string" - }, - "scoring_functions": { - "type": "array", - "items": { - "type": "string" - } - }, - "metadata": { - "type": "object", - "additionalProperties": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "boolean" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "type": "array" - }, - { - "type": "object" - } - ] - } - } - }, - "additionalProperties": false, - "required": [ - "identifier", - "provider_resource_id", - "provider_id", - "type", - "dataset_id", - "scoring_functions", - "metadata" - ] - }, "Model": { "type": "object", "properties": { @@ -6164,21 +6201,6 @@ "data" ] }, - "ListEvalTasksResponse": { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/EvalTask" - } - } - }, - "additionalProperties": false, - "required": [ - "data" - ] - }, "ListModelsResponse": { "type": "object", "properties": { diff --git a/docs/_static/llama-stack-spec.yaml b/docs/_static/llama-stack-spec.yaml index aa25c88f8..b37f09ef8 100644 --- a/docs/_static/llama-stack-spec.yaml +++ b/docs/_static/llama-stack-spec.yaml @@ -10,6 +10,20 @@ info: servers: - url: http://any-hosted-llama-stack.com paths: + /v1/eval-tasks: + get: + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ListEvalTasksResponse' + tags: + - EvalTasks + description: '' + parameters: [] + deprecated: true /v1/datasetio/rows: get: responses: @@ -1429,6 +1443,54 @@ jsonSchemaDialect: >- https://json-schema.org/draft/2020-12/schema components: schemas: + EvalTask: + type: object + properties: + identifier: + type: string + provider_resource_id: + type: string + provider_id: + type: string + type: + type: string + const: eval_task + default: eval_task + dataset_id: + type: string + scoring_functions: + type: array + items: + type: string + metadata: + type: object + additionalProperties: + oneOf: + - type: 'null' + - type: boolean + - type: number + - type: string + - type: array + - type: object + additionalProperties: false + required: + - identifier + - provider_resource_id + - provider_id + - type + - dataset_id + - scoring_functions + - metadata + ListEvalTasksResponse: + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/EvalTask' + additionalProperties: false + required: + - data AppendRowsRequest: type: object properties: @@ -3354,44 +3416,6 @@ components: additionalProperties: false required: - type - EvalTask: - type: object - properties: - identifier: - type: string - provider_resource_id: - type: string - provider_id: - type: string - type: - type: string - const: eval_task - default: eval_task - dataset_id: - type: string - scoring_functions: - type: array - items: - type: string - metadata: - type: object - additionalProperties: - oneOf: - - type: 'null' - - type: boolean - - type: number - - type: string - - type: array - - type: object - additionalProperties: false - required: - - identifier - - provider_resource_id - - provider_id - - type - - dataset_id - - scoring_functions - - metadata Model: type: object properties: @@ -3930,16 +3954,6 @@ components: additionalProperties: false required: - data - ListEvalTasksResponse: - type: object - properties: - data: - type: array - items: - $ref: '#/components/schemas/EvalTask' - additionalProperties: false - required: - - data ListModelsResponse: type: object properties: diff --git a/docs/openapi_generator/pyopenapi/generator.py b/docs/openapi_generator/pyopenapi/generator.py index f0d30a0e6..86db8a06d 100644 --- a/docs/openapi_generator/pyopenapi/generator.py +++ b/docs/openapi_generator/pyopenapi/generator.py @@ -644,7 +644,10 @@ class Generator: else: callbacks = None - description = "\n".join(filter(None, [doc_string.short_description, doc_string.long_description])) + description = "\n".join( + filter(None, [doc_string.short_description, doc_string.long_description]) + ) + return Operation( tags=[op.defining_class.__name__], summary=None, @@ -654,6 +657,7 @@ class Generator: requestBody=requestBody, responses=responses, callbacks=callbacks, + deprecated=True if "DEPRECATED" in op.func_name else None, security=[] if op.public else None, ) diff --git a/docs/openapi_generator/pyopenapi/specification.py b/docs/openapi_generator/pyopenapi/specification.py index 4b54295c5..f96de58b6 100644 --- a/docs/openapi_generator/pyopenapi/specification.py +++ b/docs/openapi_generator/pyopenapi/specification.py @@ -117,6 +117,7 @@ class Operation: requestBody: Optional[RequestBody] = None callbacks: Optional[Dict[str, "Callback"]] = None security: Optional[List["SecurityRequirement"]] = None + deprecated: Optional[bool] = None @dataclass diff --git a/llama_stack/apis/eval_tasks/eval_tasks.py b/llama_stack/apis/eval_tasks/eval_tasks.py index 0a1a27885..9a26fd0c0 100644 --- a/llama_stack/apis/eval_tasks/eval_tasks.py +++ b/llama_stack/apis/eval_tasks/eval_tasks.py @@ -45,6 +45,11 @@ class ListEvalTasksResponse(BaseModel): @runtime_checkable class EvalTasks(Protocol): + @webmethod(route="/eval-tasks", method="GET") + async def DEPRECATED_list_eval_tasks_deprecated( + self, + ) -> ListEvalTasksResponse: ... + @webmethod(route="/eval/tasks", method="GET") async def list_eval_tasks(self) -> ListEvalTasksResponse: ...