feat(api): remove List* response types and nils for get/list

TODO:
- make sure docstrings are refreshed as needed.
- make sure this passes tests.
- address a TODO in code (obsolete comment?)
- make sure client side still works.
- analyze if any providers need adjustments.

Signed-off-by: Ihar Hrachyshka <ihar.hrachyshka@gmail.com>
This commit is contained in:
Ihar Hrachyshka 2025-03-14 10:25:59 -04:00
parent bfc79217a8
commit 90ed785fbd
21 changed files with 222 additions and 935 deletions

View file

@ -150,9 +150,9 @@
"200": { "200": {
"description": "OK", "description": "OK",
"content": { "content": {
"application/json": { "application/jsonl": {
"schema": { "schema": {
"$ref": "#/components/schemas/BatchChatCompletionResponse" "$ref": "#/components/schemas/ChatCompletionResponse"
} }
} }
} }
@ -193,9 +193,9 @@
"200": { "200": {
"description": "OK", "description": "OK",
"content": { "content": {
"application/json": { "application/jsonl": {
"schema": { "schema": {
"$ref": "#/components/schemas/BatchCompletionResponse" "$ref": "#/components/schemas/CompletionResponse"
} }
} }
} }
@ -366,11 +366,11 @@
"get": { "get": {
"responses": { "responses": {
"200": { "200": {
"description": "A ListAgentsResponse.", "description": "a list of Agents.",
"content": { "content": {
"application/json": { "application/jsonl": {
"schema": { "schema": {
"$ref": "#/components/schemas/ListAgentsResponse" "$ref": "#/components/schemas/Agent"
} }
} }
} }
@ -562,9 +562,9 @@
"200": { "200": {
"description": "OK", "description": "OK",
"content": { "content": {
"application/json": { "application/jsonl": {
"schema": { "schema": {
"$ref": "#/components/schemas/ListBucketResponse" "$ref": "#/components/schemas/Bucket"
} }
} }
} }
@ -604,7 +604,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"$ref": "#/components/schemas/FileUploadResponse" "$ref": "#/components/schemas/FileUpload"
} }
} }
} }
@ -831,7 +831,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"$ref": "#/components/schemas/FileResponse" "$ref": "#/components/schemas/File"
} }
} }
} }
@ -881,7 +881,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"$ref": "#/components/schemas/FileResponse" "$ref": "#/components/schemas/File"
} }
} }
} }
@ -1160,14 +1160,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"oneOf": [ "$ref": "#/components/schemas/Benchmark"
{
"$ref": "#/components/schemas/Benchmark"
},
{
"type": "null"
}
]
} }
} }
} }
@ -1209,14 +1202,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"oneOf": [ "$ref": "#/components/schemas/Dataset"
{
"$ref": "#/components/schemas/Dataset"
},
{
"type": "null"
}
]
} }
} }
} }
@ -1291,14 +1277,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"oneOf": [ "$ref": "#/components/schemas/Model"
{
"$ref": "#/components/schemas/Model"
},
{
"type": "null"
}
]
} }
} }
} }
@ -1373,14 +1352,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"oneOf": [ "$ref": "#/components/schemas/ScoringFn"
{
"$ref": "#/components/schemas/ScoringFn"
},
{
"type": "null"
}
]
} }
} }
} }
@ -1422,14 +1394,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"oneOf": [ "$ref": "#/components/schemas/Shield"
{
"$ref": "#/components/schemas/Shield"
},
{
"type": "null"
}
]
} }
} }
} }
@ -1732,14 +1697,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"oneOf": [ "$ref": "#/components/schemas/PostTrainingJobArtifactsResponse"
{
"$ref": "#/components/schemas/PostTrainingJobArtifactsResponse"
},
{
"type": "null"
}
]
} }
} }
} }
@ -1781,14 +1739,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"oneOf": [ "$ref": "#/components/schemas/PostTrainingJobStatusResponse"
{
"$ref": "#/components/schemas/PostTrainingJobStatusResponse"
},
{
"type": "null"
}
]
} }
} }
} }
@ -1828,9 +1779,9 @@
"200": { "200": {
"description": "OK", "description": "OK",
"content": { "content": {
"application/json": { "application/jsonl": {
"schema": { "schema": {
"$ref": "#/components/schemas/ListPostTrainingJobsResponse" "$ref": "#/components/schemas/PostTrainingJob"
} }
} }
} }
@ -1863,14 +1814,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"oneOf": [ "$ref": "#/components/schemas/FileUpload"
{
"$ref": "#/components/schemas/FileUploadResponse"
},
{
"type": "null"
}
]
} }
} }
} }
@ -1911,14 +1855,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"oneOf": [ "$ref": "#/components/schemas/File"
{
"$ref": "#/components/schemas/FileResponse"
},
{
"type": "null"
}
]
} }
} }
} }
@ -1972,14 +1909,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"oneOf": [ "$ref": "#/components/schemas/VectorDB"
{
"$ref": "#/components/schemas/VectorDB"
},
{
"type": "null"
}
]
} }
} }
} }
@ -2244,14 +2174,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"oneOf": [ "$ref": "#/components/schemas/JobStatus"
{
"$ref": "#/components/schemas/JobStatus"
},
{
"type": "null"
}
]
} }
} }
} }
@ -2394,11 +2317,11 @@
"get": { "get": {
"responses": { "responses": {
"200": { "200": {
"description": "A ListAgentSessionsResponse.", "description": "A list of agent Sessions.",
"content": { "content": {
"application/json": { "application/jsonl": {
"schema": { "schema": {
"$ref": "#/components/schemas/ListAgentSessionsResponse" "$ref": "#/components/schemas/Session"
} }
} }
} }
@ -2439,9 +2362,9 @@
"200": { "200": {
"description": "OK", "description": "OK",
"content": { "content": {
"application/json": { "application/jsonl": {
"schema": { "schema": {
"$ref": "#/components/schemas/ListBenchmarksResponse" "$ref": "#/components/schemas/Benchmark"
} }
} }
} }
@ -2506,9 +2429,9 @@
"200": { "200": {
"description": "OK", "description": "OK",
"content": { "content": {
"application/json": { "application/jsonl": {
"schema": { "schema": {
"$ref": "#/components/schemas/ListDatasetsResponse" "$ref": "#/components/schemas/Dataset"
} }
} }
} }
@ -2573,9 +2496,9 @@
"200": { "200": {
"description": "OK", "description": "OK",
"content": { "content": {
"application/json": { "application/jsonl": {
"schema": { "schema": {
"$ref": "#/components/schemas/ListFileResponse" "$ref": "#/components/schemas/File"
} }
} }
} }
@ -2616,9 +2539,9 @@
"200": { "200": {
"description": "OK", "description": "OK",
"content": { "content": {
"application/json": { "application/jsonl": {
"schema": { "schema": {
"$ref": "#/components/schemas/ListModelsResponse" "$ref": "#/components/schemas/Model"
} }
} }
} }
@ -2690,9 +2613,9 @@
"200": { "200": {
"description": "OK", "description": "OK",
"content": { "content": {
"application/json": { "application/jsonl": {
"schema": { "schema": {
"$ref": "#/components/schemas/ListProvidersResponse" "$ref": "#/components/schemas/ProviderInfo"
} }
} }
} }
@ -2723,9 +2646,9 @@
"200": { "200": {
"description": "OK", "description": "OK",
"content": { "content": {
"application/json": { "application/jsonl": {
"schema": { "schema": {
"$ref": "#/components/schemas/ListRoutesResponse" "$ref": "#/components/schemas/RouteInfo"
} }
} }
} }
@ -2806,9 +2729,9 @@
"200": { "200": {
"description": "OK", "description": "OK",
"content": { "content": {
"application/json": { "application/jsonl": {
"schema": { "schema": {
"$ref": "#/components/schemas/ListScoringFunctionsResponse" "$ref": "#/components/schemas/ScoringFn"
} }
} }
} }
@ -2873,9 +2796,9 @@
"200": { "200": {
"description": "OK", "description": "OK",
"content": { "content": {
"application/json": { "application/jsonl": {
"schema": { "schema": {
"$ref": "#/components/schemas/ListShieldsResponse" "$ref": "#/components/schemas/Shield"
} }
} }
} }
@ -2947,9 +2870,9 @@
"200": { "200": {
"description": "OK", "description": "OK",
"content": { "content": {
"application/json": { "application/jsonl": {
"schema": { "schema": {
"$ref": "#/components/schemas/ListToolGroupsResponse" "$ref": "#/components/schemas/ToolGroup"
} }
} }
} }
@ -3014,9 +2937,9 @@
"200": { "200": {
"description": "OK", "description": "OK",
"content": { "content": {
"application/json": { "application/jsonl": {
"schema": { "schema": {
"$ref": "#/components/schemas/ListToolsResponse" "$ref": "#/components/schemas/Tool"
} }
} }
} }
@ -3056,9 +2979,9 @@
"200": { "200": {
"description": "OK", "description": "OK",
"content": { "content": {
"application/json": { "application/jsonl": {
"schema": { "schema": {
"$ref": "#/components/schemas/ListVectorDBsResponse" "$ref": "#/components/schemas/VectorDB"
} }
} }
} }
@ -3085,14 +3008,7 @@
"post": { "post": {
"responses": { "responses": {
"200": { "200": {
"description": "OK", "description": "OK"
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/VectorDB"
}
}
}
}, },
"400": { "400": {
"$ref": "#/components/responses/BadRequest400" "$ref": "#/components/responses/BadRequest400"
@ -4550,22 +4466,6 @@
], ],
"title": "BatchChatCompletionRequest" "title": "BatchChatCompletionRequest"
}, },
"BatchChatCompletionResponse": {
"type": "object",
"properties": {
"batch": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ChatCompletionResponse"
}
}
},
"additionalProperties": false,
"required": [
"batch"
],
"title": "BatchChatCompletionResponse"
},
"ChatCompletionResponse": { "ChatCompletionResponse": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -4677,22 +4577,6 @@
], ],
"title": "BatchCompletionRequest" "title": "BatchCompletionRequest"
}, },
"BatchCompletionResponse": {
"type": "object",
"properties": {
"batch": {
"type": "array",
"items": {
"$ref": "#/components/schemas/CompletionResponse"
}
}
},
"additionalProperties": false,
"required": [
"batch"
],
"title": "BatchCompletionResponse"
},
"CompletionResponse": { "CompletionResponse": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -6154,7 +6038,7 @@
], ],
"title": "CreateUploadSessionRequest" "title": "CreateUploadSessionRequest"
}, },
"FileUploadResponse": { "FileUpload": {
"type": "object", "type": "object",
"properties": { "properties": {
"id": { "id": {
@ -6181,10 +6065,10 @@
"offset", "offset",
"size" "size"
], ],
"title": "FileUploadResponse", "title": "FileUpload",
"description": "Response after initiating a file upload session." "description": "Response after initiating a file upload session."
}, },
"FileResponse": { "File": {
"type": "object", "type": "object",
"properties": { "properties": {
"bucket": { "bucket": {
@ -6221,7 +6105,7 @@
"bytes", "bytes",
"created_at" "created_at"
], ],
"title": "FileResponse", "title": "File",
"description": "Response representing a file entry." "description": "Response representing a file entry."
}, },
"EmbeddingsRequest": { "EmbeddingsRequest": {
@ -7735,31 +7619,18 @@
"title": "PostTrainingJobStatusResponse", "title": "PostTrainingJobStatusResponse",
"description": "Status of a finetuning job." "description": "Status of a finetuning job."
}, },
"ListPostTrainingJobsResponse": { "PostTrainingJob": {
"type": "object", "type": "object",
"properties": { "properties": {
"data": { "job_uuid": {
"type": "array", "type": "string"
"items": {
"type": "object",
"properties": {
"job_uuid": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"job_uuid"
],
"title": "PostTrainingJob"
}
} }
}, },
"additionalProperties": false, "additionalProperties": false,
"required": [ "required": [
"data" "job_uuid"
], ],
"title": "ListPostTrainingJobsResponse" "title": "PostTrainingJob"
}, },
"VectorDB": { "VectorDB": {
"type": "object", "type": "object",
@ -8084,39 +7955,7 @@
], ],
"title": "ToolInvocationResult" "title": "ToolInvocationResult"
}, },
"ListAgentSessionsResponse": { "Bucket": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Session"
}
}
},
"additionalProperties": false,
"required": [
"data"
],
"title": "ListAgentSessionsResponse"
},
"ListAgentsResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Agent"
}
}
},
"additionalProperties": false,
"required": [
"data"
],
"title": "ListAgentsResponse"
},
"BucketResponse": {
"type": "object", "type": "object",
"properties": { "properties": {
"name": { "name": {
@ -8127,107 +7966,7 @@
"required": [ "required": [
"name" "name"
], ],
"title": "BucketResponse" "title": "Bucket"
},
"ListBucketResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/BucketResponse"
},
"description": "List of FileResponse entries"
}
},
"additionalProperties": false,
"required": [
"data"
],
"title": "ListBucketResponse",
"description": "Response representing a list of file entries."
},
"ListBenchmarksResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Benchmark"
}
}
},
"additionalProperties": false,
"required": [
"data"
],
"title": "ListBenchmarksResponse"
},
"ListDatasetsResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Dataset"
}
}
},
"additionalProperties": false,
"required": [
"data"
],
"title": "ListDatasetsResponse"
},
"ListFileResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/FileResponse"
},
"description": "List of FileResponse entries"
}
},
"additionalProperties": false,
"required": [
"data"
],
"title": "ListFileResponse",
"description": "Response representing a list of file entries."
},
"ListModelsResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Model"
}
}
},
"additionalProperties": false,
"required": [
"data"
],
"title": "ListModelsResponse"
},
"ListProvidersResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ProviderInfo"
}
}
},
"additionalProperties": false,
"required": [
"data"
],
"title": "ListProvidersResponse"
}, },
"RouteInfo": { "RouteInfo": {
"type": "object", "type": "object",
@ -8253,102 +7992,6 @@
], ],
"title": "RouteInfo" "title": "RouteInfo"
}, },
"ListRoutesResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/RouteInfo"
}
}
},
"additionalProperties": false,
"required": [
"data"
],
"title": "ListRoutesResponse"
},
"ListScoringFunctionsResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ScoringFn"
}
}
},
"additionalProperties": false,
"required": [
"data"
],
"title": "ListScoringFunctionsResponse"
},
"ListShieldsResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Shield"
}
}
},
"additionalProperties": false,
"required": [
"data"
],
"title": "ListShieldsResponse"
},
"ListToolGroupsResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ToolGroup"
}
}
},
"additionalProperties": false,
"required": [
"data"
],
"title": "ListToolGroupsResponse"
},
"ListToolsResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Tool"
}
}
},
"additionalProperties": false,
"required": [
"data"
],
"title": "ListToolsResponse"
},
"ListVectorDBsResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/VectorDB"
}
}
},
"additionalProperties": false,
"required": [
"data"
],
"title": "ListVectorDBsResponse"
},
"Event": { "Event": {
"oneOf": [ "oneOf": [
{ {
@ -8881,19 +8524,6 @@
], ],
"title": "PreferenceOptimizeRequest" "title": "PreferenceOptimizeRequest"
}, },
"PostTrainingJob": {
"type": "object",
"properties": {
"job_uuid": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"job_uuid"
],
"title": "PostTrainingJob"
},
"DefaultRAGQueryGeneratorConfig": { "DefaultRAGQueryGeneratorConfig": {
"type": "object", "type": "object",
"properties": { "properties": {

View file

@ -90,9 +90,9 @@ paths:
'200': '200':
description: OK description: OK
content: content:
application/json: application/jsonl:
schema: schema:
$ref: '#/components/schemas/BatchChatCompletionResponse' $ref: '#/components/schemas/ChatCompletionResponse'
'400': '400':
$ref: '#/components/responses/BadRequest400' $ref: '#/components/responses/BadRequest400'
'429': '429':
@ -119,9 +119,9 @@ paths:
'200': '200':
description: OK description: OK
content: content:
application/json: application/jsonl:
schema: schema:
$ref: '#/components/schemas/BatchCompletionResponse' $ref: '#/components/schemas/CompletionResponse'
'400': '400':
$ref: '#/components/responses/BadRequest400' $ref: '#/components/responses/BadRequest400'
'429': '429':
@ -241,11 +241,11 @@ paths:
get: get:
responses: responses:
'200': '200':
description: A ListAgentsResponse. description: a list of Agents.
content: content:
application/json: application/jsonl:
schema: schema:
$ref: '#/components/schemas/ListAgentsResponse' $ref: '#/components/schemas/Agent'
'400': '400':
$ref: '#/components/responses/BadRequest400' $ref: '#/components/responses/BadRequest400'
'429': '429':
@ -380,9 +380,9 @@ paths:
'200': '200':
description: OK description: OK
content: content:
application/json: application/jsonl:
schema: schema:
$ref: '#/components/schemas/ListBucketResponse' $ref: '#/components/schemas/Bucket'
'400': '400':
$ref: '#/components/responses/BadRequest400' $ref: '#/components/responses/BadRequest400'
'429': '429':
@ -409,7 +409,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/FileUploadResponse' $ref: '#/components/schemas/FileUpload'
'400': '400':
$ref: '#/components/responses/BadRequest400' $ref: '#/components/responses/BadRequest400'
'429': '429':
@ -568,7 +568,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/FileResponse' $ref: '#/components/schemas/File'
'400': '400':
$ref: '#/components/responses/BadRequest400' $ref: '#/components/responses/BadRequest400'
'429': '429':
@ -604,7 +604,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/FileResponse' $ref: '#/components/schemas/File'
'400': '400':
$ref: '#/components/responses/BadRequest400' $ref: '#/components/responses/BadRequest400'
'429': '429':
@ -801,9 +801,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
oneOf: $ref: '#/components/schemas/Benchmark'
- $ref: '#/components/schemas/Benchmark'
- type: 'null'
'400': '400':
$ref: '#/components/responses/BadRequest400' $ref: '#/components/responses/BadRequest400'
'429': '429':
@ -831,9 +829,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
oneOf: $ref: '#/components/schemas/Dataset'
- $ref: '#/components/schemas/Dataset'
- type: 'null'
'400': '400':
$ref: '#/components/responses/BadRequest400' $ref: '#/components/responses/BadRequest400'
'429': '429':
@ -884,9 +880,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
oneOf: $ref: '#/components/schemas/Model'
- $ref: '#/components/schemas/Model'
- type: 'null'
'400': '400':
$ref: '#/components/responses/BadRequest400' $ref: '#/components/responses/BadRequest400'
'429': '429':
@ -937,9 +931,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
oneOf: $ref: '#/components/schemas/ScoringFn'
- $ref: '#/components/schemas/ScoringFn'
- type: 'null'
'400': '400':
$ref: '#/components/responses/BadRequest400' $ref: '#/components/responses/BadRequest400'
'429': '429':
@ -967,9 +959,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
oneOf: $ref: '#/components/schemas/Shield'
- $ref: '#/components/schemas/Shield'
- type: 'null'
'400': '400':
$ref: '#/components/responses/BadRequest400' $ref: '#/components/responses/BadRequest400'
'429': '429':
@ -1171,9 +1161,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
oneOf: $ref: '#/components/schemas/PostTrainingJobArtifactsResponse'
- $ref: '#/components/schemas/PostTrainingJobArtifactsResponse'
- type: 'null'
'400': '400':
$ref: '#/components/responses/BadRequest400' $ref: '#/components/responses/BadRequest400'
'429': '429':
@ -1201,9 +1189,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
oneOf: $ref: '#/components/schemas/PostTrainingJobStatusResponse'
- $ref: '#/components/schemas/PostTrainingJobStatusResponse'
- type: 'null'
'400': '400':
$ref: '#/components/responses/BadRequest400' $ref: '#/components/responses/BadRequest400'
'429': '429':
@ -1229,9 +1215,9 @@ paths:
'200': '200':
description: OK description: OK
content: content:
application/json: application/jsonl:
schema: schema:
$ref: '#/components/schemas/ListPostTrainingJobsResponse' $ref: '#/components/schemas/PostTrainingJob'
'400': '400':
$ref: '#/components/responses/BadRequest400' $ref: '#/components/responses/BadRequest400'
'429': '429':
@ -1254,9 +1240,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
oneOf: $ref: '#/components/schemas/FileUpload'
- $ref: '#/components/schemas/FileUploadResponse'
- type: 'null'
'400': '400':
$ref: '#/components/responses/BadRequest400' $ref: '#/components/responses/BadRequest400'
'429': '429':
@ -1285,9 +1269,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
oneOf: $ref: '#/components/schemas/File'
- $ref: '#/components/schemas/FileResponse'
- type: 'null'
'400': '400':
$ref: '#/components/responses/BadRequest400' $ref: '#/components/responses/BadRequest400'
'429': '429':
@ -1325,9 +1307,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
oneOf: $ref: '#/components/schemas/VectorDB'
- $ref: '#/components/schemas/VectorDB'
- type: 'null'
'400': '400':
$ref: '#/components/responses/BadRequest400' $ref: '#/components/responses/BadRequest400'
'429': '429':
@ -1509,9 +1489,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
oneOf: $ref: '#/components/schemas/JobStatus'
- $ref: '#/components/schemas/JobStatus'
- type: 'null'
'400': '400':
$ref: '#/components/responses/BadRequest400' $ref: '#/components/responses/BadRequest400'
'429': '429':
@ -1610,11 +1588,11 @@ paths:
get: get:
responses: responses:
'200': '200':
description: A ListAgentSessionsResponse. description: A list of agent Sessions.
content: content:
application/json: application/jsonl:
schema: schema:
$ref: '#/components/schemas/ListAgentSessionsResponse' $ref: '#/components/schemas/Session'
'400': '400':
$ref: '#/components/responses/BadRequest400' $ref: '#/components/responses/BadRequest400'
'429': '429':
@ -1642,9 +1620,9 @@ paths:
'200': '200':
description: OK description: OK
content: content:
application/json: application/jsonl:
schema: schema:
$ref: '#/components/schemas/ListBenchmarksResponse' $ref: '#/components/schemas/Benchmark'
'400': '400':
$ref: '#/components/responses/BadRequest400' $ref: '#/components/responses/BadRequest400'
'429': '429':
@ -1689,9 +1667,9 @@ paths:
'200': '200':
description: OK description: OK
content: content:
application/json: application/jsonl:
schema: schema:
$ref: '#/components/schemas/ListDatasetsResponse' $ref: '#/components/schemas/Dataset'
'400': '400':
$ref: '#/components/responses/BadRequest400' $ref: '#/components/responses/BadRequest400'
'429': '429':
@ -1736,9 +1714,9 @@ paths:
'200': '200':
description: OK description: OK
content: content:
application/json: application/jsonl:
schema: schema:
$ref: '#/components/schemas/ListFileResponse' $ref: '#/components/schemas/File'
'400': '400':
$ref: '#/components/responses/BadRequest400' $ref: '#/components/responses/BadRequest400'
'429': '429':
@ -1765,9 +1743,9 @@ paths:
'200': '200':
description: OK description: OK
content: content:
application/json: application/jsonl:
schema: schema:
$ref: '#/components/schemas/ListModelsResponse' $ref: '#/components/schemas/Model'
'400': '400':
$ref: '#/components/responses/BadRequest400' $ref: '#/components/responses/BadRequest400'
'429': '429':
@ -1816,9 +1794,9 @@ paths:
'200': '200':
description: OK description: OK
content: content:
application/json: application/jsonl:
schema: schema:
$ref: '#/components/schemas/ListProvidersResponse' $ref: '#/components/schemas/ProviderInfo'
'400': '400':
$ref: '#/components/responses/BadRequest400' $ref: '#/components/responses/BadRequest400'
'429': '429':
@ -1839,9 +1817,9 @@ paths:
'200': '200':
description: OK description: OK
content: content:
application/json: application/jsonl:
schema: schema:
$ref: '#/components/schemas/ListRoutesResponse' $ref: '#/components/schemas/RouteInfo'
'400': '400':
$ref: '#/components/responses/BadRequest400' $ref: '#/components/responses/BadRequest400'
'429': '429':
@ -1895,9 +1873,9 @@ paths:
'200': '200':
description: OK description: OK
content: content:
application/json: application/jsonl:
schema: schema:
$ref: '#/components/schemas/ListScoringFunctionsResponse' $ref: '#/components/schemas/ScoringFn'
'400': '400':
$ref: '#/components/responses/BadRequest400' $ref: '#/components/responses/BadRequest400'
'429': '429':
@ -1942,9 +1920,9 @@ paths:
'200': '200':
description: OK description: OK
content: content:
application/json: application/jsonl:
schema: schema:
$ref: '#/components/schemas/ListShieldsResponse' $ref: '#/components/schemas/Shield'
'400': '400':
$ref: '#/components/responses/BadRequest400' $ref: '#/components/responses/BadRequest400'
'429': '429':
@ -1993,9 +1971,9 @@ paths:
'200': '200':
description: OK description: OK
content: content:
application/json: application/jsonl:
schema: schema:
$ref: '#/components/schemas/ListToolGroupsResponse' $ref: '#/components/schemas/ToolGroup'
'400': '400':
$ref: '#/components/responses/BadRequest400' $ref: '#/components/responses/BadRequest400'
'429': '429':
@ -2040,9 +2018,9 @@ paths:
'200': '200':
description: OK description: OK
content: content:
application/json: application/jsonl:
schema: schema:
$ref: '#/components/schemas/ListToolsResponse' $ref: '#/components/schemas/Tool'
'400': '400':
$ref: '#/components/responses/BadRequest400' $ref: '#/components/responses/BadRequest400'
'429': '429':
@ -2068,9 +2046,9 @@ paths:
'200': '200':
description: OK description: OK
content: content:
application/json: application/jsonl:
schema: schema:
$ref: '#/components/schemas/ListVectorDBsResponse' $ref: '#/components/schemas/VectorDB'
'400': '400':
$ref: '#/components/responses/BadRequest400' $ref: '#/components/responses/BadRequest400'
'429': '429':
@ -2089,10 +2067,6 @@ paths:
responses: responses:
'200': '200':
description: OK description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/VectorDB'
'400': '400':
$ref: '#/components/responses/BadRequest400' $ref: '#/components/responses/BadRequest400'
'429': '429':
@ -3100,17 +3074,6 @@ components:
- model - model
- messages_batch - messages_batch
title: BatchChatCompletionRequest title: BatchChatCompletionRequest
BatchChatCompletionResponse:
type: object
properties:
batch:
type: array
items:
$ref: '#/components/schemas/ChatCompletionResponse'
additionalProperties: false
required:
- batch
title: BatchChatCompletionResponse
ChatCompletionResponse: ChatCompletionResponse:
type: object type: object
properties: properties:
@ -3190,17 +3153,6 @@ components:
- model - model
- content_batch - content_batch
title: BatchCompletionRequest title: BatchCompletionRequest
BatchCompletionResponse:
type: object
properties:
batch:
type: array
items:
$ref: '#/components/schemas/CompletionResponse'
additionalProperties: false
required:
- batch
title: BatchCompletionResponse
CompletionResponse: CompletionResponse:
type: object type: object
properties: properties:
@ -4260,7 +4212,7 @@ components:
- mime_type - mime_type
- size - size
title: CreateUploadSessionRequest title: CreateUploadSessionRequest
FileUploadResponse: FileUpload:
type: object type: object
properties: properties:
id: id:
@ -4281,10 +4233,10 @@ components:
- url - url
- offset - offset
- size - size
title: FileUploadResponse title: FileUpload
description: >- description: >-
Response after initiating a file upload session. Response after initiating a file upload session.
FileResponse: File:
type: object type: object
properties: properties:
bucket: bucket:
@ -4315,7 +4267,7 @@ components:
- url - url
- bytes - bytes
- created_at - created_at
title: FileResponse title: File
description: Response representing a file entry. description: Response representing a file entry.
EmbeddingsRequest: EmbeddingsRequest:
type: object type: object
@ -5302,24 +5254,15 @@ components:
- checkpoints - checkpoints
title: PostTrainingJobStatusResponse title: PostTrainingJobStatusResponse
description: Status of a finetuning job. description: Status of a finetuning job.
ListPostTrainingJobsResponse: PostTrainingJob:
type: object type: object
properties: properties:
data: job_uuid:
type: array type: string
items:
type: object
properties:
job_uuid:
type: string
additionalProperties: false
required:
- job_uuid
title: PostTrainingJob
additionalProperties: false additionalProperties: false
required: required:
- data - job_uuid
title: ListPostTrainingJobsResponse title: PostTrainingJob
VectorDB: VectorDB:
type: object type: object
properties: properties:
@ -5506,29 +5449,7 @@ components:
required: required:
- content - content
title: ToolInvocationResult title: ToolInvocationResult
ListAgentSessionsResponse: Bucket:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/Session'
additionalProperties: false
required:
- data
title: ListAgentSessionsResponse
ListAgentsResponse:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/Agent'
additionalProperties: false
required:
- data
title: ListAgentsResponse
BucketResponse:
type: object type: object
properties: properties:
name: name:
@ -5536,79 +5457,7 @@ components:
additionalProperties: false additionalProperties: false
required: required:
- name - name
title: BucketResponse title: Bucket
ListBucketResponse:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/BucketResponse'
description: List of FileResponse entries
additionalProperties: false
required:
- data
title: ListBucketResponse
description: >-
Response representing a list of file entries.
ListBenchmarksResponse:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/Benchmark'
additionalProperties: false
required:
- data
title: ListBenchmarksResponse
ListDatasetsResponse:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/Dataset'
additionalProperties: false
required:
- data
title: ListDatasetsResponse
ListFileResponse:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/FileResponse'
description: List of FileResponse entries
additionalProperties: false
required:
- data
title: ListFileResponse
description: >-
Response representing a list of file entries.
ListModelsResponse:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/Model'
additionalProperties: false
required:
- data
title: ListModelsResponse
ListProvidersResponse:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/ProviderInfo'
additionalProperties: false
required:
- data
title: ListProvidersResponse
RouteInfo: RouteInfo:
type: object type: object
properties: properties:
@ -5626,72 +5475,6 @@ components:
- method - method
- provider_types - provider_types
title: RouteInfo title: RouteInfo
ListRoutesResponse:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/RouteInfo'
additionalProperties: false
required:
- data
title: ListRoutesResponse
ListScoringFunctionsResponse:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/ScoringFn'
additionalProperties: false
required:
- data
title: ListScoringFunctionsResponse
ListShieldsResponse:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/Shield'
additionalProperties: false
required:
- data
title: ListShieldsResponse
ListToolGroupsResponse:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/ToolGroup'
additionalProperties: false
required:
- data
title: ListToolGroupsResponse
ListToolsResponse:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/Tool'
additionalProperties: false
required:
- data
title: ListToolsResponse
ListVectorDBsResponse:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/VectorDB'
additionalProperties: false
required:
- data
title: ListVectorDBsResponse
Event: Event:
oneOf: oneOf:
- $ref: '#/components/schemas/UnstructuredLogEvent' - $ref: '#/components/schemas/UnstructuredLogEvent'
@ -6035,15 +5818,6 @@ components:
- hyperparam_search_config - hyperparam_search_config
- logger_config - logger_config
title: PreferenceOptimizeRequest title: PreferenceOptimizeRequest
PostTrainingJob:
type: object
properties:
job_uuid:
type: string
additionalProperties: false
required:
- job_uuid
title: PostTrainingJob
DefaultRAGQueryGeneratorConfig: DefaultRAGQueryGeneratorConfig:
type: object type: object
properties: properties:

View file

@ -241,16 +241,6 @@ class Agent(BaseModel):
created_at: datetime created_at: datetime
@json_schema_type
class ListAgentsResponse(BaseModel):
data: List[Agent]
@json_schema_type
class ListAgentSessionsResponse(BaseModel):
data: List[Session]
class AgentConfigOverridablePerTurn(AgentConfigCommon): class AgentConfigOverridablePerTurn(AgentConfigCommon):
instructions: Optional[str] = None instructions: Optional[str] = None
@ -559,10 +549,10 @@ class Agents(Protocol):
... ...
@webmethod(route="/agents", method="GET") @webmethod(route="/agents", method="GET")
async def list_agents(self) -> ListAgentsResponse: async def list_agents(self) -> list[Agent]:
"""List all agents. """List all agents.
:returns: A ListAgentsResponse. :returns: a list of Agents.
""" """
... ...
@ -579,10 +569,10 @@ class Agents(Protocol):
async def list_agent_sessions( async def list_agent_sessions(
self, self,
agent_id: str, agent_id: str,
) -> ListAgentSessionsResponse: ) -> list[Session]:
"""List all session(s) of a given agent. """List all session(s) of a given agent.
:param agent_id: The ID of the agent to list sessions for. :param agent_id: The ID of the agent to list sessions for.
:returns: A ListAgentSessionsResponse. :returns: A list of agent Sessions.
""" """
... ...

View file

@ -6,8 +6,6 @@
from typing import List, Optional, Protocol, runtime_checkable from typing import List, Optional, Protocol, runtime_checkable
from pydantic import BaseModel
from llama_stack.apis.inference import ( from llama_stack.apis.inference import (
ChatCompletionResponse, ChatCompletionResponse,
CompletionResponse, CompletionResponse,
@ -20,17 +18,7 @@ from llama_stack.apis.inference import (
ToolDefinition, ToolDefinition,
ToolPromptFormat, ToolPromptFormat,
) )
from llama_stack.schema_utils import json_schema_type, webmethod from llama_stack.schema_utils import webmethod
@json_schema_type
class BatchCompletionResponse(BaseModel):
batch: List[CompletionResponse]
@json_schema_type
class BatchChatCompletionResponse(BaseModel):
batch: List[ChatCompletionResponse]
@runtime_checkable @runtime_checkable
@ -43,7 +31,7 @@ class BatchInference(Protocol):
sampling_params: Optional[SamplingParams] = None, sampling_params: Optional[SamplingParams] = None,
response_format: Optional[ResponseFormat] = None, response_format: Optional[ResponseFormat] = None,
logprobs: Optional[LogProbConfig] = None, logprobs: Optional[LogProbConfig] = None,
) -> BatchCompletionResponse: ... ) -> list[CompletionResponse]: ...
@webmethod(route="/batch-inference/chat-completion", method="POST") @webmethod(route="/batch-inference/chat-completion", method="POST")
async def batch_chat_completion( async def batch_chat_completion(
@ -57,4 +45,4 @@ class BatchInference(Protocol):
tool_prompt_format: Optional[ToolPromptFormat] = None, tool_prompt_format: Optional[ToolPromptFormat] = None,
response_format: Optional[ResponseFormat] = None, response_format: Optional[ResponseFormat] = None,
logprobs: Optional[LogProbConfig] = None, logprobs: Optional[LogProbConfig] = None,
) -> BatchChatCompletionResponse: ... ) -> list[ChatCompletionResponse]: ...

View file

@ -39,20 +39,16 @@ class BenchmarkInput(CommonBenchmarkFields, BaseModel):
provider_benchmark_id: Optional[str] = None provider_benchmark_id: Optional[str] = None
class ListBenchmarksResponse(BaseModel):
data: List[Benchmark]
@runtime_checkable @runtime_checkable
class Benchmarks(Protocol): class Benchmarks(Protocol):
@webmethod(route="/eval/benchmarks", method="GET") @webmethod(route="/eval/benchmarks", method="GET")
async def list_benchmarks(self) -> ListBenchmarksResponse: ... async def list_benchmarks(self) -> list[Benchmark]: ...
@webmethod(route="/eval/benchmarks/{benchmark_id}", method="GET") @webmethod(route="/eval/benchmarks/{benchmark_id}", method="GET")
async def get_benchmark( async def get_benchmark(
self, self,
benchmark_id: str, benchmark_id: str,
) -> Optional[Benchmark]: ... ) -> Benchmark: ...
@webmethod(route="/eval/benchmarks", method="POST") @webmethod(route="/eval/benchmarks", method="POST")
async def register_benchmark( async def register_benchmark(

View file

@ -4,7 +4,7 @@
# This source code is licensed under the terms described in the LICENSE file in # This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree. # the root directory of this source tree.
from typing import Any, Dict, List, Literal, Optional, Protocol from typing import Any, Dict, Literal, Optional, Protocol
from pydantic import BaseModel, Field from pydantic import BaseModel, Field
@ -42,10 +42,6 @@ class DatasetInput(CommonDatasetFields, BaseModel):
provider_dataset_id: Optional[str] = None provider_dataset_id: Optional[str] = None
class ListDatasetsResponse(BaseModel):
data: List[Dataset]
class Datasets(Protocol): class Datasets(Protocol):
@webmethod(route="/datasets", method="POST") @webmethod(route="/datasets", method="POST")
async def register_dataset( async def register_dataset(
@ -62,10 +58,10 @@ class Datasets(Protocol):
async def get_dataset( async def get_dataset(
self, self,
dataset_id: str, dataset_id: str,
) -> Optional[Dataset]: ... ) -> Dataset: ...
@webmethod(route="/datasets", method="GET") @webmethod(route="/datasets", method="GET")
async def list_datasets(self) -> ListDatasetsResponse: ... async def list_datasets(self) -> list[Dataset]: ...
@webmethod(route="/datasets/{dataset_id:path}", method="DELETE") @webmethod(route="/datasets/{dataset_id:path}", method="DELETE")
async def unregister_dataset( async def unregister_dataset(

View file

@ -117,7 +117,7 @@ class Eval(Protocol):
""" """
@webmethod(route="/eval/benchmarks/{benchmark_id}/jobs/{job_id}", method="GET") @webmethod(route="/eval/benchmarks/{benchmark_id}/jobs/{job_id}", method="GET")
async def job_status(self, benchmark_id: str, job_id: str) -> Optional[JobStatus]: async def job_status(self, benchmark_id: str, job_id: str) -> JobStatus:
"""Get the status of a job. """Get the status of a job.
:param benchmark_id: The ID of the benchmark to run the evaluation on. :param benchmark_id: The ID of the benchmark to run the evaluation on.

View file

@ -4,7 +4,7 @@
# This source code is licensed under the terms described in the LICENSE file in # This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree. # the root directory of this source tree.
from typing import List, Optional, Protocol, runtime_checkable from typing import Protocol, runtime_checkable
from pydantic import BaseModel from pydantic import BaseModel
@ -13,7 +13,7 @@ from llama_stack.schema_utils import json_schema_type, webmethod
@json_schema_type @json_schema_type
class FileUploadResponse(BaseModel): class FileUpload(BaseModel):
""" """
Response after initiating a file upload session. Response after initiating a file upload session.
@ -30,23 +30,12 @@ class FileUploadResponse(BaseModel):
@json_schema_type @json_schema_type
class BucketResponse(BaseModel): class Bucket(BaseModel):
name: str name: str
@json_schema_type @json_schema_type
class ListBucketResponse(BaseModel): class File(BaseModel):
"""
Response representing a list of file entries.
:param data: List of FileResponse entries
"""
data: List[BucketResponse]
@json_schema_type
class FileResponse(BaseModel):
""" """
Response representing a file entry. Response representing a file entry.
@ -66,17 +55,6 @@ class FileResponse(BaseModel):
created_at: int created_at: int
@json_schema_type
class ListFileResponse(BaseModel):
"""
Response representing a list of file entries.
:param data: List of FileResponse entries
"""
data: List[FileResponse]
@runtime_checkable @runtime_checkable
@trace_protocol @trace_protocol
class Files(Protocol): class Files(Protocol):
@ -87,7 +65,7 @@ class Files(Protocol):
key: str, key: str,
mime_type: str, mime_type: str,
size: int, size: int,
) -> FileUploadResponse: ) -> FileUpload:
""" """
Create a new upload session for a file identified by a bucket and key. Create a new upload session for a file identified by a bucket and key.
@ -102,7 +80,7 @@ class Files(Protocol):
async def upload_content_to_session( async def upload_content_to_session(
self, self,
upload_id: str, upload_id: str,
) -> Optional[FileResponse]: ) -> File:
""" """
Upload file content to an existing upload session. Upload file content to an existing upload session.
On the server, request body will have the raw bytes that are uploaded. On the server, request body will have the raw bytes that are uploaded.
@ -115,7 +93,7 @@ class Files(Protocol):
async def get_upload_session_info( async def get_upload_session_info(
self, self,
upload_id: str, upload_id: str,
) -> Optional[FileUploadResponse]: ) -> FileUpload:
""" """
Returns information about an existsing upload session Returns information about an existsing upload session
@ -127,7 +105,7 @@ class Files(Protocol):
async def list_all_buckets( async def list_all_buckets(
self, self,
bucket: str, bucket: str,
) -> ListBucketResponse: ) -> list[Bucket]:
""" """
List all buckets. List all buckets.
""" """
@ -137,7 +115,7 @@ class Files(Protocol):
async def list_files_in_bucket( async def list_files_in_bucket(
self, self,
bucket: str, bucket: str,
) -> ListFileResponse: ) -> list[File]:
""" """
List all files in a bucket. List all files in a bucket.
@ -150,7 +128,7 @@ class Files(Protocol):
self, self,
bucket: str, bucket: str,
key: str, key: str,
) -> FileResponse: ) -> File:
""" """
Get a file info identified by a bucket and key. Get a file info identified by a bucket and key.
@ -164,7 +142,7 @@ class Files(Protocol):
self, self,
bucket: str, bucket: str,
key: str, key: str,
) -> FileResponse: ) -> File:
""" """
Delete a file identified by a bucket and key. Delete a file identified by a bucket and key.

View file

@ -31,26 +31,18 @@ class ProviderInfo(BaseModel):
provider_type: str provider_type: str
class ListProvidersResponse(BaseModel):
data: List[ProviderInfo]
@json_schema_type @json_schema_type
class VersionInfo(BaseModel): class VersionInfo(BaseModel):
version: str version: str
class ListRoutesResponse(BaseModel):
data: List[RouteInfo]
@runtime_checkable @runtime_checkable
class Inspect(Protocol): class Inspect(Protocol):
@webmethod(route="/inspect/providers", method="GET") @webmethod(route="/inspect/providers", method="GET")
async def list_providers(self) -> ListProvidersResponse: ... async def list_providers(self) -> list[ProviderInfo]: ...
@webmethod(route="/inspect/routes", method="GET") @webmethod(route="/inspect/routes", method="GET")
async def list_routes(self) -> ListRoutesResponse: ... async def list_routes(self) -> list[RouteInfo]: ...
@webmethod(route="/health", method="GET") @webmethod(route="/health", method="GET")
async def health(self) -> HealthInfo: ... async def health(self) -> HealthInfo: ...

View file

@ -5,7 +5,7 @@
# the root directory of this source tree. # the root directory of this source tree.
from enum import Enum from enum import Enum
from typing import Any, Dict, List, Literal, Optional, Protocol, runtime_checkable from typing import Any, Dict, Literal, Optional, Protocol, runtime_checkable
from pydantic import BaseModel, ConfigDict, Field from pydantic import BaseModel, ConfigDict, Field
@ -52,21 +52,17 @@ class ModelInput(CommonModelFields):
model_config = ConfigDict(protected_namespaces=()) model_config = ConfigDict(protected_namespaces=())
class ListModelsResponse(BaseModel):
data: List[Model]
@runtime_checkable @runtime_checkable
@trace_protocol @trace_protocol
class Models(Protocol): class Models(Protocol):
@webmethod(route="/models", method="GET") @webmethod(route="/models", method="GET")
async def list_models(self) -> ListModelsResponse: ... async def list_models(self) -> list[Model]: ...
@webmethod(route="/models/{model_id:path}", method="GET") @webmethod(route="/models/{model_id:path}", method="GET")
async def get_model( async def get_model(
self, self,
model_id: str, model_id: str,
) -> Optional[Model]: ... ) -> Model: ...
@webmethod(route="/models", method="POST") @webmethod(route="/models", method="POST")
async def register_model( async def register_model(

View file

@ -157,10 +157,6 @@ class PostTrainingJobStatusResponse(BaseModel):
checkpoints: List[Checkpoint] = Field(default_factory=list) checkpoints: List[Checkpoint] = Field(default_factory=list)
class ListPostTrainingJobsResponse(BaseModel):
data: List[PostTrainingJob]
@json_schema_type @json_schema_type
class PostTrainingJobArtifactsResponse(BaseModel): class PostTrainingJobArtifactsResponse(BaseModel):
"""Artifacts of a finetuning job.""" """Artifacts of a finetuning job."""
@ -199,13 +195,13 @@ class PostTraining(Protocol):
) -> PostTrainingJob: ... ) -> PostTrainingJob: ...
@webmethod(route="/post-training/jobs", method="GET") @webmethod(route="/post-training/jobs", method="GET")
async def get_training_jobs(self) -> ListPostTrainingJobsResponse: ... async def get_training_jobs(self) -> list[PostTrainingJob]: ...
@webmethod(route="/post-training/job/status", method="GET") @webmethod(route="/post-training/job/status", method="GET")
async def get_training_job_status(self, job_uuid: str) -> Optional[PostTrainingJobStatusResponse]: ... async def get_training_job_status(self, job_uuid: str) -> PostTrainingJobStatusResponse: ...
@webmethod(route="/post-training/job/cancel", method="POST") @webmethod(route="/post-training/job/cancel", method="POST")
async def cancel_training_job(self, job_uuid: str) -> None: ... async def cancel_training_job(self, job_uuid: str) -> None: ...
@webmethod(route="/post-training/job/artifacts", method="GET") @webmethod(route="/post-training/job/artifacts", method="GET")
async def get_training_job_artifacts(self, job_uuid: str) -> Optional[PostTrainingJobArtifactsResponse]: ... async def get_training_job_artifacts(self, job_uuid: str) -> PostTrainingJobArtifactsResponse: ...

View file

@ -4,7 +4,7 @@
# This source code is licensed under the terms described in the LICENSE file in # This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree. # the root directory of this source tree.
from typing import Any, Dict, List, Protocol, runtime_checkable from typing import Any, Dict, Protocol, runtime_checkable
from pydantic import BaseModel from pydantic import BaseModel
@ -19,10 +19,6 @@ class ProviderInfo(BaseModel):
config: Dict[str, Any] config: Dict[str, Any]
class ListProvidersResponse(BaseModel):
data: List[ProviderInfo]
@runtime_checkable @runtime_checkable
class Providers(Protocol): class Providers(Protocol):
""" """
@ -30,7 +26,7 @@ class Providers(Protocol):
""" """
@webmethod(route="/providers", method="GET") @webmethod(route="/providers", method="GET")
async def list_providers(self) -> ListProvidersResponse: ... async def list_providers(self) -> list[ProviderInfo]: ...
@webmethod(route="/providers/{provider_id}", method="GET") @webmethod(route="/providers/{provider_id}", method="GET")
async def inspect_provider(self, provider_id: str) -> ProviderInfo: ... async def inspect_provider(self, provider_id: str) -> ProviderInfo: ...

View file

@ -125,17 +125,13 @@ class ScoringFnInput(CommonScoringFnFields, BaseModel):
provider_scoring_fn_id: Optional[str] = None provider_scoring_fn_id: Optional[str] = None
class ListScoringFunctionsResponse(BaseModel):
data: List[ScoringFn]
@runtime_checkable @runtime_checkable
class ScoringFunctions(Protocol): class ScoringFunctions(Protocol):
@webmethod(route="/scoring-functions", method="GET") @webmethod(route="/scoring-functions", method="GET")
async def list_scoring_functions(self) -> ListScoringFunctionsResponse: ... async def list_scoring_functions(self) -> list[ScoringFn]: ...
@webmethod(route="/scoring-functions/{scoring_fn_id:path}", method="GET") @webmethod(route="/scoring-functions/{scoring_fn_id:path}", method="GET")
async def get_scoring_function(self, scoring_fn_id: str, /) -> Optional[ScoringFn]: ... async def get_scoring_function(self, scoring_fn_id: str, /) -> ScoringFn: ...
@webmethod(route="/scoring-functions", method="POST") @webmethod(route="/scoring-functions", method="POST")
async def register_scoring_function( async def register_scoring_function(

View file

@ -4,7 +4,7 @@
# This source code is licensed under the terms described in the LICENSE file in # This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree. # the root directory of this source tree.
from typing import Any, Dict, List, Literal, Optional, Protocol, runtime_checkable from typing import Any, Dict, Literal, Optional, Protocol, runtime_checkable
from pydantic import BaseModel from pydantic import BaseModel
@ -38,18 +38,14 @@ class ShieldInput(CommonShieldFields):
provider_shield_id: Optional[str] = None provider_shield_id: Optional[str] = None
class ListShieldsResponse(BaseModel):
data: List[Shield]
@runtime_checkable @runtime_checkable
@trace_protocol @trace_protocol
class Shields(Protocol): class Shields(Protocol):
@webmethod(route="/shields", method="GET") @webmethod(route="/shields", method="GET")
async def list_shields(self) -> ListShieldsResponse: ... async def list_shields(self) -> list[Shield]: ...
@webmethod(route="/shields/{identifier:path}", method="GET") @webmethod(route="/shields/{identifier:path}", method="GET")
async def get_shield(self, identifier: str) -> Optional[Shield]: ... async def get_shield(self, identifier: str) -> Shield: ...
@webmethod(route="/shields", method="POST") @webmethod(route="/shields", method="POST")
async def register_shield( async def register_shield(

View file

@ -103,6 +103,7 @@ class MetricInResponse(BaseModel):
unit: Optional[str] = None unit: Optional[str] = None
# TODO: check what this comment is about
# This is a short term solution to allow inference API to return metrics # This is a short term solution to allow inference API to return metrics
# The ideal way to do this is to have a way for all response types to include metrics # The ideal way to do this is to have a way for all response types to include metrics
# and all metric events logged to the telemetry API to be inlcuded with the response # and all metric events logged to the telemetry API to be inlcuded with the response

View file

@ -80,14 +80,6 @@ class ToolStore(Protocol):
def get_tool_group(self, toolgroup_id: str) -> ToolGroup: ... def get_tool_group(self, toolgroup_id: str) -> ToolGroup: ...
class ListToolGroupsResponse(BaseModel):
data: List[ToolGroup]
class ListToolsResponse(BaseModel):
data: List[Tool]
@runtime_checkable @runtime_checkable
@trace_protocol @trace_protocol
class ToolGroups(Protocol): class ToolGroups(Protocol):
@ -109,12 +101,12 @@ class ToolGroups(Protocol):
) -> ToolGroup: ... ) -> ToolGroup: ...
@webmethod(route="/toolgroups", method="GET") @webmethod(route="/toolgroups", method="GET")
async def list_tool_groups(self) -> ListToolGroupsResponse: async def list_tool_groups(self) -> list[ToolGroup]:
"""List tool groups with optional provider""" """List tool groups with optional provider"""
... ...
@webmethod(route="/tools", method="GET") @webmethod(route="/tools", method="GET")
async def list_tools(self, toolgroup_id: Optional[str] = None) -> ListToolsResponse: async def list_tools(self, toolgroup_id: Optional[str] = None) -> list[Tool]:
"""List tools with optional tool group""" """List tools with optional tool group"""
... ...
@ -148,7 +140,7 @@ class ToolRuntime(Protocol):
@webmethod(route="/tool-runtime/list-tools", method="GET") @webmethod(route="/tool-runtime/list-tools", method="GET")
async def list_runtime_tools( async def list_runtime_tools(
self, tool_group_id: Optional[str] = None, mcp_endpoint: Optional[URL] = None self, tool_group_id: Optional[str] = None, mcp_endpoint: Optional[URL] = None
) -> List[ToolDef]: ... ) -> list[ToolDef]: ...
@webmethod(route="/tool-runtime/invoke", method="POST") @webmethod(route="/tool-runtime/invoke", method="POST")
async def invoke_tool(self, tool_name: str, kwargs: Dict[str, Any]) -> ToolInvocationResult: async def invoke_tool(self, tool_name: str, kwargs: Dict[str, Any]) -> ToolInvocationResult:

View file

@ -4,7 +4,7 @@
# This source code is licensed under the terms described in the LICENSE file in # This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree. # the root directory of this source tree.
from typing import List, Literal, Optional, Protocol, runtime_checkable from typing import Literal, Optional, Protocol, runtime_checkable
from pydantic import BaseModel from pydantic import BaseModel
@ -36,21 +36,17 @@ class VectorDBInput(BaseModel):
provider_vector_db_id: Optional[str] = None provider_vector_db_id: Optional[str] = None
class ListVectorDBsResponse(BaseModel):
data: List[VectorDB]
@runtime_checkable @runtime_checkable
@trace_protocol @trace_protocol
class VectorDBs(Protocol): class VectorDBs(Protocol):
@webmethod(route="/vector-dbs", method="GET") @webmethod(route="/vector-dbs", method="GET")
async def list_vector_dbs(self) -> ListVectorDBsResponse: ... async def list_vector_dbs(self) -> list[VectorDB]: ...
@webmethod(route="/vector-dbs/{vector_db_id:path}", method="GET") @webmethod(route="/vector-dbs/{vector_db_id:path}", method="GET")
async def get_vector_db( async def get_vector_db(
self, self,
vector_db_id: str, vector_db_id: str,
) -> Optional[VectorDB]: ... ) -> VectorDB: ...
@webmethod(route="/vector-dbs", method="POST") @webmethod(route="/vector-dbs", method="POST")
async def register_vector_db( async def register_vector_db(
@ -60,7 +56,7 @@ class VectorDBs(Protocol):
embedding_dimension: Optional[int] = 384, embedding_dimension: Optional[int] = 384,
provider_id: Optional[str] = None, provider_id: Optional[str] = None,
provider_vector_db_id: Optional[str] = None, provider_vector_db_id: Optional[str] = None,
) -> VectorDB: ... ) -> None: ...
@webmethod(route="/vector-dbs/{vector_db_id:path}", method="DELETE") @webmethod(route="/vector-dbs/{vector_db_id:path}", method="DELETE")
async def unregister_vector_db(self, vector_db_id: str) -> None: ... async def unregister_vector_db(self, vector_db_id: str) -> None: ...

View file

@ -30,7 +30,7 @@ class QueryChunksResponse(BaseModel):
class VectorDBStore(Protocol): class VectorDBStore(Protocol):
def get_vector_db(self, vector_db_id: str) -> Optional[VectorDB]: ... def get_vector_db(self, vector_db_id: str) -> VectorDB: ...
@runtime_checkable @runtime_checkable

View file

@ -11,8 +11,6 @@ from pydantic import BaseModel
from llama_stack.apis.inspect import ( from llama_stack.apis.inspect import (
HealthInfo, HealthInfo,
Inspect, Inspect,
ListProvidersResponse,
ListRoutesResponse,
ProviderInfo, ProviderInfo,
RouteInfo, RouteInfo,
VersionInfo, VersionInfo,
@ -39,43 +37,27 @@ class DistributionInspectImpl(Inspect):
async def initialize(self) -> None: async def initialize(self) -> None:
pass pass
async def list_providers(self) -> ListProvidersResponse: async def list_providers(self) -> list[ProviderInfo]:
run_config = self.config.run_config return [
ProviderInfo(
ret = [] api=api,
for api, providers in run_config.providers.items(): provider_id=p.provider_id,
ret.extend( provider_type=p.provider_type,
[
ProviderInfo(
api=api,
provider_id=p.provider_id,
provider_type=p.provider_type,
)
for p in providers
]
) )
for api, providers in self.config.run_config.providers.items()
for p in providers
]
return ListProvidersResponse(data=ret) async def list_routes(self) -> list[RouteInfo]:
return [
async def list_routes(self) -> ListRoutesResponse: RouteInfo(
run_config = self.config.run_config route=e.route,
method=e.method,
ret = [] provider_types=[p.provider_type for p in self.config.run_config.providers.get(api.value, [])],
all_endpoints = get_all_api_endpoints()
for api, endpoints in all_endpoints.items():
providers = run_config.providers.get(api.value, [])
ret.extend(
[
RouteInfo(
route=e.route,
method=e.method,
provider_types=[p.provider_type for p in providers],
)
for e in endpoints
]
) )
for api, endpoints in get_all_api_endpoints().items()
return ListRoutesResponse(data=ret) for e in endpoints
]
async def health(self) -> HealthInfo: async def health(self) -> HealthInfo:
return HealthInfo(status="OK") return HealthInfo(status="OK")

View file

@ -7,7 +7,7 @@
from pydantic import BaseModel from pydantic import BaseModel
from llama_stack.apis.providers import ListProvidersResponse, ProviderInfo, Providers from llama_stack.apis.providers import ProviderInfo, Providers
from .datatypes import StackRunConfig from .datatypes import StackRunConfig
from .stack import redact_sensitive_fields from .stack import redact_sensitive_fields
@ -31,28 +31,23 @@ class ProviderImpl(Providers):
async def initialize(self) -> None: async def initialize(self) -> None:
pass pass
async def list_providers(self) -> ListProvidersResponse: async def list_providers(self) -> list[ProviderInfo]:
run_config = self.config.run_config run_config = self.config.run_config
safe_config = StackRunConfig(**redact_sensitive_fields(run_config.model_dump())) safe_config = StackRunConfig(**redact_sensitive_fields(run_config.model_dump()))
ret = [] return [
for api, providers in safe_config.providers.items(): ProviderInfo(
ret.extend( api=api,
[ provider_id=p.provider_id,
ProviderInfo( provider_type=p.provider_type,
api=api, config=p.config,
provider_id=p.provider_id,
provider_type=p.provider_type,
config=p.config,
)
for p in providers
]
) )
for api, providers in safe_config.providers.items()
return ListProvidersResponse(data=ret) for p in providers
]
async def inspect_provider(self, provider_id: str) -> ProviderInfo: async def inspect_provider(self, provider_id: str) -> ProviderInfo:
all_providers = await self.list_providers() all_providers = await self.list_providers()
for p in all_providers.data: for p in all_providers:
if p.provider_id == provider_id: if p.provider_id == provider_id:
return p return p

View file

@ -9,28 +9,25 @@ from typing import Any, Dict, List, Optional
from pydantic import TypeAdapter from pydantic import TypeAdapter
from llama_stack.apis.benchmarks import Benchmark, Benchmarks, ListBenchmarksResponse from llama_stack.apis.benchmarks import Benchmark, Benchmarks
from llama_stack.apis.common.content_types import URL from llama_stack.apis.common.content_types import URL
from llama_stack.apis.common.type_system import ParamType from llama_stack.apis.common.type_system import ParamType
from llama_stack.apis.datasets import Dataset, Datasets, ListDatasetsResponse from llama_stack.apis.datasets import Dataset, Datasets
from llama_stack.apis.models import ListModelsResponse, Model, Models, ModelType from llama_stack.apis.models import Model, Models, ModelType
from llama_stack.apis.resource import ResourceType from llama_stack.apis.resource import ResourceType
from llama_stack.apis.scoring_functions import ( from llama_stack.apis.scoring_functions import (
ListScoringFunctionsResponse,
ScoringFn, ScoringFn,
ScoringFnParams, ScoringFnParams,
ScoringFunctions, ScoringFunctions,
) )
from llama_stack.apis.shields import ListShieldsResponse, Shield, Shields from llama_stack.apis.shields import Shield, Shields
from llama_stack.apis.tools import ( from llama_stack.apis.tools import (
ListToolGroupsResponse,
ListToolsResponse,
Tool, Tool,
ToolGroup, ToolGroup,
ToolGroups, ToolGroups,
ToolHost, ToolHost,
) )
from llama_stack.apis.vector_dbs import ListVectorDBsResponse, VectorDB, VectorDBs from llama_stack.apis.vector_dbs import VectorDB, VectorDBs
from llama_stack.distribution.datatypes import ( from llama_stack.distribution.datatypes import (
RoutableObject, RoutableObject,
RoutableObjectWithProvider, RoutableObjectWithProvider,
@ -208,8 +205,8 @@ class CommonRoutingTableImpl(RoutingTable):
class ModelsRoutingTable(CommonRoutingTableImpl, Models): class ModelsRoutingTable(CommonRoutingTableImpl, Models):
async def list_models(self) -> ListModelsResponse: async def list_models(self) -> list[Model]:
return ListModelsResponse(data=await self.get_all_with_type("model")) return await self.get_all_with_type("model")
async def get_model(self, model_id: str) -> Optional[Model]: async def get_model(self, model_id: str) -> Optional[Model]:
return await self.get_object_by_identifier("model", model_id) return await self.get_object_by_identifier("model", model_id)
@ -256,8 +253,8 @@ class ModelsRoutingTable(CommonRoutingTableImpl, Models):
class ShieldsRoutingTable(CommonRoutingTableImpl, Shields): class ShieldsRoutingTable(CommonRoutingTableImpl, Shields):
async def list_shields(self) -> ListShieldsResponse: async def list_shields(self) -> list[Shield]:
return ListShieldsResponse(data=await self.get_all_with_type(ResourceType.shield.value)) return await self.get_all_with_type(ResourceType.shield.value)
async def get_shield(self, identifier: str) -> Optional[Shield]: async def get_shield(self, identifier: str) -> Optional[Shield]:
return await self.get_object_by_identifier("shield", identifier) return await self.get_object_by_identifier("shield", identifier)
@ -292,8 +289,8 @@ class ShieldsRoutingTable(CommonRoutingTableImpl, Shields):
class VectorDBsRoutingTable(CommonRoutingTableImpl, VectorDBs): class VectorDBsRoutingTable(CommonRoutingTableImpl, VectorDBs):
async def list_vector_dbs(self) -> ListVectorDBsResponse: async def list_vector_dbs(self) -> list[VectorDB]:
return ListVectorDBsResponse(data=await self.get_all_with_type("vector_db")) return await self.get_all_with_type("vector_db")
async def get_vector_db(self, vector_db_id: str) -> Optional[VectorDB]: async def get_vector_db(self, vector_db_id: str) -> Optional[VectorDB]:
return await self.get_object_by_identifier("vector_db", vector_db_id) return await self.get_object_by_identifier("vector_db", vector_db_id)
@ -344,8 +341,8 @@ class VectorDBsRoutingTable(CommonRoutingTableImpl, VectorDBs):
class DatasetsRoutingTable(CommonRoutingTableImpl, Datasets): class DatasetsRoutingTable(CommonRoutingTableImpl, Datasets):
async def list_datasets(self) -> ListDatasetsResponse: async def list_datasets(self) -> list[Dataset]:
return ListDatasetsResponse(data=await self.get_all_with_type(ResourceType.dataset.value)) return await self.get_all_with_type(ResourceType.dataset.value)
async def get_dataset(self, dataset_id: str) -> Optional[Dataset]: async def get_dataset(self, dataset_id: str) -> Optional[Dataset]:
return await self.get_object_by_identifier("dataset", dataset_id) return await self.get_object_by_identifier("dataset", dataset_id)
@ -389,8 +386,8 @@ class DatasetsRoutingTable(CommonRoutingTableImpl, Datasets):
class ScoringFunctionsRoutingTable(CommonRoutingTableImpl, ScoringFunctions): class ScoringFunctionsRoutingTable(CommonRoutingTableImpl, ScoringFunctions):
async def list_scoring_functions(self) -> ListScoringFunctionsResponse: async def list_scoring_functions(self) -> list[ScoringFunctions]:
return ListScoringFunctionsResponse(data=await self.get_all_with_type(ResourceType.scoring_function.value)) return await self.get_all_with_type(ResourceType.scoring_function.value)
async def get_scoring_function(self, scoring_fn_id: str) -> Optional[ScoringFn]: async def get_scoring_function(self, scoring_fn_id: str) -> Optional[ScoringFn]:
return await self.get_object_by_identifier("scoring_function", scoring_fn_id) return await self.get_object_by_identifier("scoring_function", scoring_fn_id)
@ -426,8 +423,8 @@ class ScoringFunctionsRoutingTable(CommonRoutingTableImpl, ScoringFunctions):
class BenchmarksRoutingTable(CommonRoutingTableImpl, Benchmarks): class BenchmarksRoutingTable(CommonRoutingTableImpl, Benchmarks):
async def list_benchmarks(self) -> ListBenchmarksResponse: async def list_benchmarks(self) -> list[Benchmark]:
return ListBenchmarksResponse(data=await self.get_all_with_type("benchmark")) return await self.get_all_with_type("benchmark")
async def get_benchmark(self, benchmark_id: str) -> Optional[Benchmark]: async def get_benchmark(self, benchmark_id: str) -> Optional[Benchmark]:
return await self.get_object_by_identifier("benchmark", benchmark_id) return await self.get_object_by_identifier("benchmark", benchmark_id)
@ -464,14 +461,14 @@ class BenchmarksRoutingTable(CommonRoutingTableImpl, Benchmarks):
class ToolGroupsRoutingTable(CommonRoutingTableImpl, ToolGroups): class ToolGroupsRoutingTable(CommonRoutingTableImpl, ToolGroups):
async def list_tools(self, toolgroup_id: Optional[str] = None) -> ListToolsResponse: async def list_tools(self, toolgroup_id: Optional[str] = None) -> list[Tool]:
tools = await self.get_all_with_type("tool") tools = await self.get_all_with_type("tool")
if toolgroup_id: if toolgroup_id:
tools = [tool for tool in tools if tool.toolgroup_id == toolgroup_id] tools = [tool for tool in tools if tool.toolgroup_id == toolgroup_id]
return ListToolsResponse(data=tools) return tools
async def list_tool_groups(self) -> ListToolGroupsResponse: async def list_tool_groups(self) -> list[ToolGroup]:
return ListToolGroupsResponse(data=await self.get_all_with_type("tool_group")) return await self.get_all_with_type("tool_group")
async def get_tool_group(self, toolgroup_id: str) -> ToolGroup: async def get_tool_group(self, toolgroup_id: str) -> ToolGroup:
return await self.get_object_by_identifier("tool_group", toolgroup_id) return await self.get_object_by_identifier("tool_group", toolgroup_id)