mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-07 10:50:56 +00:00
refactor: enforce top-level imports for llama-stack-api
Enforce that all imports from llama-stack-api use the form: from llama_stack_api import <symbol> This prevents external code from accessing internal package structure (e.g., llama_stack_api.agents, llama_stack_api.common.*) and establishes a clear public API boundary. Changes: - Export 400+ symbols from llama_stack_api/__init__.py - Include all API types, common utilities, and strong_typing helpers - Update files across src/llama_stack, docs/, tests/, scripts/ - Convert all submodule imports to top-level imports - ensure docs use the proper importing structure Addresses PR review feedback requiring explicit __all__ definition to prevent "peeking inside" the API package. Signed-off-by: Charlie Doern <cdoern@redhat.com>
This commit is contained in:
parent
b7480e9c88
commit
2e5d1c8881
270 changed files with 1587 additions and 750 deletions
|
|
@ -8,8 +8,7 @@ import time
|
|||
from io import BytesIO
|
||||
|
||||
import pytest
|
||||
from llama_stack_api.files import ExpiresAfter
|
||||
from llama_stack_api.vector_io import Chunk
|
||||
from llama_stack_api import Chunk, ExpiresAfter
|
||||
from llama_stack_client import BadRequestError
|
||||
from openai import BadRequestError as OpenAIBadRequestError
|
||||
|
||||
|
|
@ -646,7 +645,7 @@ def test_openai_vector_store_attach_file(
|
|||
):
|
||||
"""Test OpenAI vector store attach file."""
|
||||
skip_if_provider_doesnt_support_openai_vector_stores(client_with_models)
|
||||
from llama_stack_api.files import ExpiresAfter
|
||||
from llama_stack_api import ExpiresAfter
|
||||
|
||||
compat_client = compat_client_with_empty_stores
|
||||
|
||||
|
|
@ -710,7 +709,7 @@ def test_openai_vector_store_attach_files_on_creation(
|
|||
skip_if_provider_doesnt_support_openai_vector_stores(client_with_models)
|
||||
|
||||
compat_client = compat_client_with_empty_stores
|
||||
from llama_stack_api.files import ExpiresAfter
|
||||
from llama_stack_api import ExpiresAfter
|
||||
|
||||
# Create some files and attach them to the vector store
|
||||
valid_file_ids = []
|
||||
|
|
@ -775,7 +774,7 @@ def test_openai_vector_store_list_files(
|
|||
skip_if_provider_doesnt_support_openai_vector_stores(client_with_models)
|
||||
|
||||
compat_client = compat_client_with_empty_stores
|
||||
from llama_stack_api.files import ExpiresAfter
|
||||
from llama_stack_api import ExpiresAfter
|
||||
|
||||
# Create a vector store
|
||||
vector_store = compat_client.vector_stores.create(
|
||||
|
|
@ -867,7 +866,7 @@ def test_openai_vector_store_retrieve_file_contents(
|
|||
skip_if_provider_doesnt_support_openai_vector_stores(client_with_models)
|
||||
|
||||
compat_client = compat_client_with_empty_stores
|
||||
from llama_stack_api.files import ExpiresAfter
|
||||
from llama_stack_api import ExpiresAfter
|
||||
|
||||
# Create a vector store
|
||||
vector_store = compat_client.vector_stores.create(
|
||||
|
|
@ -928,7 +927,7 @@ def test_openai_vector_store_delete_file(
|
|||
skip_if_provider_doesnt_support_openai_vector_stores(client_with_models)
|
||||
|
||||
compat_client = compat_client_with_empty_stores
|
||||
from llama_stack_api.files import ExpiresAfter
|
||||
from llama_stack_api import ExpiresAfter
|
||||
|
||||
# Create a vector store
|
||||
vector_store = compat_client.vector_stores.create(
|
||||
|
|
@ -994,7 +993,7 @@ def test_openai_vector_store_delete_file_removes_from_vector_store(
|
|||
skip_if_provider_doesnt_support_openai_vector_stores(client_with_models)
|
||||
|
||||
compat_client = compat_client_with_empty_stores
|
||||
from llama_stack_api.files import ExpiresAfter
|
||||
from llama_stack_api import ExpiresAfter
|
||||
|
||||
# Create a vector store
|
||||
vector_store = compat_client.vector_stores.create(
|
||||
|
|
@ -1046,7 +1045,7 @@ def test_openai_vector_store_update_file(
|
|||
skip_if_provider_doesnt_support_openai_vector_stores(client_with_models)
|
||||
|
||||
compat_client = compat_client_with_empty_stores
|
||||
from llama_stack_api.files import ExpiresAfter
|
||||
from llama_stack_api import ExpiresAfter
|
||||
|
||||
# Create a vector store
|
||||
vector_store = compat_client.vector_stores.create(
|
||||
|
|
@ -1103,7 +1102,7 @@ def test_create_vector_store_files_duplicate_vector_store_name(
|
|||
This test confirms that client.vector_stores.create() creates a unique ID
|
||||
"""
|
||||
skip_if_provider_doesnt_support_openai_vector_stores(client_with_models)
|
||||
from llama_stack_api.files import ExpiresAfter
|
||||
from llama_stack_api import ExpiresAfter
|
||||
|
||||
compat_client = compat_client_with_empty_stores
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
# the root directory of this source tree.
|
||||
|
||||
import pytest
|
||||
from llama_stack_api.vector_io import Chunk
|
||||
from llama_stack_api import Chunk
|
||||
|
||||
from ..conftest import vector_provider_wrapper
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue