mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-27 18:50:41 +00:00
Some checks failed
Integration Auth Tests / test-matrix (oauth2_token) (push) Failing after 5s
Integration Tests / test-matrix (http, 3.10, agents) (push) Failing after 7s
Integration Tests / test-matrix (http, 3.10, datasets) (push) Failing after 8s
Integration Tests / test-matrix (http, 3.10, providers) (push) Failing after 6s
Integration Tests / test-matrix (http, 3.11, datasets) (push) Failing after 6s
Integration Tests / test-matrix (http, 3.11, agents) (push) Failing after 7s
Integration Tests / test-matrix (http, 3.10, scoring) (push) Failing after 9s
Integration Tests / test-matrix (http, 3.11, scoring) (push) Failing after 5s
Integration Tests / test-matrix (http, 3.10, post_training) (push) Failing after 9s
Integration Tests / test-matrix (http, 3.11, inference) (push) Failing after 8s
Integration Tests / test-matrix (http, 3.12, inspect) (push) Failing after 5s
Integration Tests / test-matrix (http, 3.12, inference) (push) Failing after 5s
Integration Tests / test-matrix (http, 3.11, tool_runtime) (push) Failing after 6s
Integration Tests / test-matrix (http, 3.12, scoring) (push) Failing after 6s
Integration Tests / test-matrix (http, 3.11, providers) (push) Failing after 12s
Integration Tests / test-matrix (http, 3.12, tool_runtime) (push) Failing after 8s
Integration Tests / test-matrix (library, 3.10, inference) (push) Failing after 6s
Integration Tests / test-matrix (http, 3.12, datasets) (push) Failing after 12s
Integration Tests / test-matrix (http, 3.12, providers) (push) Failing after 11s
Integration Tests / test-matrix (library, 3.10, agents) (push) Failing after 9s
Integration Tests / test-matrix (library, 3.10, datasets) (push) Failing after 8s
Integration Tests / test-matrix (library, 3.10, inspect) (push) Failing after 6s
Integration Tests / test-matrix (library, 3.10, providers) (push) Failing after 7s
Integration Tests / test-matrix (http, 3.10, tool_runtime) (push) Failing after 25s
Integration Tests / test-matrix (http, 3.11, inspect) (push) Failing after 23s
Integration Tests / test-matrix (http, 3.10, inference) (push) Failing after 27s
Integration Tests / test-matrix (http, 3.10, inspect) (push) Failing after 29s
Integration Tests / test-matrix (http, 3.12, post_training) (push) Failing after 20s
Integration Tests / test-matrix (http, 3.11, vector_io) (push) Failing after 22s
Integration Tests / test-matrix (http, 3.11, post_training) (push) Failing after 25s
Integration Tests / test-matrix (library, 3.10, scoring) (push) Failing after 8s
Integration Tests / test-matrix (http, 3.12, agents) (push) Failing after 23s
Integration Tests / test-matrix (library, 3.11, datasets) (push) Failing after 5s
Integration Tests / test-matrix (library, 3.10, vector_io) (push) Failing after 7s
Integration Tests / test-matrix (http, 3.10, vector_io) (push) Failing after 27s
Integration Tests / test-matrix (http, 3.12, vector_io) (push) Failing after 19s
Integration Tests / test-matrix (library, 3.10, post_training) (push) Failing after 10s
Integration Tests / test-matrix (library, 3.10, tool_runtime) (push) Failing after 11s
Integration Tests / test-matrix (library, 3.11, inspect) (push) Failing after 8s
Integration Tests / test-matrix (library, 3.11, inference) (push) Failing after 9s
Integration Tests / test-matrix (library, 3.11, providers) (push) Failing after 8s
Integration Tests / test-matrix (library, 3.11, tool_runtime) (push) Failing after 8s
Integration Tests / test-matrix (library, 3.11, scoring) (push) Failing after 10s
Integration Tests / test-matrix (library, 3.11, agents) (push) Failing after 11s
Integration Tests / test-matrix (library, 3.11, post_training) (push) Failing after 10s
Integration Tests / test-matrix (library, 3.12, agents) (push) Failing after 7s
Integration Tests / test-matrix (library, 3.11, vector_io) (push) Failing after 10s
Integration Tests / test-matrix (library, 3.12, inference) (push) Failing after 7s
Integration Tests / test-matrix (library, 3.12, datasets) (push) Failing after 10s
Integration Tests / test-matrix (library, 3.12, inspect) (push) Failing after 10s
Integration Tests / test-matrix (library, 3.12, post_training) (push) Failing after 8s
Integration Tests / test-matrix (library, 3.12, scoring) (push) Failing after 8s
Integration Tests / test-matrix (library, 3.12, providers) (push) Failing after 10s
Integration Tests / test-matrix (library, 3.12, vector_io) (push) Failing after 44s
Integration Tests / test-matrix (library, 3.12, tool_runtime) (push) Failing after 46s
Test External Providers / test-external-providers (venv) (push) Failing after 41s
Unit Tests / unit-tests (3.10) (push) Failing after 52s
Unit Tests / unit-tests (3.12) (push) Failing after 18s
Unit Tests / unit-tests (3.11) (push) Failing after 20s
Unit Tests / unit-tests (3.13) (push) Failing after 16s
Pre-commit / pre-commit (push) Successful in 2m0s
# What does this PR do? ## Test Plan added unit tests
104 lines
2.7 KiB
Python
104 lines
2.7 KiB
Python
# 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 collections.abc import Mapping
|
|
from enum import Enum
|
|
from typing import Any, Literal, Protocol
|
|
|
|
from pydantic import BaseModel
|
|
|
|
from llama_stack.apis.common.responses import PaginatedResponse
|
|
|
|
|
|
class ColumnType(Enum):
|
|
INTEGER = "INTEGER"
|
|
STRING = "STRING"
|
|
TEXT = "TEXT"
|
|
FLOAT = "FLOAT"
|
|
BOOLEAN = "BOOLEAN"
|
|
JSON = "JSON"
|
|
DATETIME = "DATETIME"
|
|
|
|
|
|
class ColumnDefinition(BaseModel):
|
|
type: ColumnType
|
|
primary_key: bool = False
|
|
nullable: bool = True
|
|
default: Any = None
|
|
|
|
|
|
class SqlStore(Protocol):
|
|
"""
|
|
A protocol for a SQL store.
|
|
"""
|
|
|
|
async def create_table(self, table: str, schema: Mapping[str, ColumnType | ColumnDefinition]) -> None:
|
|
"""
|
|
Create a table.
|
|
"""
|
|
pass
|
|
|
|
async def insert(self, table: str, data: Mapping[str, Any]) -> None:
|
|
"""
|
|
Insert a row into a table.
|
|
"""
|
|
pass
|
|
|
|
async def fetch_all(
|
|
self,
|
|
table: str,
|
|
where: Mapping[str, Any] | None = None,
|
|
limit: int | None = None,
|
|
order_by: list[tuple[str, Literal["asc", "desc"]]] | None = None,
|
|
cursor: tuple[str, str] | None = None,
|
|
) -> PaginatedResponse:
|
|
"""
|
|
Fetch all rows from a table with optional cursor-based pagination.
|
|
|
|
:param table: The table name
|
|
:param where: WHERE conditions
|
|
:param limit: Maximum number of records to return
|
|
:param order_by: List of (column, order) tuples for sorting
|
|
:param cursor: Tuple of (key_column, cursor_id) for pagination (None for first page)
|
|
Requires order_by with exactly one column when used
|
|
:return: PaginatedResult with data and has_more flag
|
|
|
|
Note: Cursor pagination only supports single-column ordering for simplicity.
|
|
Multi-column ordering is allowed without cursor but will raise an error with cursor.
|
|
"""
|
|
pass
|
|
|
|
async def fetch_one(
|
|
self,
|
|
table: str,
|
|
where: Mapping[str, Any] | None = None,
|
|
order_by: list[tuple[str, Literal["asc", "desc"]]] | None = None,
|
|
) -> dict[str, Any] | None:
|
|
"""
|
|
Fetch one row from a table.
|
|
"""
|
|
pass
|
|
|
|
async def update(
|
|
self,
|
|
table: str,
|
|
data: Mapping[str, Any],
|
|
where: Mapping[str, Any],
|
|
) -> None:
|
|
"""
|
|
Update a row in a table.
|
|
"""
|
|
pass
|
|
|
|
async def delete(
|
|
self,
|
|
table: str,
|
|
where: Mapping[str, Any],
|
|
) -> None:
|
|
"""
|
|
Delete a row from a table.
|
|
"""
|
|
pass
|