mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-03 09:53:45 +00:00
chore: rebase on main
Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
parent
e79a03b697
commit
2a257dbdea
14 changed files with 27198 additions and 38612 deletions
|
|
@ -13,8 +13,8 @@ from typing import Any
|
|||
|
||||
from fastapi import FastAPI
|
||||
|
||||
from llama_stack.apis.datatypes import Api
|
||||
from llama_stack.core.resolver import api_protocol_map
|
||||
from llama_stack_api import Api
|
||||
|
||||
from .state import _protocol_methods_cache
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ from typing import Annotated, Any, get_args, get_origin
|
|||
from fastapi import FastAPI
|
||||
from pydantic import Field, create_model
|
||||
|
||||
from llama_stack.apis.datatypes import Api
|
||||
from llama_stack_api import Api
|
||||
|
||||
from . import app as app_module
|
||||
from .state import _dynamic_models, _extra_body_fields
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ def _import_all_modules_in_package(package_name: str) -> list[Any]:
|
|||
that any register_schema() calls at module level are executed.
|
||||
|
||||
Args:
|
||||
package_name: The fully qualified package name (e.g., 'llama_stack.apis')
|
||||
package_name: The fully qualified package name (e.g., 'llama_stack_api')
|
||||
|
||||
Returns:
|
||||
List of imported module objects
|
||||
|
|
@ -54,7 +54,7 @@ def _import_all_modules_in_package(package_name: str) -> list[Any]:
|
|||
modules.append(module)
|
||||
|
||||
# If this is a package, also try to import any .py files directly
|
||||
# (e.g., llama_stack.apis.scoring_functions.scoring_functions)
|
||||
# (e.g., llama_stack_api.scoring_functions.scoring_functions)
|
||||
if ispkg:
|
||||
try:
|
||||
# Try importing the module file with the same name as the package
|
||||
|
|
@ -113,11 +113,11 @@ def _ensure_json_schema_types_included(openapi_schema: dict[str, Any]) -> dict[s
|
|||
# Dynamically import all modules in packages that might register schemas
|
||||
# This ensures register_schema() calls execute and populate _registered_schemas
|
||||
# Also collect the modules for later scanning of @json_schema_type decorated classes
|
||||
apis_modules = _import_all_modules_in_package("llama_stack.apis")
|
||||
apis_modules = _import_all_modules_in_package("llama_stack_api")
|
||||
_import_all_modules_in_package("llama_stack.core.telemetry")
|
||||
|
||||
# First, handle registered schemas (union types, etc.)
|
||||
from llama_stack.schema_utils import _registered_schemas
|
||||
from llama_stack_api.schema_utils import _registered_schemas
|
||||
|
||||
for schema_type, registration_info in _registered_schemas.items():
|
||||
schema_name = registration_info["name"]
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ Schema filtering and version filtering for OpenAPI generation.
|
|||
|
||||
from typing import Any
|
||||
|
||||
from llama_stack.apis.version import (
|
||||
from llama_stack_api.version import (
|
||||
LLAMA_STACK_API_V1,
|
||||
LLAMA_STACK_API_V1ALPHA,
|
||||
LLAMA_STACK_API_V1BETA,
|
||||
|
|
@ -25,7 +25,7 @@ def _get_all_json_schema_type_names() -> set[str]:
|
|||
This ensures they are included in filtered schemas even if not directly referenced by paths.
|
||||
"""
|
||||
schema_names = set()
|
||||
apis_modules = schema_collection._import_all_modules_in_package("llama_stack.apis")
|
||||
apis_modules = schema_collection._import_all_modules_in_package("llama_stack_api")
|
||||
for module in apis_modules:
|
||||
for attr_name in dir(module):
|
||||
try:
|
||||
|
|
@ -43,7 +43,7 @@ def _get_all_json_schema_type_names() -> set[str]:
|
|||
|
||||
def _get_explicit_schema_names(openapi_schema: dict[str, Any]) -> set[str]:
|
||||
"""Get all registered schema names and @json_schema_type decorated model names."""
|
||||
from llama_stack.schema_utils import _registered_schemas
|
||||
from llama_stack_api.schema_utils import _registered_schemas
|
||||
|
||||
registered_schema_names = {info["name"] for info in _registered_schemas.values()}
|
||||
json_schema_type_names = _get_all_json_schema_type_names()
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ Shared state for the OpenAPI generator module.
|
|||
|
||||
from typing import Any
|
||||
|
||||
from llama_stack.apis.datatypes import Api
|
||||
from llama_stack_api import Api
|
||||
|
||||
# Global list to store dynamic models created during endpoint generation
|
||||
_dynamic_models: list[Any] = []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue