mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-07-29 23:29:43 +00:00
datasetio api
This commit is contained in:
parent
37442a495b
commit
02f4c3a081
1 changed files with 34 additions and 0 deletions
|
@ -3,3 +3,37 @@
|
||||||
#
|
#
|
||||||
# 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, Optional, Protocol, runtime_checkable
|
||||||
|
|
||||||
|
from llama_models.schema_utils import json_schema_type, webmethod
|
||||||
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
from llama_stack.apis.datasets import * # noqa: F403
|
||||||
|
|
||||||
|
|
||||||
|
@json_schema_type
|
||||||
|
class PaginatedRowsResult(BaseModel):
|
||||||
|
# the rows obey the DatasetSchema for the given dataset
|
||||||
|
rows: List[Dict[str, Any]]
|
||||||
|
total_count: int
|
||||||
|
next_page_token: Optional[str] = None
|
||||||
|
|
||||||
|
|
||||||
|
class DatasetStore(Protocol):
|
||||||
|
def get_dataset(self, identifier: str) -> DatasetDefWithProvider: ...
|
||||||
|
|
||||||
|
|
||||||
|
@runtime_checkable
|
||||||
|
class DatasetIO(Protocol):
|
||||||
|
# keeping for aligning with inference/safety, but this is not used
|
||||||
|
dataset_store: DatasetStore
|
||||||
|
|
||||||
|
@webmethod(route="/dataio/get_rows_paginated")
|
||||||
|
async def get_rows_paginated(
|
||||||
|
self,
|
||||||
|
dataset_id: str,
|
||||||
|
rows_in_page: int,
|
||||||
|
page_token: Optional[str] = None,
|
||||||
|
filter_condition: Optional[str] = None,
|
||||||
|
) -> PaginatedRowsResult: ...
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue