feat: convert Datasets API to use FastAPI router (#4359)

# What does this PR do?

Convert the Datasets API from webmethod decorators to FastAPI router
pattern.

Fixes: https://github.com/llamastack/llama-stack/issues/4344

## Test Plan
CI

Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
Sébastien Han 2025-12-15 20:23:04 +01:00 committed by GitHub
parent 56f946f3f5
commit 700663028f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 716 additions and 335 deletions

View file

@ -9186,9 +9186,11 @@ components:
type: string
const: dataset
title: Type
description: Type of resource, always 'dataset' for datasets
default: dataset
purpose:
$ref: '#/components/schemas/DatasetPurpose'
description: Purpose of the dataset indicating its intended use
source:
oneOf:
- $ref: '#/components/schemas/URIDataSource'
@ -9196,6 +9198,7 @@ components:
- $ref: '#/components/schemas/RowsDataSource'
title: RowsDataSource
title: URIDataSource | RowsDataSource
description: Data source configuration for the dataset
discriminator:
propertyName: type
mapping:
@ -9220,6 +9223,7 @@ components:
type: string
const: rows
title: Type
description: The type of data source.
default: rows
rows:
items:
@ -9227,6 +9231,7 @@ components:
type: object
type: array
title: Rows
description: 'The dataset is stored in rows. E.g. [{"messages": [{"role": "user", "content": "Hello, world!"}, {"role": "assistant", "content": "Hello, world!"}]}]'
type: object
required:
- rows
@ -9238,10 +9243,12 @@ components:
type: string
const: uri
title: Type
description: The type of data source.
default: uri
uri:
type: string
title: Uri
description: The dataset can be obtained from a URI. E.g. "https://mywebsite.com/mydata.jsonl", "lsfs://mydata.jsonl", "data:csv;base64,{base64_content}"
type: object
required:
- uri
@ -9254,6 +9261,7 @@ components:
$ref: '#/components/schemas/Dataset'
type: array
title: Data
description: List of datasets
type: object
required:
- data
@ -9965,6 +9973,41 @@ components:
- $ref: '#/components/schemas/RowsDataSource'
title: RowsDataSource
title: URIDataSource | RowsDataSource
RegisterDatasetRequest:
properties:
purpose:
$ref: '#/components/schemas/DatasetPurpose'
description: The purpose of the dataset.
source:
oneOf:
- $ref: '#/components/schemas/URIDataSource'
title: URIDataSource
- $ref: '#/components/schemas/RowsDataSource'
title: RowsDataSource
title: URIDataSource | RowsDataSource
description: The data source of the dataset.
discriminator:
propertyName: type
mapping:
rows: '#/components/schemas/RowsDataSource'
uri: '#/components/schemas/URIDataSource'
metadata:
anyOf:
- additionalProperties: true
type: object
- type: 'null'
description: The metadata for the dataset.
dataset_id:
anyOf:
- type: string
- type: 'null'
description: The ID of the dataset. If not provided, an ID will be generated.
type: object
required:
- purpose
- source
title: RegisterDatasetRequest
description: Request model for registering a dataset.
RegisterBenchmarkRequest:
properties:
benchmark_id:
@ -11797,6 +11840,28 @@ components:
- items
title: ConversationItemCreateRequest
type: object
GetDatasetRequest:
description: Request model for getting a dataset by ID.
properties:
dataset_id:
description: The ID of the dataset to get.
title: Dataset Id
type: string
required:
- dataset_id
title: GetDatasetRequest
type: object
UnregisterDatasetRequest:
description: Request model for unregistering a dataset.
properties:
dataset_id:
description: The ID of the dataset to unregister.
title: Dataset Id
type: string
required:
- dataset_id
title: UnregisterDatasetRequest
type: object
Api:
description: Enumeration of all available APIs in the Llama Stack system.
enum: