mirror of
https://github.com/meta-llama/llama-stack.git
synced 2026-01-02 07:50:00 +00:00
refactor: extract pagination logic into shared helper function
Move pagination logic from LocalFS and HuggingFace implementations into a common helper function to ensure consistent pagination behavior across providers. This reduces code duplication and centralizes pagination logic in one place. Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
parent
9b478f3756
commit
8e15e3c1b8
9 changed files with 130 additions and 73 deletions
23
llama_stack/apis/common/responses.py
Normal file
23
llama_stack/apis/common/responses.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under the terms described in the LICENSE file in
|
||||
# the root directory of this source tree.
|
||||
|
||||
from typing import Any, Dict, List
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from llama_stack.schema_utils import json_schema_type
|
||||
|
||||
|
||||
@json_schema_type
|
||||
class PaginatedResponse(BaseModel):
|
||||
"""A generic paginated response that follows a simple format.
|
||||
|
||||
:param data: The list of items for the current page
|
||||
:param has_more: Whether there are more items available after this set
|
||||
"""
|
||||
|
||||
data: List[Dict[str, Any]]
|
||||
has_more: bool
|
||||
Loading…
Add table
Add a link
Reference in a new issue