mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-03 09:53:45 +00:00
chore: refactor Batches protocol to use request models
This commit refactors the Batches protocol to use Pydantic request models for both create_batch and list_batches methods, improving consistency, readability, and maintainability. - create_batch now accepts a single CreateBatchRequest parameter instead of individual arguments. This aligns the protocol with FastAPI’s request model pattern, allowing the router to pass the request object directly without unpacking parameters. Provider implementations now access fields via request.input_file_id, request.endpoint, etc. - list_batches now accepts a single ListBatchesRequest parameter, replacing individual query parameters. The model includes after and limit fields with proper OpenAPI descriptions. FastAPI automatically parses query parameters into the model for GET requests, keeping router code clean. Provider implementations access fields via request.after and request.limit. Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
parent
00e7ea6c3b
commit
30cab02083
9 changed files with 145 additions and 50 deletions
20
docs/static/stainless-llama-stack-spec.yaml
vendored
20
docs/static/stainless-llama-stack-spec.yaml
vendored
|
|
@ -48,14 +48,18 @@ paths:
|
|||
anyOf:
|
||||
- type: string
|
||||
- type: 'null'
|
||||
description: Optional cursor for pagination. Returns batches after this ID.
|
||||
title: After
|
||||
description: Optional cursor for pagination. Returns batches after this ID.
|
||||
- name: limit
|
||||
in: query
|
||||
required: false
|
||||
schema:
|
||||
type: integer
|
||||
description: Maximum number of batches to return. Defaults to 20.
|
||||
default: 20
|
||||
title: Limit
|
||||
description: Maximum number of batches to return. Defaults to 20.
|
||||
post:
|
||||
responses:
|
||||
'200':
|
||||
|
|
@ -12690,6 +12694,22 @@ components:
|
|||
- query
|
||||
title: VectorStoreSearchRequest
|
||||
type: object
|
||||
ListBatchesRequest:
|
||||
description: Request model for listing batches.
|
||||
properties:
|
||||
after:
|
||||
anyOf:
|
||||
- type: string
|
||||
- type: 'null'
|
||||
description: Optional cursor for pagination. Returns batches after this ID.
|
||||
nullable: true
|
||||
limit:
|
||||
default: 20
|
||||
description: Maximum number of batches to return. Defaults to 20.
|
||||
title: Limit
|
||||
type: integer
|
||||
title: ListBatchesRequest
|
||||
type: object
|
||||
DialogType:
|
||||
description: Parameter type for dialog data with semantic output labels.
|
||||
properties:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue