mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-03 09:53:45 +00:00
Merge remote-tracking branch 'upstream/main' into add-mcp-authentication-param
This commit is contained in:
commit
c2bf725a77
275 changed files with 1187 additions and 745 deletions
4
.github/workflows/python-build-test.yml
vendored
4
.github/workflows/python-build-test.yml
vendored
|
|
@ -31,7 +31,7 @@ jobs:
|
||||||
version: 0.7.6
|
version: 0.7.6
|
||||||
|
|
||||||
- name: Build Llama Stack API package
|
- name: Build Llama Stack API package
|
||||||
working-directory: src/llama-stack-api
|
working-directory: src/llama_stack_api
|
||||||
run: uv build
|
run: uv build
|
||||||
|
|
||||||
- name: Build Llama Stack package
|
- name: Build Llama Stack package
|
||||||
|
|
@ -39,7 +39,7 @@ jobs:
|
||||||
|
|
||||||
- name: Install Llama Stack package (with api stubs from local build)
|
- name: Install Llama Stack package (with api stubs from local build)
|
||||||
run: |
|
run: |
|
||||||
uv pip install --find-links src/llama-stack-api/dist dist/*.whl
|
uv pip install --find-links src/llama_stack_api/dist dist/*.whl
|
||||||
|
|
||||||
- name: Verify Llama Stack package
|
- name: Verify Llama Stack package
|
||||||
run: |
|
run: |
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ repos:
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff
|
- id: ruff
|
||||||
args: [ --fix ]
|
args: [ --fix ]
|
||||||
exclude: ^(src/llama_stack/strong_typing/.*|src/llama-stack-api/llama_stack_api/strong_typing/.*)$
|
exclude: ^(src/llama_stack_api/strong_typing/.*)$
|
||||||
- id: ruff-format
|
- id: ruff-format
|
||||||
|
|
||||||
- repo: https://github.com/adamchainz/blacken-docs
|
- repo: https://github.com/adamchainz/blacken-docs
|
||||||
|
|
|
||||||
|
|
@ -181,7 +181,7 @@ install-wheel-from-presigned = "llama_stack.cli.scripts.run:install_wheel_from_p
|
||||||
|
|
||||||
[tool.setuptools.packages.find]
|
[tool.setuptools.packages.find]
|
||||||
where = ["src"]
|
where = ["src"]
|
||||||
include = ["llama_stack", "llama_stack.*", "llama-stack-api", "llama-stack-api.*"]
|
include = ["llama_stack", "llama_stack.*", "llama_stack_api", "llama_stack_api.*"]
|
||||||
|
|
||||||
[[tool.uv.index]]
|
[[tool.uv.index]]
|
||||||
name = "pytorch-cpu"
|
name = "pytorch-cpu"
|
||||||
|
|
@ -191,7 +191,7 @@ explicit = true
|
||||||
[tool.uv.sources]
|
[tool.uv.sources]
|
||||||
torch = [{ index = "pytorch-cpu" }]
|
torch = [{ index = "pytorch-cpu" }]
|
||||||
torchvision = [{ index = "pytorch-cpu" }]
|
torchvision = [{ index = "pytorch-cpu" }]
|
||||||
llama-stack-api = [{ path = "src/llama-stack-api", editable = true }]
|
llama-stack-api = [{ path = "src/llama_stack_api", editable = true }]
|
||||||
|
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
line-length = 120
|
line-length = 120
|
||||||
|
|
@ -258,7 +258,7 @@ unfixable = [
|
||||||
] # Using import * is acceptable (or at least tolerated) in an __init__.py of a package API
|
] # Using import * is acceptable (or at least tolerated) in an __init__.py of a package API
|
||||||
|
|
||||||
[tool.mypy]
|
[tool.mypy]
|
||||||
mypy_path = ["src", "src/llama-stack-api"]
|
mypy_path = ["src"]
|
||||||
packages = ["llama_stack", "llama_stack_api"]
|
packages = ["llama_stack", "llama_stack_api"]
|
||||||
plugins = ['pydantic.mypy']
|
plugins = ['pydantic.mypy']
|
||||||
disable_error_code = []
|
disable_error_code = []
|
||||||
|
|
@ -281,14 +281,12 @@ exclude = [
|
||||||
"^src/llama_stack/core/store/registry\\.py$",
|
"^src/llama_stack/core/store/registry\\.py$",
|
||||||
"^src/llama_stack/core/utils/exec\\.py$",
|
"^src/llama_stack/core/utils/exec\\.py$",
|
||||||
"^src/llama_stack/core/utils/prompt_for_config\\.py$",
|
"^src/llama_stack/core/utils/prompt_for_config\\.py$",
|
||||||
# Moved to llama-stack-api but still excluded
|
|
||||||
"^src/llama_stack/models/llama/llama3/interface\\.py$",
|
"^src/llama_stack/models/llama/llama3/interface\\.py$",
|
||||||
"^src/llama_stack/models/llama/llama3/tokenizer\\.py$",
|
"^src/llama_stack/models/llama/llama3/tokenizer\\.py$",
|
||||||
"^src/llama_stack/models/llama/llama3/tool_utils\\.py$",
|
"^src/llama_stack/models/llama/llama3/tool_utils\\.py$",
|
||||||
"^src/llama_stack/models/llama/llama3/generation\\.py$",
|
"^src/llama_stack/models/llama/llama3/generation\\.py$",
|
||||||
"^src/llama_stack/models/llama/llama3/multimodal/model\\.py$",
|
"^src/llama_stack/models/llama/llama3/multimodal/model\\.py$",
|
||||||
"^src/llama_stack/models/llama/llama4/",
|
"^src/llama_stack/models/llama/llama4/",
|
||||||
"^src/llama-stack-api/llama_stack_api/core/telemetry/telemetry\\.py$",
|
|
||||||
"^src/llama_stack/providers/inline/agents/meta_reference/",
|
"^src/llama_stack/providers/inline/agents/meta_reference/",
|
||||||
"^src/llama_stack/providers/inline/datasetio/localfs/",
|
"^src/llama_stack/providers/inline/datasetio/localfs/",
|
||||||
"^src/llama_stack/providers/inline/eval/meta_reference/eval\\.py$",
|
"^src/llama_stack/providers/inline/eval/meta_reference/eval\\.py$",
|
||||||
|
|
@ -342,9 +340,7 @@ exclude = [
|
||||||
"^src/llama_stack/providers/utils/telemetry/dataset_mixin\\.py$",
|
"^src/llama_stack/providers/utils/telemetry/dataset_mixin\\.py$",
|
||||||
"^src/llama_stack/providers/utils/telemetry/trace_protocol\\.py$",
|
"^src/llama_stack/providers/utils/telemetry/trace_protocol\\.py$",
|
||||||
"^src/llama_stack/providers/utils/telemetry/tracing\\.py$",
|
"^src/llama_stack/providers/utils/telemetry/tracing\\.py$",
|
||||||
"^src/llama-stack-api/llama_stack_api/core/telemetry/trace_protocol\\.py$",
|
"^src/llama_stack_api/strong_typing/auxiliary\\.py$",
|
||||||
"^src/llama-stack-api/llama_stack_api/core/telemetry/tracing\\.py$",
|
|
||||||
"^src/llama-stack-api/llama_stack_api/strong_typing/auxiliary\\.py$",
|
|
||||||
"^src/llama_stack/distributions/template\\.py$",
|
"^src/llama_stack/distributions/template\\.py$",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,11 @@ import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import fire
|
import fire
|
||||||
from llama_stack_api import ModelNotFoundError
|
|
||||||
|
|
||||||
from llama_stack.models.llama.llama3.generation import Llama3
|
from llama_stack.models.llama.llama3.generation import Llama3
|
||||||
from llama_stack.models.llama.llama4.generation import Llama4
|
from llama_stack.models.llama.llama4.generation import Llama4
|
||||||
from llama_stack.models.llama.sku_list import resolve_model
|
from llama_stack.models.llama.sku_list import resolve_model
|
||||||
|
from llama_stack_api import ModelNotFoundError
|
||||||
|
|
||||||
THIS_DIR = Path(__file__).parent.resolve()
|
THIS_DIR = Path(__file__).parent.resolve()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
from llama_stack_api import Api
|
|
||||||
from termcolor import cprint
|
from termcolor import cprint
|
||||||
|
|
||||||
from llama_stack.cli.stack.utils import ImageType
|
from llama_stack.cli.stack.utils import ImageType
|
||||||
|
|
@ -22,6 +21,7 @@ from llama_stack.core.datatypes import (
|
||||||
from llama_stack.core.distribution import get_provider_registry
|
from llama_stack.core.distribution import get_provider_registry
|
||||||
from llama_stack.core.stack import replace_env_vars
|
from llama_stack.core.stack import replace_env_vars
|
||||||
from llama_stack.log import get_logger
|
from llama_stack.log import get_logger
|
||||||
|
from llama_stack_api import Api
|
||||||
|
|
||||||
TEMPLATES_PATH = Path(__file__).parent.parent.parent / "templates"
|
TEMPLATES_PATH = Path(__file__).parent.parent.parent / "templates"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ from functools import lru_cache
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
from llama_stack_api import Api
|
|
||||||
from termcolor import cprint
|
from termcolor import cprint
|
||||||
|
|
||||||
from llama_stack.core.datatypes import (
|
from llama_stack.core.datatypes import (
|
||||||
|
|
@ -33,6 +32,7 @@ from llama_stack.core.storage.datatypes import (
|
||||||
from llama_stack.core.utils.config_dirs import DISTRIBS_BASE_DIR, EXTERNAL_PROVIDERS_DIR
|
from llama_stack.core.utils.config_dirs import DISTRIBS_BASE_DIR, EXTERNAL_PROVIDERS_DIR
|
||||||
from llama_stack.core.utils.dynamic import instantiate_class_type
|
from llama_stack.core.utils.dynamic import instantiate_class_type
|
||||||
from llama_stack.core.utils.image_types import LlamaStackImageType
|
from llama_stack.core.utils.image_types import LlamaStackImageType
|
||||||
|
from llama_stack_api import Api
|
||||||
|
|
||||||
TEMPLATES_PATH = Path(__file__).parent.parent.parent / "distributions"
|
TEMPLATES_PATH = Path(__file__).parent.parent.parent / "distributions"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from llama_stack_api import Api
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
from termcolor import cprint
|
from termcolor import cprint
|
||||||
|
|
||||||
|
|
@ -14,6 +13,7 @@ from llama_stack.core.datatypes import BuildConfig
|
||||||
from llama_stack.core.distribution import get_provider_registry
|
from llama_stack.core.distribution import get_provider_registry
|
||||||
from llama_stack.distributions.template import DistributionTemplate
|
from llama_stack.distributions.template import DistributionTemplate
|
||||||
from llama_stack.log import get_logger
|
from llama_stack.log import get_logger
|
||||||
|
from llama_stack_api import Api
|
||||||
|
|
||||||
log = get_logger(name=__name__, category="core")
|
log = get_logger(name=__name__, category="core")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,11 @@ from enum import Enum
|
||||||
from typing import Any, Union, get_args, get_origin
|
from typing import Any, Union, get_args, get_origin
|
||||||
|
|
||||||
import httpx
|
import httpx
|
||||||
from llama_stack_api import RemoteProviderConfig
|
|
||||||
from pydantic import BaseModel, parse_obj_as
|
from pydantic import BaseModel, parse_obj_as
|
||||||
from termcolor import cprint
|
from termcolor import cprint
|
||||||
|
|
||||||
|
from llama_stack_api import RemoteProviderConfig
|
||||||
|
|
||||||
_CLIENT_CLASSES = {}
|
_CLIENT_CLASSES = {}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,6 @@
|
||||||
import textwrap
|
import textwrap
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from llama_stack_api import Api, ProviderSpec
|
|
||||||
|
|
||||||
from llama_stack.core.datatypes import (
|
from llama_stack.core.datatypes import (
|
||||||
LLAMA_STACK_RUN_CONFIG_VERSION,
|
LLAMA_STACK_RUN_CONFIG_VERSION,
|
||||||
DistributionSpec,
|
DistributionSpec,
|
||||||
|
|
@ -22,6 +20,7 @@ from llama_stack.core.stack import cast_image_name_to_string, replace_env_vars
|
||||||
from llama_stack.core.utils.dynamic import instantiate_class_type
|
from llama_stack.core.utils.dynamic import instantiate_class_type
|
||||||
from llama_stack.core.utils.prompt_for_config import prompt_for_config
|
from llama_stack.core.utils.prompt_for_config import prompt_for_config
|
||||||
from llama_stack.log import get_logger
|
from llama_stack.log import get_logger
|
||||||
|
from llama_stack_api import Api, ProviderSpec
|
||||||
|
|
||||||
logger = get_logger(name=__name__, category="core")
|
logger = get_logger(name=__name__, category="core")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,13 @@ import secrets
|
||||||
import time
|
import time
|
||||||
from typing import Any, Literal
|
from typing import Any, Literal
|
||||||
|
|
||||||
|
from pydantic import BaseModel, TypeAdapter
|
||||||
|
|
||||||
|
from llama_stack.core.datatypes import AccessRule, StackRunConfig
|
||||||
|
from llama_stack.log import get_logger
|
||||||
|
from llama_stack.providers.utils.sqlstore.api import ColumnDefinition, ColumnType
|
||||||
|
from llama_stack.providers.utils.sqlstore.authorized_sqlstore import AuthorizedSqlStore
|
||||||
|
from llama_stack.providers.utils.sqlstore.sqlstore import sqlstore_impl
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
Conversation,
|
Conversation,
|
||||||
ConversationDeletedResource,
|
ConversationDeletedResource,
|
||||||
|
|
@ -18,13 +25,6 @@ from llama_stack_api import (
|
||||||
Conversations,
|
Conversations,
|
||||||
Metadata,
|
Metadata,
|
||||||
)
|
)
|
||||||
from pydantic import BaseModel, TypeAdapter
|
|
||||||
|
|
||||||
from llama_stack.core.datatypes import AccessRule, StackRunConfig
|
|
||||||
from llama_stack.log import get_logger
|
|
||||||
from llama_stack.providers.utils.sqlstore.api import ColumnDefinition, ColumnType
|
|
||||||
from llama_stack.providers.utils.sqlstore.authorized_sqlstore import AuthorizedSqlStore
|
|
||||||
from llama_stack.providers.utils.sqlstore.sqlstore import sqlstore_impl
|
|
||||||
|
|
||||||
logger = get_logger(name=__name__, category="openai_conversations")
|
logger = get_logger(name=__name__, category="openai_conversations")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,15 @@ from pathlib import Path
|
||||||
from typing import Annotated, Any, Literal, Self
|
from typing import Annotated, Any, Literal, Self
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
|
from pydantic import BaseModel, Field, field_validator, model_validator
|
||||||
|
|
||||||
|
from llama_stack.core.access_control.datatypes import AccessRule
|
||||||
|
from llama_stack.core.storage.datatypes import (
|
||||||
|
KVStoreReference,
|
||||||
|
StorageBackendType,
|
||||||
|
StorageConfig,
|
||||||
|
)
|
||||||
|
from llama_stack.log import LoggingConfig
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
Api,
|
Api,
|
||||||
Benchmark,
|
Benchmark,
|
||||||
|
|
@ -35,15 +44,6 @@ from llama_stack_api import (
|
||||||
VectorStore,
|
VectorStore,
|
||||||
VectorStoreInput,
|
VectorStoreInput,
|
||||||
)
|
)
|
||||||
from pydantic import BaseModel, Field, field_validator, model_validator
|
|
||||||
|
|
||||||
from llama_stack.core.access_control.datatypes import AccessRule
|
|
||||||
from llama_stack.core.storage.datatypes import (
|
|
||||||
KVStoreReference,
|
|
||||||
StorageBackendType,
|
|
||||||
StorageConfig,
|
|
||||||
)
|
|
||||||
from llama_stack.log import LoggingConfig
|
|
||||||
|
|
||||||
LLAMA_STACK_BUILD_CONFIG_VERSION = 2
|
LLAMA_STACK_BUILD_CONFIG_VERSION = 2
|
||||||
LLAMA_STACK_RUN_CONFIG_VERSION = 2
|
LLAMA_STACK_RUN_CONFIG_VERSION = 2
|
||||||
|
|
|
||||||
|
|
@ -10,17 +10,17 @@ import os
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
from llama_stack.core.datatypes import BuildConfig, DistributionSpec
|
||||||
|
from llama_stack.core.external import load_external_apis
|
||||||
|
from llama_stack.log import get_logger
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
Api,
|
Api,
|
||||||
InlineProviderSpec,
|
InlineProviderSpec,
|
||||||
ProviderSpec,
|
ProviderSpec,
|
||||||
RemoteProviderSpec,
|
RemoteProviderSpec,
|
||||||
)
|
)
|
||||||
from pydantic import BaseModel
|
|
||||||
|
|
||||||
from llama_stack.core.datatypes import BuildConfig, DistributionSpec
|
|
||||||
from llama_stack.core.external import load_external_apis
|
|
||||||
from llama_stack.log import get_logger
|
|
||||||
|
|
||||||
logger = get_logger(name=__name__, category="core")
|
logger = get_logger(name=__name__, category="core")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@
|
||||||
|
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
from llama_stack_api import Api, ExternalApiSpec
|
|
||||||
|
|
||||||
from llama_stack.core.datatypes import BuildConfig, StackRunConfig
|
from llama_stack.core.datatypes import BuildConfig, StackRunConfig
|
||||||
from llama_stack.log import get_logger
|
from llama_stack.log import get_logger
|
||||||
|
from llama_stack_api import Api, ExternalApiSpec
|
||||||
|
|
||||||
logger = get_logger(name=__name__, category="core")
|
logger = get_logger(name=__name__, category="core")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,11 @@
|
||||||
|
|
||||||
from importlib.metadata import version
|
from importlib.metadata import version
|
||||||
|
|
||||||
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
from llama_stack.core.datatypes import StackRunConfig
|
||||||
|
from llama_stack.core.external import load_external_apis
|
||||||
|
from llama_stack.core.server.routes import get_all_api_routes
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
HealthInfo,
|
HealthInfo,
|
||||||
HealthStatus,
|
HealthStatus,
|
||||||
|
|
@ -14,11 +19,6 @@ from llama_stack_api import (
|
||||||
RouteInfo,
|
RouteInfo,
|
||||||
VersionInfo,
|
VersionInfo,
|
||||||
)
|
)
|
||||||
from pydantic import BaseModel
|
|
||||||
|
|
||||||
from llama_stack.core.datatypes import StackRunConfig
|
|
||||||
from llama_stack.core.external import load_external_apis
|
|
||||||
from llama_stack.core.server.routes import get_all_api_routes
|
|
||||||
|
|
||||||
|
|
||||||
class DistributionInspectConfig(BaseModel):
|
class DistributionInspectConfig(BaseModel):
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ from typing import Any, TypeVar, Union, get_args, get_origin
|
||||||
import httpx
|
import httpx
|
||||||
import yaml
|
import yaml
|
||||||
from fastapi import Response as FastAPIResponse
|
from fastapi import Response as FastAPIResponse
|
||||||
|
|
||||||
from llama_stack_api import is_unwrapped_body_param
|
from llama_stack_api import is_unwrapped_body_param
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,11 @@
|
||||||
import json
|
import json
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from llama_stack_api import ListPromptsResponse, Prompt, Prompts
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
from llama_stack.core.datatypes import StackRunConfig
|
from llama_stack.core.datatypes import StackRunConfig
|
||||||
from llama_stack.providers.utils.kvstore import KVStore, kvstore_impl
|
from llama_stack.providers.utils.kvstore import KVStore, kvstore_impl
|
||||||
|
from llama_stack_api import ListPromptsResponse, Prompt, Prompts
|
||||||
|
|
||||||
|
|
||||||
class PromptServiceConfig(BaseModel):
|
class PromptServiceConfig(BaseModel):
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,10 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from llama_stack_api import HealthResponse, HealthStatus, ListProvidersResponse, ProviderInfo, Providers
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
from llama_stack.log import get_logger
|
from llama_stack.log import get_logger
|
||||||
|
from llama_stack_api import HealthResponse, HealthStatus, ListProvidersResponse, ProviderInfo, Providers
|
||||||
|
|
||||||
from .datatypes import StackRunConfig
|
from .datatypes import StackRunConfig
|
||||||
from .utils.config import redact_sensitive_fields
|
from .utils.config import redact_sensitive_fields
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,19 @@ import importlib.metadata
|
||||||
import inspect
|
import inspect
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
from llama_stack.core.client import get_client_impl
|
||||||
|
from llama_stack.core.datatypes import (
|
||||||
|
AccessRule,
|
||||||
|
AutoRoutedProviderSpec,
|
||||||
|
Provider,
|
||||||
|
RoutingTableProviderSpec,
|
||||||
|
StackRunConfig,
|
||||||
|
)
|
||||||
|
from llama_stack.core.distribution import builtin_automatically_routed_apis
|
||||||
|
from llama_stack.core.external import load_external_apis
|
||||||
|
from llama_stack.core.store import DistributionRegistry
|
||||||
|
from llama_stack.core.utils.dynamic import instantiate_class_type
|
||||||
|
from llama_stack.log import get_logger
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
LLAMA_STACK_API_V1ALPHA,
|
LLAMA_STACK_API_V1ALPHA,
|
||||||
Agents,
|
Agents,
|
||||||
|
|
@ -48,20 +61,6 @@ from llama_stack_api import (
|
||||||
Providers as ProvidersAPI,
|
Providers as ProvidersAPI,
|
||||||
)
|
)
|
||||||
|
|
||||||
from llama_stack.core.client import get_client_impl
|
|
||||||
from llama_stack.core.datatypes import (
|
|
||||||
AccessRule,
|
|
||||||
AutoRoutedProviderSpec,
|
|
||||||
Provider,
|
|
||||||
RoutingTableProviderSpec,
|
|
||||||
StackRunConfig,
|
|
||||||
)
|
|
||||||
from llama_stack.core.distribution import builtin_automatically_routed_apis
|
|
||||||
from llama_stack.core.external import load_external_apis
|
|
||||||
from llama_stack.core.store import DistributionRegistry
|
|
||||||
from llama_stack.core.utils.dynamic import instantiate_class_type
|
|
||||||
from llama_stack.log import get_logger
|
|
||||||
|
|
||||||
logger = get_logger(name=__name__, category="core")
|
logger = get_logger(name=__name__, category="core")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,6 @@
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from llama_stack_api import Api, RoutingTable
|
|
||||||
|
|
||||||
from llama_stack.core.datatypes import (
|
from llama_stack.core.datatypes import (
|
||||||
AccessRule,
|
AccessRule,
|
||||||
RoutedProtocol,
|
RoutedProtocol,
|
||||||
|
|
@ -15,6 +13,7 @@ from llama_stack.core.datatypes import (
|
||||||
from llama_stack.core.stack import StackRunConfig
|
from llama_stack.core.stack import StackRunConfig
|
||||||
from llama_stack.core.store import DistributionRegistry
|
from llama_stack.core.store import DistributionRegistry
|
||||||
from llama_stack.providers.utils.inference.inference_store import InferenceStore
|
from llama_stack.providers.utils.inference.inference_store import InferenceStore
|
||||||
|
from llama_stack_api import Api, RoutingTable
|
||||||
|
|
||||||
|
|
||||||
async def get_routing_table_impl(
|
async def get_routing_table_impl(
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,8 @@
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from llama_stack_api import DatasetIO, DatasetPurpose, DataSource, PaginatedResponse, RoutingTable
|
|
||||||
|
|
||||||
from llama_stack.log import get_logger
|
from llama_stack.log import get_logger
|
||||||
|
from llama_stack_api import DatasetIO, DatasetPurpose, DataSource, PaginatedResponse, RoutingTable
|
||||||
|
|
||||||
logger = get_logger(name=__name__, category="core::routers")
|
logger = get_logger(name=__name__, category="core::routers")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
from llama_stack.log import get_logger
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
BenchmarkConfig,
|
BenchmarkConfig,
|
||||||
Eval,
|
Eval,
|
||||||
|
|
@ -18,8 +19,6 @@ from llama_stack_api import (
|
||||||
ScoringFnParams,
|
ScoringFnParams,
|
||||||
)
|
)
|
||||||
|
|
||||||
from llama_stack.log import get_logger
|
|
||||||
|
|
||||||
logger = get_logger(name=__name__, category="core::routers")
|
logger = get_logger(name=__name__, category="core::routers")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,16 @@ from datetime import UTC, datetime
|
||||||
from typing import Annotated, Any
|
from typing import Annotated, Any
|
||||||
|
|
||||||
from fastapi import Body
|
from fastapi import Body
|
||||||
|
from openai.types.chat import ChatCompletionToolChoiceOptionParam as OpenAIChatCompletionToolChoiceOptionParam
|
||||||
|
from openai.types.chat import ChatCompletionToolParam as OpenAIChatCompletionToolParam
|
||||||
|
from pydantic import TypeAdapter
|
||||||
|
|
||||||
|
from llama_stack.core.telemetry.telemetry import MetricEvent
|
||||||
|
from llama_stack.core.telemetry.tracing import enqueue_event, get_current_span
|
||||||
|
from llama_stack.log import get_logger
|
||||||
|
from llama_stack.models.llama.llama3.chat_format import ChatFormat
|
||||||
|
from llama_stack.models.llama.llama3.tokenizer import Tokenizer
|
||||||
|
from llama_stack.providers.utils.inference.inference_store import InferenceStore
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
HealthResponse,
|
HealthResponse,
|
||||||
HealthStatus,
|
HealthStatus,
|
||||||
|
|
@ -39,16 +49,6 @@ from llama_stack_api import (
|
||||||
RerankResponse,
|
RerankResponse,
|
||||||
RoutingTable,
|
RoutingTable,
|
||||||
)
|
)
|
||||||
from openai.types.chat import ChatCompletionToolChoiceOptionParam as OpenAIChatCompletionToolChoiceOptionParam
|
|
||||||
from openai.types.chat import ChatCompletionToolParam as OpenAIChatCompletionToolParam
|
|
||||||
from pydantic import TypeAdapter
|
|
||||||
|
|
||||||
from llama_stack.core.telemetry.telemetry import MetricEvent
|
|
||||||
from llama_stack.core.telemetry.tracing import enqueue_event, get_current_span
|
|
||||||
from llama_stack.log import get_logger
|
|
||||||
from llama_stack.models.llama.llama3.chat_format import ChatFormat
|
|
||||||
from llama_stack.models.llama.llama3.tokenizer import Tokenizer
|
|
||||||
from llama_stack.providers.utils.inference.inference_store import InferenceStore
|
|
||||||
|
|
||||||
logger = get_logger(name=__name__, category="core::routers")
|
logger = get_logger(name=__name__, category="core::routers")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,9 @@
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from llama_stack_api import ModerationObject, OpenAIMessageParam, RoutingTable, RunShieldResponse, Safety, Shield
|
|
||||||
|
|
||||||
from llama_stack.core.datatypes import SafetyConfig
|
from llama_stack.core.datatypes import SafetyConfig
|
||||||
from llama_stack.log import get_logger
|
from llama_stack.log import get_logger
|
||||||
|
from llama_stack_api import ModerationObject, OpenAIMessageParam, RoutingTable, RunShieldResponse, Safety, Shield
|
||||||
|
|
||||||
logger = get_logger(name=__name__, category="core::routers")
|
logger = get_logger(name=__name__, category="core::routers")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,14 +6,13 @@
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
from llama_stack.log import get_logger
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
URL,
|
URL,
|
||||||
ListToolDefsResponse,
|
ListToolDefsResponse,
|
||||||
ToolRuntime,
|
ToolRuntime,
|
||||||
)
|
)
|
||||||
|
|
||||||
from llama_stack.log import get_logger
|
|
||||||
|
|
||||||
from ..routing_tables.toolgroups import ToolGroupsRoutingTable
|
from ..routing_tables.toolgroups import ToolGroupsRoutingTable
|
||||||
|
|
||||||
logger = get_logger(name=__name__, category="core::routers")
|
logger = get_logger(name=__name__, category="core::routers")
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,9 @@ import uuid
|
||||||
from typing import Annotated, Any
|
from typing import Annotated, Any
|
||||||
|
|
||||||
from fastapi import Body
|
from fastapi import Body
|
||||||
|
|
||||||
|
from llama_stack.core.datatypes import VectorStoresConfig
|
||||||
|
from llama_stack.log import get_logger
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
Chunk,
|
Chunk,
|
||||||
HealthResponse,
|
HealthResponse,
|
||||||
|
|
@ -38,9 +41,6 @@ from llama_stack_api import (
|
||||||
VectorStoreSearchResponsePage,
|
VectorStoreSearchResponsePage,
|
||||||
)
|
)
|
||||||
|
|
||||||
from llama_stack.core.datatypes import VectorStoresConfig
|
|
||||||
from llama_stack.log import get_logger
|
|
||||||
|
|
||||||
logger = get_logger(name=__name__, category="core::routers")
|
logger = get_logger(name=__name__, category="core::routers")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,11 @@
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from llama_stack_api import Benchmark, Benchmarks, ListBenchmarksResponse
|
|
||||||
|
|
||||||
from llama_stack.core.datatypes import (
|
from llama_stack.core.datatypes import (
|
||||||
BenchmarkWithOwner,
|
BenchmarkWithOwner,
|
||||||
)
|
)
|
||||||
from llama_stack.log import get_logger
|
from llama_stack.log import get_logger
|
||||||
|
from llama_stack_api import Benchmark, Benchmarks, ListBenchmarksResponse
|
||||||
|
|
||||||
from .common import CommonRoutingTableImpl
|
from .common import CommonRoutingTableImpl
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,6 @@
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from llama_stack_api import Api, Model, ModelNotFoundError, ResourceType, RoutingTable
|
|
||||||
|
|
||||||
from llama_stack.core.access_control.access_control import AccessDeniedError, is_action_allowed
|
from llama_stack.core.access_control.access_control import AccessDeniedError, is_action_allowed
|
||||||
from llama_stack.core.access_control.datatypes import Action
|
from llama_stack.core.access_control.datatypes import Action
|
||||||
from llama_stack.core.datatypes import (
|
from llama_stack.core.datatypes import (
|
||||||
|
|
@ -20,6 +18,7 @@ from llama_stack.core.datatypes import (
|
||||||
from llama_stack.core.request_headers import get_authenticated_user
|
from llama_stack.core.request_headers import get_authenticated_user
|
||||||
from llama_stack.core.store import DistributionRegistry
|
from llama_stack.core.store import DistributionRegistry
|
||||||
from llama_stack.log import get_logger
|
from llama_stack.log import get_logger
|
||||||
|
from llama_stack_api import Api, Model, ModelNotFoundError, ResourceType, RoutingTable
|
||||||
|
|
||||||
logger = get_logger(name=__name__, category="core::routing_tables")
|
logger = get_logger(name=__name__, category="core::routing_tables")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,10 @@
|
||||||
import uuid
|
import uuid
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
from llama_stack.core.datatypes import (
|
||||||
|
DatasetWithOwner,
|
||||||
|
)
|
||||||
|
from llama_stack.log import get_logger
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
Dataset,
|
Dataset,
|
||||||
DatasetNotFoundError,
|
DatasetNotFoundError,
|
||||||
|
|
@ -20,11 +24,6 @@ from llama_stack_api import (
|
||||||
URIDataSource,
|
URIDataSource,
|
||||||
)
|
)
|
||||||
|
|
||||||
from llama_stack.core.datatypes import (
|
|
||||||
DatasetWithOwner,
|
|
||||||
)
|
|
||||||
from llama_stack.log import get_logger
|
|
||||||
|
|
||||||
from .common import CommonRoutingTableImpl
|
from .common import CommonRoutingTableImpl
|
||||||
|
|
||||||
logger = get_logger(name=__name__, category="core::routing_tables")
|
logger = get_logger(name=__name__, category="core::routing_tables")
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,13 @@
|
||||||
import time
|
import time
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
from llama_stack.core.datatypes import (
|
||||||
|
ModelWithOwner,
|
||||||
|
RegistryEntrySource,
|
||||||
|
)
|
||||||
|
from llama_stack.core.request_headers import PROVIDER_DATA_VAR, NeedsRequestProviderData
|
||||||
|
from llama_stack.core.utils.dynamic import instantiate_class_type
|
||||||
|
from llama_stack.log import get_logger
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
ListModelsResponse,
|
ListModelsResponse,
|
||||||
Model,
|
Model,
|
||||||
|
|
@ -17,14 +24,6 @@ from llama_stack_api import (
|
||||||
OpenAIModel,
|
OpenAIModel,
|
||||||
)
|
)
|
||||||
|
|
||||||
from llama_stack.core.datatypes import (
|
|
||||||
ModelWithOwner,
|
|
||||||
RegistryEntrySource,
|
|
||||||
)
|
|
||||||
from llama_stack.core.request_headers import PROVIDER_DATA_VAR, NeedsRequestProviderData
|
|
||||||
from llama_stack.core.utils.dynamic import instantiate_class_type
|
|
||||||
from llama_stack.log import get_logger
|
|
||||||
|
|
||||||
from .common import CommonRoutingTableImpl, lookup_model
|
from .common import CommonRoutingTableImpl, lookup_model
|
||||||
|
|
||||||
logger = get_logger(name=__name__, category="core::routing_tables")
|
logger = get_logger(name=__name__, category="core::routing_tables")
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,10 @@
|
||||||
# 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 llama_stack.core.datatypes import (
|
||||||
|
ScoringFnWithOwner,
|
||||||
|
)
|
||||||
|
from llama_stack.log import get_logger
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
ListScoringFunctionsResponse,
|
ListScoringFunctionsResponse,
|
||||||
ParamType,
|
ParamType,
|
||||||
|
|
@ -13,11 +17,6 @@ from llama_stack_api import (
|
||||||
ScoringFunctions,
|
ScoringFunctions,
|
||||||
)
|
)
|
||||||
|
|
||||||
from llama_stack.core.datatypes import (
|
|
||||||
ScoringFnWithOwner,
|
|
||||||
)
|
|
||||||
from llama_stack.log import get_logger
|
|
||||||
|
|
||||||
from .common import CommonRoutingTableImpl
|
from .common import CommonRoutingTableImpl
|
||||||
|
|
||||||
logger = get_logger(name=__name__, category="core::routing_tables")
|
logger = get_logger(name=__name__, category="core::routing_tables")
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,11 @@
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from llama_stack_api import ListShieldsResponse, ResourceType, Shield, Shields
|
|
||||||
|
|
||||||
from llama_stack.core.datatypes import (
|
from llama_stack.core.datatypes import (
|
||||||
ShieldWithOwner,
|
ShieldWithOwner,
|
||||||
)
|
)
|
||||||
from llama_stack.log import get_logger
|
from llama_stack.log import get_logger
|
||||||
|
from llama_stack_api import ListShieldsResponse, ResourceType, Shield, Shields
|
||||||
|
|
||||||
from .common import CommonRoutingTableImpl
|
from .common import CommonRoutingTableImpl
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
from llama_stack.core.datatypes import AuthenticationRequiredError, ToolGroupWithOwner
|
||||||
|
from llama_stack.log import get_logger
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
URL,
|
URL,
|
||||||
ListToolDefsResponse,
|
ListToolDefsResponse,
|
||||||
|
|
@ -16,9 +18,6 @@ from llama_stack_api import (
|
||||||
ToolGroups,
|
ToolGroups,
|
||||||
)
|
)
|
||||||
|
|
||||||
from llama_stack.core.datatypes import AuthenticationRequiredError, ToolGroupWithOwner
|
|
||||||
from llama_stack.log import get_logger
|
|
||||||
|
|
||||||
from .common import CommonRoutingTableImpl
|
from .common import CommonRoutingTableImpl
|
||||||
|
|
||||||
logger = get_logger(name=__name__, category="core::routing_tables")
|
logger = get_logger(name=__name__, category="core::routing_tables")
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,11 @@
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
from llama_stack.core.datatypes import (
|
||||||
|
VectorStoreWithOwner,
|
||||||
|
)
|
||||||
|
from llama_stack.log import get_logger
|
||||||
|
|
||||||
# Removed VectorStores import to avoid exposing public API
|
# Removed VectorStores import to avoid exposing public API
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
ModelNotFoundError,
|
ModelNotFoundError,
|
||||||
|
|
@ -23,11 +28,6 @@ from llama_stack_api import (
|
||||||
VectorStoreSearchResponsePage,
|
VectorStoreSearchResponsePage,
|
||||||
)
|
)
|
||||||
|
|
||||||
from llama_stack.core.datatypes import (
|
|
||||||
VectorStoreWithOwner,
|
|
||||||
)
|
|
||||||
from llama_stack.log import get_logger
|
|
||||||
|
|
||||||
from .common import CommonRoutingTableImpl, lookup_model
|
from .common import CommonRoutingTableImpl, lookup_model
|
||||||
|
|
||||||
logger = get_logger(name=__name__, category="core::routing_tables")
|
logger = get_logger(name=__name__, category="core::routing_tables")
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ from urllib.parse import parse_qs, urljoin, urlparse
|
||||||
|
|
||||||
import httpx
|
import httpx
|
||||||
import jwt
|
import jwt
|
||||||
from llama_stack_api import TokenValidationError
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
from llama_stack.core.datatypes import (
|
from llama_stack.core.datatypes import (
|
||||||
|
|
@ -23,6 +22,7 @@ from llama_stack.core.datatypes import (
|
||||||
User,
|
User,
|
||||||
)
|
)
|
||||||
from llama_stack.log import get_logger
|
from llama_stack.log import get_logger
|
||||||
|
from llama_stack_api import TokenValidationError
|
||||||
|
|
||||||
logger = get_logger(name=__name__, category="core::auth")
|
logger = get_logger(name=__name__, category="core::auth")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,10 @@ from collections.abc import Callable
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from aiohttp import hdrs
|
from aiohttp import hdrs
|
||||||
from llama_stack_api import Api, ExternalApiSpec, WebMethod
|
|
||||||
from starlette.routing import Route
|
from starlette.routing import Route
|
||||||
|
|
||||||
from llama_stack.core.resolver import api_protocol_map
|
from llama_stack.core.resolver import api_protocol_map
|
||||||
|
from llama_stack_api import Api, ExternalApiSpec, WebMethod
|
||||||
|
|
||||||
EndpointFunc = Callable[..., Any]
|
EndpointFunc = Callable[..., Any]
|
||||||
PathParams = dict[str, str]
|
PathParams = dict[str, str]
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ from fastapi import Path as FastapiPath
|
||||||
from fastapi.exceptions import RequestValidationError
|
from fastapi.exceptions import RequestValidationError
|
||||||
from fastapi.middleware.cors import CORSMiddleware
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
from fastapi.responses import JSONResponse, StreamingResponse
|
from fastapi.responses import JSONResponse, StreamingResponse
|
||||||
from llama_stack_api import Api, ConflictError, PaginatedResponse, ResourceNotFoundError
|
|
||||||
from openai import BadRequestError
|
from openai import BadRequestError
|
||||||
from pydantic import BaseModel, ValidationError
|
from pydantic import BaseModel, ValidationError
|
||||||
|
|
||||||
|
|
@ -57,6 +56,7 @@ from llama_stack.core.utils.config import redact_sensitive_fields
|
||||||
from llama_stack.core.utils.config_resolution import Mode, resolve_config_or_distro
|
from llama_stack.core.utils.config_resolution import Mode, resolve_config_or_distro
|
||||||
from llama_stack.core.utils.context import preserve_contexts_async_generator
|
from llama_stack.core.utils.context import preserve_contexts_async_generator
|
||||||
from llama_stack.log import LoggingConfig, get_logger, setup_logging
|
from llama_stack.log import LoggingConfig, get_logger, setup_logging
|
||||||
|
from llama_stack_api import Api, ConflictError, PaginatedResponse, ResourceNotFoundError
|
||||||
|
|
||||||
from .auth import AuthenticationMiddleware
|
from .auth import AuthenticationMiddleware
|
||||||
from .quota import QuotaMiddleware
|
from .quota import QuotaMiddleware
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,28 @@ import tempfile
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
|
from llama_stack.core.conversations.conversations import ConversationServiceConfig, ConversationServiceImpl
|
||||||
|
from llama_stack.core.datatypes import Provider, SafetyConfig, StackRunConfig, VectorStoresConfig
|
||||||
|
from llama_stack.core.distribution import get_provider_registry
|
||||||
|
from llama_stack.core.inspect import DistributionInspectConfig, DistributionInspectImpl
|
||||||
|
from llama_stack.core.prompts.prompts import PromptServiceConfig, PromptServiceImpl
|
||||||
|
from llama_stack.core.providers import ProviderImpl, ProviderImplConfig
|
||||||
|
from llama_stack.core.resolver import ProviderRegistry, resolve_impls
|
||||||
|
from llama_stack.core.routing_tables.common import CommonRoutingTableImpl
|
||||||
|
from llama_stack.core.storage.datatypes import (
|
||||||
|
InferenceStoreReference,
|
||||||
|
KVStoreReference,
|
||||||
|
ServerStoresConfig,
|
||||||
|
SqliteKVStoreConfig,
|
||||||
|
SqliteSqlStoreConfig,
|
||||||
|
SqlStoreReference,
|
||||||
|
StorageBackendConfig,
|
||||||
|
StorageConfig,
|
||||||
|
)
|
||||||
|
from llama_stack.core.store.registry import create_dist_registry
|
||||||
|
from llama_stack.core.utils.dynamic import instantiate_class_type
|
||||||
|
from llama_stack.log import get_logger
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
Agents,
|
Agents,
|
||||||
Api,
|
Api,
|
||||||
|
|
@ -37,28 +59,6 @@ from llama_stack_api import (
|
||||||
VectorIO,
|
VectorIO,
|
||||||
)
|
)
|
||||||
|
|
||||||
from llama_stack.core.conversations.conversations import ConversationServiceConfig, ConversationServiceImpl
|
|
||||||
from llama_stack.core.datatypes import Provider, SafetyConfig, StackRunConfig, VectorStoresConfig
|
|
||||||
from llama_stack.core.distribution import get_provider_registry
|
|
||||||
from llama_stack.core.inspect import DistributionInspectConfig, DistributionInspectImpl
|
|
||||||
from llama_stack.core.prompts.prompts import PromptServiceConfig, PromptServiceImpl
|
|
||||||
from llama_stack.core.providers import ProviderImpl, ProviderImplConfig
|
|
||||||
from llama_stack.core.resolver import ProviderRegistry, resolve_impls
|
|
||||||
from llama_stack.core.routing_tables.common import CommonRoutingTableImpl
|
|
||||||
from llama_stack.core.storage.datatypes import (
|
|
||||||
InferenceStoreReference,
|
|
||||||
KVStoreReference,
|
|
||||||
ServerStoresConfig,
|
|
||||||
SqliteKVStoreConfig,
|
|
||||||
SqliteSqlStoreConfig,
|
|
||||||
SqlStoreReference,
|
|
||||||
StorageBackendConfig,
|
|
||||||
StorageConfig,
|
|
||||||
)
|
|
||||||
from llama_stack.core.store.registry import create_dist_registry
|
|
||||||
from llama_stack.core.utils.dynamic import instantiate_class_type
|
|
||||||
from llama_stack.log import get_logger
|
|
||||||
|
|
||||||
logger = get_logger(name=__name__, category="core")
|
logger = get_logger(name=__name__, category="core")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ from typing import (
|
||||||
cast,
|
cast,
|
||||||
)
|
)
|
||||||
|
|
||||||
from llama_stack_api import json_schema_type, register_schema
|
|
||||||
from opentelemetry import metrics, trace
|
from opentelemetry import metrics, trace
|
||||||
from opentelemetry.exporter.otlp.proto.http.metric_exporter import OTLPMetricExporter
|
from opentelemetry.exporter.otlp.proto.http.metric_exporter import OTLPMetricExporter
|
||||||
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
|
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
|
||||||
|
|
@ -29,6 +28,7 @@ from pydantic import BaseModel, Field
|
||||||
|
|
||||||
from llama_stack.log import get_logger
|
from llama_stack.log import get_logger
|
||||||
from llama_stack.models.llama.datatypes import Primitive
|
from llama_stack.models.llama.datatypes import Primitive
|
||||||
|
from llama_stack_api import json_schema_type, register_schema
|
||||||
|
|
||||||
ROOT_SPAN_MARKERS = ["__root__", "__root_span__"]
|
ROOT_SPAN_MARKERS = ["__root__", "__root_span__"]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,6 @@
|
||||||
# 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 llama_stack_api import ModelType
|
|
||||||
|
|
||||||
from llama_stack.core.datatypes import (
|
from llama_stack.core.datatypes import (
|
||||||
BuildProvider,
|
BuildProvider,
|
||||||
ModelInput,
|
ModelInput,
|
||||||
|
|
@ -18,6 +16,7 @@ from llama_stack.providers.inline.inference.sentence_transformers import (
|
||||||
SentenceTransformersInferenceConfig,
|
SentenceTransformersInferenceConfig,
|
||||||
)
|
)
|
||||||
from llama_stack.providers.remote.vector_io.chroma import ChromaVectorIOConfig
|
from llama_stack.providers.remote.vector_io.chroma import ChromaVectorIOConfig
|
||||||
|
from llama_stack_api import ModelType
|
||||||
|
|
||||||
|
|
||||||
def get_distribution_template() -> DistributionTemplate:
|
def get_distribution_template() -> DistributionTemplate:
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,6 @@
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from llama_stack_api import ModelType
|
|
||||||
|
|
||||||
from llama_stack.core.datatypes import (
|
from llama_stack.core.datatypes import (
|
||||||
BuildProvider,
|
BuildProvider,
|
||||||
ModelInput,
|
ModelInput,
|
||||||
|
|
@ -23,6 +21,7 @@ from llama_stack.providers.inline.inference.sentence_transformers import (
|
||||||
SentenceTransformersInferenceConfig,
|
SentenceTransformersInferenceConfig,
|
||||||
)
|
)
|
||||||
from llama_stack.providers.inline.vector_io.faiss.config import FaissVectorIOConfig
|
from llama_stack.providers.inline.vector_io.faiss.config import FaissVectorIOConfig
|
||||||
|
from llama_stack_api import ModelType
|
||||||
|
|
||||||
|
|
||||||
def get_distribution_template() -> DistributionTemplate:
|
def get_distribution_template() -> DistributionTemplate:
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,6 @@
|
||||||
# the root directory of this source tree.
|
# the root directory of this source tree.
|
||||||
|
|
||||||
|
|
||||||
from llama_stack_api import DatasetPurpose, ModelType, URIDataSource
|
|
||||||
|
|
||||||
from llama_stack.core.datatypes import (
|
from llama_stack.core.datatypes import (
|
||||||
BenchmarkInput,
|
BenchmarkInput,
|
||||||
BuildProvider,
|
BuildProvider,
|
||||||
|
|
@ -34,6 +32,7 @@ from llama_stack.providers.remote.vector_io.pgvector.config import (
|
||||||
PGVectorVectorIOConfig,
|
PGVectorVectorIOConfig,
|
||||||
)
|
)
|
||||||
from llama_stack.providers.utils.inference.model_registry import ProviderModelEntry
|
from llama_stack.providers.utils.inference.model_registry import ProviderModelEntry
|
||||||
|
from llama_stack_api import DatasetPurpose, ModelType, URIDataSource
|
||||||
|
|
||||||
|
|
||||||
def get_inference_providers() -> tuple[list[Provider], dict[str, list[ProviderModelEntry]]]:
|
def get_inference_providers() -> tuple[list[Provider], dict[str, list[ProviderModelEntry]]]:
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,6 @@
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from llama_stack_api import RemoteProviderSpec
|
|
||||||
|
|
||||||
from llama_stack.core.datatypes import (
|
from llama_stack.core.datatypes import (
|
||||||
BuildProvider,
|
BuildProvider,
|
||||||
Provider,
|
Provider,
|
||||||
|
|
@ -39,6 +37,7 @@ from llama_stack.providers.remote.vector_io.qdrant.config import QdrantVectorIOC
|
||||||
from llama_stack.providers.remote.vector_io.weaviate.config import WeaviateVectorIOConfig
|
from llama_stack.providers.remote.vector_io.weaviate.config import WeaviateVectorIOConfig
|
||||||
from llama_stack.providers.utils.kvstore.config import PostgresKVStoreConfig
|
from llama_stack.providers.utils.kvstore.config import PostgresKVStoreConfig
|
||||||
from llama_stack.providers.utils.sqlstore.sqlstore import PostgresSqlStoreConfig
|
from llama_stack.providers.utils.sqlstore.sqlstore import PostgresSqlStoreConfig
|
||||||
|
from llama_stack_api import RemoteProviderSpec
|
||||||
|
|
||||||
|
|
||||||
def _get_config_for_provider(provider_spec: ProviderSpec) -> dict[str, Any]:
|
def _get_config_for_provider(provider_spec: ProviderSpec) -> dict[str, Any]:
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ from typing import Any, Literal
|
||||||
import jinja2
|
import jinja2
|
||||||
import rich
|
import rich
|
||||||
import yaml
|
import yaml
|
||||||
from llama_stack_api import DatasetPurpose, ModelType
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
from llama_stack.core.datatypes import (
|
from llama_stack.core.datatypes import (
|
||||||
|
|
@ -43,6 +42,7 @@ from llama_stack.providers.utils.kvstore.config import SqliteKVStoreConfig
|
||||||
from llama_stack.providers.utils.kvstore.config import get_pip_packages as get_kv_pip_packages
|
from llama_stack.providers.utils.kvstore.config import get_pip_packages as get_kv_pip_packages
|
||||||
from llama_stack.providers.utils.sqlstore.sqlstore import SqliteSqlStoreConfig
|
from llama_stack.providers.utils.sqlstore.sqlstore import SqliteSqlStoreConfig
|
||||||
from llama_stack.providers.utils.sqlstore.sqlstore import get_pip_packages as get_sql_pip_packages
|
from llama_stack.providers.utils.sqlstore.sqlstore import get_pip_packages as get_sql_pip_packages
|
||||||
|
from llama_stack_api import DatasetPurpose, ModelType
|
||||||
|
|
||||||
|
|
||||||
def filter_empty_values(obj: Any) -> Any:
|
def filter_empty_values(obj: Any) -> Any:
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,10 @@
|
||||||
# the root directory of this source tree.
|
# the root directory of this source tree.
|
||||||
|
|
||||||
|
|
||||||
|
from llama_stack.core.datatypes import AccessRule
|
||||||
|
from llama_stack.log import get_logger
|
||||||
|
from llama_stack.providers.utils.kvstore import InmemoryKVStoreImpl, kvstore_impl
|
||||||
|
from llama_stack.providers.utils.responses.responses_store import ResponsesStore
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
Agents,
|
Agents,
|
||||||
Conversations,
|
Conversations,
|
||||||
|
|
@ -25,11 +29,6 @@ from llama_stack_api import (
|
||||||
VectorIO,
|
VectorIO,
|
||||||
)
|
)
|
||||||
|
|
||||||
from llama_stack.core.datatypes import AccessRule
|
|
||||||
from llama_stack.log import get_logger
|
|
||||||
from llama_stack.providers.utils.kvstore import InmemoryKVStoreImpl, kvstore_impl
|
|
||||||
from llama_stack.providers.utils.responses.responses_store import ResponsesStore
|
|
||||||
|
|
||||||
from .config import MetaReferenceAgentsImplConfig
|
from .config import MetaReferenceAgentsImplConfig
|
||||||
from .responses.openai_responses import OpenAIResponsesImpl
|
from .responses.openai_responses import OpenAIResponsesImpl
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,13 @@ import time
|
||||||
import uuid
|
import uuid
|
||||||
from collections.abc import AsyncIterator
|
from collections.abc import AsyncIterator
|
||||||
|
|
||||||
|
from pydantic import BaseModel, TypeAdapter
|
||||||
|
|
||||||
|
from llama_stack.log import get_logger
|
||||||
|
from llama_stack.providers.utils.responses.responses_store import (
|
||||||
|
ResponsesStore,
|
||||||
|
_OpenAIResponseObjectWithInputAndMessages,
|
||||||
|
)
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
ConversationItem,
|
ConversationItem,
|
||||||
Conversations,
|
Conversations,
|
||||||
|
|
@ -34,13 +41,6 @@ from llama_stack_api import (
|
||||||
ToolRuntime,
|
ToolRuntime,
|
||||||
VectorIO,
|
VectorIO,
|
||||||
)
|
)
|
||||||
from pydantic import BaseModel, TypeAdapter
|
|
||||||
|
|
||||||
from llama_stack.log import get_logger
|
|
||||||
from llama_stack.providers.utils.responses.responses_store import (
|
|
||||||
ResponsesStore,
|
|
||||||
_OpenAIResponseObjectWithInputAndMessages,
|
|
||||||
)
|
|
||||||
|
|
||||||
from .streaming import StreamingResponseOrchestrator
|
from .streaming import StreamingResponseOrchestrator
|
||||||
from .tool_executor import ToolExecutor
|
from .tool_executor import ToolExecutor
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,9 @@ import uuid
|
||||||
from collections.abc import AsyncIterator
|
from collections.abc import AsyncIterator
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
from llama_stack.core.telemetry import tracing
|
||||||
|
from llama_stack.log import get_logger
|
||||||
|
from llama_stack.providers.utils.inference.prompt_adapter import interleaved_content_as_str
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
AllowedToolsFilter,
|
AllowedToolsFilter,
|
||||||
ApprovalFilter,
|
ApprovalFilter,
|
||||||
|
|
@ -65,10 +68,6 @@ from llama_stack_api import (
|
||||||
WebSearchToolTypes,
|
WebSearchToolTypes,
|
||||||
)
|
)
|
||||||
|
|
||||||
from llama_stack.core.telemetry import tracing
|
|
||||||
from llama_stack.log import get_logger
|
|
||||||
from llama_stack.providers.utils.inference.prompt_adapter import interleaved_content_as_str
|
|
||||||
|
|
||||||
from .types import ChatCompletionContext, ChatCompletionResult
|
from .types import ChatCompletionContext, ChatCompletionResult
|
||||||
from .utils import (
|
from .utils import (
|
||||||
convert_chat_choice_to_response_message,
|
convert_chat_choice_to_response_message,
|
||||||
|
|
@ -1022,11 +1021,11 @@ class StreamingResponseOrchestrator:
|
||||||
self, tools: list[OpenAIResponseInputTool], output_messages: list[OpenAIResponseOutput]
|
self, tools: list[OpenAIResponseInputTool], output_messages: list[OpenAIResponseOutput]
|
||||||
) -> AsyncIterator[OpenAIResponseObjectStream]:
|
) -> AsyncIterator[OpenAIResponseObjectStream]:
|
||||||
"""Process all tools and emit appropriate streaming events."""
|
"""Process all tools and emit appropriate streaming events."""
|
||||||
from llama_stack_api import ToolDef
|
|
||||||
from openai.types.chat import ChatCompletionToolParam
|
from openai.types.chat import ChatCompletionToolParam
|
||||||
|
|
||||||
from llama_stack.models.llama.datatypes import ToolDefinition
|
from llama_stack.models.llama.datatypes import ToolDefinition
|
||||||
from llama_stack.providers.utils.inference.openai_compat import convert_tooldef_to_openai_tool
|
from llama_stack.providers.utils.inference.openai_compat import convert_tooldef_to_openai_tool
|
||||||
|
from llama_stack_api import ToolDef
|
||||||
|
|
||||||
def make_openai_tool(tool_name: str, tool: ToolDef) -> ChatCompletionToolParam:
|
def make_openai_tool(tool_name: str, tool: ToolDef) -> ChatCompletionToolParam:
|
||||||
tool_def = ToolDefinition(
|
tool_def = ToolDefinition(
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@ import json
|
||||||
from collections.abc import AsyncIterator
|
from collections.abc import AsyncIterator
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
from llama_stack.core.telemetry import tracing
|
||||||
|
from llama_stack.log import get_logger
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
ImageContentItem,
|
ImageContentItem,
|
||||||
OpenAIChatCompletionContentPartImageParam,
|
OpenAIChatCompletionContentPartImageParam,
|
||||||
|
|
@ -37,9 +39,6 @@ from llama_stack_api import (
|
||||||
VectorIO,
|
VectorIO,
|
||||||
)
|
)
|
||||||
|
|
||||||
from llama_stack.core.telemetry import tracing
|
|
||||||
from llama_stack.log import get_logger
|
|
||||||
|
|
||||||
from .types import ChatCompletionContext, ToolExecutionResult
|
from .types import ChatCompletionContext, ToolExecutionResult
|
||||||
|
|
||||||
logger = get_logger(name=__name__, category="agents::meta_reference")
|
logger = get_logger(name=__name__, category="agents::meta_reference")
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,9 @@
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import cast
|
from typing import cast
|
||||||
|
|
||||||
|
from openai.types.chat import ChatCompletionToolParam
|
||||||
|
from pydantic import BaseModel
|
||||||
|
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
OpenAIChatCompletionToolCall,
|
OpenAIChatCompletionToolCall,
|
||||||
OpenAIMessageParam,
|
OpenAIMessageParam,
|
||||||
|
|
@ -26,8 +29,6 @@ from llama_stack_api import (
|
||||||
OpenAIResponseTool,
|
OpenAIResponseTool,
|
||||||
OpenAIResponseToolMCP,
|
OpenAIResponseToolMCP,
|
||||||
)
|
)
|
||||||
from openai.types.chat import ChatCompletionToolParam
|
|
||||||
from pydantic import BaseModel
|
|
||||||
|
|
||||||
|
|
||||||
class ToolExecutionResult(BaseModel):
|
class ToolExecutionResult(BaseModel):
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,9 @@
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
from llama_stack_api import OpenAIMessageParam, Safety, SafetyViolation, ViolationLevel
|
|
||||||
|
|
||||||
from llama_stack.core.telemetry import tracing
|
from llama_stack.core.telemetry import tracing
|
||||||
from llama_stack.log import get_logger
|
from llama_stack.log import get_logger
|
||||||
|
from llama_stack_api import OpenAIMessageParam, Safety, SafetyViolation, ViolationLevel
|
||||||
|
|
||||||
log = get_logger(name=__name__, category="agents::meta_reference")
|
log = get_logger(name=__name__, category="agents::meta_reference")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,9 @@
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from llama_stack_api import Files, Inference, Models
|
|
||||||
|
|
||||||
from llama_stack.core.datatypes import AccessRule, Api
|
from llama_stack.core.datatypes import AccessRule, Api
|
||||||
from llama_stack.providers.utils.kvstore import kvstore_impl
|
from llama_stack.providers.utils.kvstore import kvstore_impl
|
||||||
|
from llama_stack_api import Files, Inference, Models
|
||||||
|
|
||||||
from .batches import ReferenceBatchesImpl
|
from .batches import ReferenceBatchesImpl
|
||||||
from .config import ReferenceBatchesImplConfig
|
from .config import ReferenceBatchesImplConfig
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,11 @@ import uuid
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from typing import Any, Literal
|
from typing import Any, Literal
|
||||||
|
|
||||||
|
from openai.types.batch import BatchError, Errors
|
||||||
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
from llama_stack.log import get_logger
|
||||||
|
from llama_stack.providers.utils.kvstore import KVStore
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
Batches,
|
Batches,
|
||||||
BatchObject,
|
BatchObject,
|
||||||
|
|
@ -33,11 +38,6 @@ from llama_stack_api import (
|
||||||
OpenAIUserMessageParam,
|
OpenAIUserMessageParam,
|
||||||
ResourceNotFoundError,
|
ResourceNotFoundError,
|
||||||
)
|
)
|
||||||
from openai.types.batch import BatchError, Errors
|
|
||||||
from pydantic import BaseModel
|
|
||||||
|
|
||||||
from llama_stack.log import get_logger
|
|
||||||
from llama_stack.providers.utils.kvstore import KVStore
|
|
||||||
|
|
||||||
from .config import ReferenceBatchesImplConfig
|
from .config import ReferenceBatchesImplConfig
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,10 @@
|
||||||
# the root directory of this source tree.
|
# the root directory of this source tree.
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from llama_stack_api import Dataset, DatasetIO, DatasetsProtocolPrivate, PaginatedResponse
|
|
||||||
|
|
||||||
from llama_stack.providers.utils.datasetio.url_utils import get_dataframe_from_uri
|
from llama_stack.providers.utils.datasetio.url_utils import get_dataframe_from_uri
|
||||||
from llama_stack.providers.utils.kvstore import kvstore_impl
|
from llama_stack.providers.utils.kvstore import kvstore_impl
|
||||||
from llama_stack.providers.utils.pagination import paginate_records
|
from llama_stack.providers.utils.pagination import paginate_records
|
||||||
|
from llama_stack_api import Dataset, DatasetIO, DatasetsProtocolPrivate, PaginatedResponse
|
||||||
|
|
||||||
from .config import LocalFSDatasetIOConfig
|
from .config import LocalFSDatasetIOConfig
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,10 @@
|
||||||
import json
|
import json
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
from tqdm import tqdm
|
||||||
|
|
||||||
|
from llama_stack.providers.utils.common.data_schema_validator import ColumnName
|
||||||
|
from llama_stack.providers.utils.kvstore import kvstore_impl
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
Agents,
|
Agents,
|
||||||
Benchmark,
|
Benchmark,
|
||||||
|
|
@ -24,10 +28,6 @@ from llama_stack_api import (
|
||||||
OpenAIUserMessageParam,
|
OpenAIUserMessageParam,
|
||||||
Scoring,
|
Scoring,
|
||||||
)
|
)
|
||||||
from tqdm import tqdm
|
|
||||||
|
|
||||||
from llama_stack.providers.utils.common.data_schema_validator import ColumnName
|
|
||||||
from llama_stack.providers.utils.kvstore import kvstore_impl
|
|
||||||
|
|
||||||
from .config import MetaReferenceEvalConfig
|
from .config import MetaReferenceEvalConfig
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,14 @@ from pathlib import Path
|
||||||
from typing import Annotated
|
from typing import Annotated
|
||||||
|
|
||||||
from fastapi import Depends, File, Form, Response, UploadFile
|
from fastapi import Depends, File, Form, Response, UploadFile
|
||||||
|
|
||||||
|
from llama_stack.core.datatypes import AccessRule
|
||||||
|
from llama_stack.core.id_generation import generate_object_id
|
||||||
|
from llama_stack.log import get_logger
|
||||||
|
from llama_stack.providers.utils.files.form_data import parse_expires_after
|
||||||
|
from llama_stack.providers.utils.sqlstore.api import ColumnDefinition, ColumnType
|
||||||
|
from llama_stack.providers.utils.sqlstore.authorized_sqlstore import AuthorizedSqlStore
|
||||||
|
from llama_stack.providers.utils.sqlstore.sqlstore import sqlstore_impl
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
ExpiresAfter,
|
ExpiresAfter,
|
||||||
Files,
|
Files,
|
||||||
|
|
@ -21,14 +29,6 @@ from llama_stack_api import (
|
||||||
ResourceNotFoundError,
|
ResourceNotFoundError,
|
||||||
)
|
)
|
||||||
|
|
||||||
from llama_stack.core.datatypes import AccessRule
|
|
||||||
from llama_stack.core.id_generation import generate_object_id
|
|
||||||
from llama_stack.log import get_logger
|
|
||||||
from llama_stack.providers.utils.files.form_data import parse_expires_after
|
|
||||||
from llama_stack.providers.utils.sqlstore.api import ColumnDefinition, ColumnType
|
|
||||||
from llama_stack.providers.utils.sqlstore.authorized_sqlstore import AuthorizedSqlStore
|
|
||||||
from llama_stack.providers.utils.sqlstore.sqlstore import sqlstore_impl
|
|
||||||
|
|
||||||
from .config import LocalfsFilesImplConfig
|
from .config import LocalfsFilesImplConfig
|
||||||
|
|
||||||
logger = get_logger(name=__name__, category="files")
|
logger = get_logger(name=__name__, category="files")
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from llama_stack_api import QuantizationConfig
|
|
||||||
from pydantic import BaseModel, field_validator
|
from pydantic import BaseModel, field_validator
|
||||||
|
|
||||||
from llama_stack.providers.utils.inference import supported_inference_models
|
from llama_stack.providers.utils.inference import supported_inference_models
|
||||||
|
from llama_stack_api import QuantizationConfig
|
||||||
|
|
||||||
|
|
||||||
class MetaReferenceInferenceConfig(BaseModel):
|
class MetaReferenceInferenceConfig(BaseModel):
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,14 @@ import math
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
|
from lmformatenforcer import JsonSchemaParser, TokenEnforcer, TokenEnforcerTokenizerData
|
||||||
|
|
||||||
|
from llama_stack.models.llama.datatypes import QuantizationMode, ToolPromptFormat
|
||||||
|
from llama_stack.models.llama.llama3.generation import Llama3
|
||||||
|
from llama_stack.models.llama.llama3.tokenizer import Tokenizer as Llama3Tokenizer
|
||||||
|
from llama_stack.models.llama.llama4.generation import Llama4
|
||||||
|
from llama_stack.models.llama.llama4.tokenizer import Tokenizer as Llama4Tokenizer
|
||||||
|
from llama_stack.models.llama.sku_types import Model, ModelFamily
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
GreedySamplingStrategy,
|
GreedySamplingStrategy,
|
||||||
JsonSchemaResponseFormat,
|
JsonSchemaResponseFormat,
|
||||||
|
|
@ -18,14 +26,6 @@ from llama_stack_api import (
|
||||||
SamplingParams,
|
SamplingParams,
|
||||||
TopPSamplingStrategy,
|
TopPSamplingStrategy,
|
||||||
)
|
)
|
||||||
from lmformatenforcer import JsonSchemaParser, TokenEnforcer, TokenEnforcerTokenizerData
|
|
||||||
|
|
||||||
from llama_stack.models.llama.datatypes import QuantizationMode, ToolPromptFormat
|
|
||||||
from llama_stack.models.llama.llama3.generation import Llama3
|
|
||||||
from llama_stack.models.llama.llama3.tokenizer import Tokenizer as Llama3Tokenizer
|
|
||||||
from llama_stack.models.llama.llama4.generation import Llama4
|
|
||||||
from llama_stack.models.llama.llama4.tokenizer import Tokenizer as Llama4Tokenizer
|
|
||||||
from llama_stack.models.llama.sku_types import Model, ModelFamily
|
|
||||||
|
|
||||||
from .common import model_checkpoint_dir
|
from .common import model_checkpoint_dir
|
||||||
from .config import MetaReferenceInferenceConfig
|
from .config import MetaReferenceInferenceConfig
|
||||||
|
|
|
||||||
|
|
@ -9,23 +9,6 @@ import time
|
||||||
import uuid
|
import uuid
|
||||||
from collections.abc import AsyncIterator
|
from collections.abc import AsyncIterator
|
||||||
|
|
||||||
from llama_stack_api import (
|
|
||||||
InferenceProvider,
|
|
||||||
Model,
|
|
||||||
ModelsProtocolPrivate,
|
|
||||||
ModelType,
|
|
||||||
OpenAIAssistantMessageParam,
|
|
||||||
OpenAIChatCompletion,
|
|
||||||
OpenAIChatCompletionChunk,
|
|
||||||
OpenAIChatCompletionRequestWithExtraBody,
|
|
||||||
OpenAIChatCompletionUsage,
|
|
||||||
OpenAIChoice,
|
|
||||||
OpenAICompletion,
|
|
||||||
OpenAICompletionRequestWithExtraBody,
|
|
||||||
OpenAIUserMessageParam,
|
|
||||||
ToolChoice,
|
|
||||||
)
|
|
||||||
|
|
||||||
from llama_stack.log import get_logger
|
from llama_stack.log import get_logger
|
||||||
from llama_stack.models.llama.datatypes import RawMessage, RawTextItem, ToolDefinition
|
from llama_stack.models.llama.datatypes import RawMessage, RawTextItem, ToolDefinition
|
||||||
from llama_stack.models.llama.llama3.chat_format import ChatFormat as Llama3ChatFormat
|
from llama_stack.models.llama.llama3.chat_format import ChatFormat as Llama3ChatFormat
|
||||||
|
|
@ -48,6 +31,22 @@ from llama_stack.providers.utils.inference.model_registry import (
|
||||||
ModelRegistryHelper,
|
ModelRegistryHelper,
|
||||||
build_hf_repo_model_entry,
|
build_hf_repo_model_entry,
|
||||||
)
|
)
|
||||||
|
from llama_stack_api import (
|
||||||
|
InferenceProvider,
|
||||||
|
Model,
|
||||||
|
ModelsProtocolPrivate,
|
||||||
|
ModelType,
|
||||||
|
OpenAIAssistantMessageParam,
|
||||||
|
OpenAIChatCompletion,
|
||||||
|
OpenAIChatCompletionChunk,
|
||||||
|
OpenAIChatCompletionRequestWithExtraBody,
|
||||||
|
OpenAIChatCompletionUsage,
|
||||||
|
OpenAIChoice,
|
||||||
|
OpenAICompletion,
|
||||||
|
OpenAICompletionRequestWithExtraBody,
|
||||||
|
OpenAIUserMessageParam,
|
||||||
|
ToolChoice,
|
||||||
|
)
|
||||||
|
|
||||||
from .config import MetaReferenceInferenceConfig
|
from .config import MetaReferenceInferenceConfig
|
||||||
from .generators import LlamaGenerator
|
from .generators import LlamaGenerator
|
||||||
|
|
@ -441,6 +440,8 @@ class MetaReferenceInferenceImpl(
|
||||||
params: OpenAIChatCompletionRequestWithExtraBody,
|
params: OpenAIChatCompletionRequestWithExtraBody,
|
||||||
) -> AsyncIterator[OpenAIChatCompletionChunk]:
|
) -> AsyncIterator[OpenAIChatCompletionChunk]:
|
||||||
"""Stream chat completion chunks as they're generated."""
|
"""Stream chat completion chunks as they're generated."""
|
||||||
|
from llama_stack.models.llama.datatypes import StopReason
|
||||||
|
from llama_stack.providers.utils.inference.prompt_adapter import decode_assistant_message
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
OpenAIChatCompletionChunk,
|
OpenAIChatCompletionChunk,
|
||||||
OpenAIChatCompletionToolCall,
|
OpenAIChatCompletionToolCall,
|
||||||
|
|
@ -449,9 +450,6 @@ class MetaReferenceInferenceImpl(
|
||||||
OpenAIChunkChoice,
|
OpenAIChunkChoice,
|
||||||
)
|
)
|
||||||
|
|
||||||
from llama_stack.models.llama.datatypes import StopReason
|
|
||||||
from llama_stack.providers.utils.inference.prompt_adapter import decode_assistant_message
|
|
||||||
|
|
||||||
response_id = f"chatcmpl-{uuid.uuid4().hex[:24]}"
|
response_id = f"chatcmpl-{uuid.uuid4().hex[:24]}"
|
||||||
created = int(time.time())
|
created = int(time.time())
|
||||||
generated_text = ""
|
generated_text = ""
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,10 @@
|
||||||
|
|
||||||
from collections.abc import AsyncIterator
|
from collections.abc import AsyncIterator
|
||||||
|
|
||||||
|
from llama_stack.log import get_logger
|
||||||
|
from llama_stack.providers.utils.inference.embedding_mixin import (
|
||||||
|
SentenceTransformerEmbeddingMixin,
|
||||||
|
)
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
InferenceProvider,
|
InferenceProvider,
|
||||||
Model,
|
Model,
|
||||||
|
|
@ -18,11 +22,6 @@ from llama_stack_api import (
|
||||||
OpenAICompletionRequestWithExtraBody,
|
OpenAICompletionRequestWithExtraBody,
|
||||||
)
|
)
|
||||||
|
|
||||||
from llama_stack.log import get_logger
|
|
||||||
from llama_stack.providers.utils.inference.embedding_mixin import (
|
|
||||||
SentenceTransformerEmbeddingMixin,
|
|
||||||
)
|
|
||||||
|
|
||||||
from .config import SentenceTransformersInferenceConfig
|
from .config import SentenceTransformersInferenceConfig
|
||||||
|
|
||||||
log = get_logger(name=__name__, category="inference")
|
log = get_logger(name=__name__, category="inference")
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,10 @@
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from llama_stack_api import ChatCompletionInputType, DialogType, StringType
|
|
||||||
|
|
||||||
from llama_stack.providers.utils.common.data_schema_validator import (
|
from llama_stack.providers.utils.common.data_schema_validator import (
|
||||||
ColumnName,
|
ColumnName,
|
||||||
)
|
)
|
||||||
|
from llama_stack_api import ChatCompletionInputType, DialogType, StringType
|
||||||
|
|
||||||
EXPECTED_DATASET_SCHEMA: dict[str, list[dict[str, Any]]] = {
|
EXPECTED_DATASET_SCHEMA: dict[str, list[dict[str, Any]]] = {
|
||||||
"instruct": [
|
"instruct": [
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,11 @@
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
from llama_stack.providers.inline.post_training.huggingface.config import (
|
||||||
|
HuggingFacePostTrainingConfig,
|
||||||
|
)
|
||||||
|
from llama_stack.providers.utils.scheduler import JobArtifact, Scheduler
|
||||||
|
from llama_stack.providers.utils.scheduler import JobStatus as SchedulerJobStatus
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
AlgorithmConfig,
|
AlgorithmConfig,
|
||||||
Checkpoint,
|
Checkpoint,
|
||||||
|
|
@ -20,12 +25,6 @@ from llama_stack_api import (
|
||||||
TrainingConfig,
|
TrainingConfig,
|
||||||
)
|
)
|
||||||
|
|
||||||
from llama_stack.providers.inline.post_training.huggingface.config import (
|
|
||||||
HuggingFacePostTrainingConfig,
|
|
||||||
)
|
|
||||||
from llama_stack.providers.utils.scheduler import JobArtifact, Scheduler
|
|
||||||
from llama_stack.providers.utils.scheduler import JobStatus as SchedulerJobStatus
|
|
||||||
|
|
||||||
|
|
||||||
class TrainingArtifactType(Enum):
|
class TrainingArtifactType(Enum):
|
||||||
CHECKPOINT = "checkpoint"
|
CHECKPOINT = "checkpoint"
|
||||||
|
|
|
||||||
|
|
@ -12,14 +12,6 @@ from typing import Any
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from datasets import Dataset
|
from datasets import Dataset
|
||||||
from llama_stack_api import (
|
|
||||||
Checkpoint,
|
|
||||||
DataConfig,
|
|
||||||
DatasetIO,
|
|
||||||
Datasets,
|
|
||||||
LoraFinetuningConfig,
|
|
||||||
TrainingConfig,
|
|
||||||
)
|
|
||||||
from peft import LoraConfig
|
from peft import LoraConfig
|
||||||
from transformers import (
|
from transformers import (
|
||||||
AutoTokenizer,
|
AutoTokenizer,
|
||||||
|
|
@ -28,6 +20,14 @@ from trl import SFTConfig, SFTTrainer
|
||||||
|
|
||||||
from llama_stack.log import get_logger
|
from llama_stack.log import get_logger
|
||||||
from llama_stack.providers.inline.post_training.common.utils import evacuate_model_from_device
|
from llama_stack.providers.inline.post_training.common.utils import evacuate_model_from_device
|
||||||
|
from llama_stack_api import (
|
||||||
|
Checkpoint,
|
||||||
|
DataConfig,
|
||||||
|
DatasetIO,
|
||||||
|
Datasets,
|
||||||
|
LoraFinetuningConfig,
|
||||||
|
TrainingConfig,
|
||||||
|
)
|
||||||
|
|
||||||
from ..config import HuggingFacePostTrainingConfig
|
from ..config import HuggingFacePostTrainingConfig
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
|
|
|
||||||
|
|
@ -11,13 +11,6 @@ from typing import Any
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from datasets import Dataset
|
from datasets import Dataset
|
||||||
from llama_stack_api import (
|
|
||||||
Checkpoint,
|
|
||||||
DatasetIO,
|
|
||||||
Datasets,
|
|
||||||
DPOAlignmentConfig,
|
|
||||||
TrainingConfig,
|
|
||||||
)
|
|
||||||
from transformers import (
|
from transformers import (
|
||||||
AutoTokenizer,
|
AutoTokenizer,
|
||||||
)
|
)
|
||||||
|
|
@ -25,6 +18,13 @@ from trl import DPOConfig, DPOTrainer
|
||||||
|
|
||||||
from llama_stack.log import get_logger
|
from llama_stack.log import get_logger
|
||||||
from llama_stack.providers.inline.post_training.common.utils import evacuate_model_from_device
|
from llama_stack.providers.inline.post_training.common.utils import evacuate_model_from_device
|
||||||
|
from llama_stack_api import (
|
||||||
|
Checkpoint,
|
||||||
|
DatasetIO,
|
||||||
|
Datasets,
|
||||||
|
DPOAlignmentConfig,
|
||||||
|
TrainingConfig,
|
||||||
|
)
|
||||||
|
|
||||||
from ..config import HuggingFacePostTrainingConfig
|
from ..config import HuggingFacePostTrainingConfig
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,10 @@ from typing import TYPE_CHECKING, Any, Protocol
|
||||||
import psutil
|
import psutil
|
||||||
import torch
|
import torch
|
||||||
from datasets import Dataset
|
from datasets import Dataset
|
||||||
from llama_stack_api import Checkpoint, DatasetIO, TrainingConfig
|
|
||||||
from transformers import AutoConfig, AutoModelForCausalLM
|
from transformers import AutoConfig, AutoModelForCausalLM
|
||||||
|
|
||||||
|
from llama_stack_api import Checkpoint, DatasetIO, TrainingConfig
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from transformers import PretrainedConfig
|
from transformers import PretrainedConfig
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@
|
||||||
from collections.abc import Callable
|
from collections.abc import Callable
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from llama_stack_api import DatasetFormat
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
from torchtune.data._messages import InputOutputToMessages, ShareGPTToMessages
|
from torchtune.data._messages import InputOutputToMessages, ShareGPTToMessages
|
||||||
from torchtune.models.llama3 import llama3_tokenizer
|
from torchtune.models.llama3 import llama3_tokenizer
|
||||||
|
|
@ -24,6 +23,7 @@ from torchtune.modules.transforms import Transform
|
||||||
|
|
||||||
from llama_stack.models.llama.sku_list import resolve_model
|
from llama_stack.models.llama.sku_list import resolve_model
|
||||||
from llama_stack.models.llama.sku_types import Model
|
from llama_stack.models.llama.sku_types import Model
|
||||||
|
from llama_stack_api import DatasetFormat
|
||||||
|
|
||||||
BuildLoraModelCallable = Callable[..., torch.nn.Module]
|
BuildLoraModelCallable = Callable[..., torch.nn.Module]
|
||||||
BuildTokenizerCallable = Callable[..., Llama3Tokenizer]
|
BuildTokenizerCallable = Callable[..., Llama3Tokenizer]
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,11 @@
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
from llama_stack.providers.inline.post_training.torchtune.config import (
|
||||||
|
TorchtunePostTrainingConfig,
|
||||||
|
)
|
||||||
|
from llama_stack.providers.utils.scheduler import JobArtifact, Scheduler
|
||||||
|
from llama_stack.providers.utils.scheduler import JobStatus as SchedulerJobStatus
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
AlgorithmConfig,
|
AlgorithmConfig,
|
||||||
Checkpoint,
|
Checkpoint,
|
||||||
|
|
@ -21,12 +26,6 @@ from llama_stack_api import (
|
||||||
TrainingConfig,
|
TrainingConfig,
|
||||||
)
|
)
|
||||||
|
|
||||||
from llama_stack.providers.inline.post_training.torchtune.config import (
|
|
||||||
TorchtunePostTrainingConfig,
|
|
||||||
)
|
|
||||||
from llama_stack.providers.utils.scheduler import JobArtifact, Scheduler
|
|
||||||
from llama_stack.providers.utils.scheduler import JobStatus as SchedulerJobStatus
|
|
||||||
|
|
||||||
|
|
||||||
class TrainingArtifactType(Enum):
|
class TrainingArtifactType(Enum):
|
||||||
CHECKPOINT = "checkpoint"
|
CHECKPOINT = "checkpoint"
|
||||||
|
|
|
||||||
|
|
@ -12,17 +12,6 @@ from pathlib import Path
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from llama_stack_api import (
|
|
||||||
Checkpoint,
|
|
||||||
DataConfig,
|
|
||||||
DatasetIO,
|
|
||||||
Datasets,
|
|
||||||
LoraFinetuningConfig,
|
|
||||||
OptimizerConfig,
|
|
||||||
PostTrainingMetric,
|
|
||||||
QATFinetuningConfig,
|
|
||||||
TrainingConfig,
|
|
||||||
)
|
|
||||||
from torch import nn
|
from torch import nn
|
||||||
from torch.optim import Optimizer
|
from torch.optim import Optimizer
|
||||||
from torch.utils.data import DataLoader, DistributedSampler
|
from torch.utils.data import DataLoader, DistributedSampler
|
||||||
|
|
@ -56,6 +45,17 @@ from llama_stack.providers.inline.post_training.torchtune.config import (
|
||||||
TorchtunePostTrainingConfig,
|
TorchtunePostTrainingConfig,
|
||||||
)
|
)
|
||||||
from llama_stack.providers.inline.post_training.torchtune.datasets.sft import SFTDataset
|
from llama_stack.providers.inline.post_training.torchtune.datasets.sft import SFTDataset
|
||||||
|
from llama_stack_api import (
|
||||||
|
Checkpoint,
|
||||||
|
DataConfig,
|
||||||
|
DatasetIO,
|
||||||
|
Datasets,
|
||||||
|
LoraFinetuningConfig,
|
||||||
|
OptimizerConfig,
|
||||||
|
PostTrainingMetric,
|
||||||
|
QATFinetuningConfig,
|
||||||
|
TrainingConfig,
|
||||||
|
)
|
||||||
|
|
||||||
log = get_logger(name=__name__, category="post_training")
|
log = get_logger(name=__name__, category="post_training")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,10 @@ from typing import TYPE_CHECKING, Any
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from codeshield.cs import CodeShieldScanResult
|
from codeshield.cs import CodeShieldScanResult
|
||||||
|
|
||||||
|
from llama_stack.log import get_logger
|
||||||
|
from llama_stack.providers.utils.inference.prompt_adapter import (
|
||||||
|
interleaved_content_as_str,
|
||||||
|
)
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
ModerationObject,
|
ModerationObject,
|
||||||
ModerationObjectResults,
|
ModerationObjectResults,
|
||||||
|
|
@ -21,11 +25,6 @@ from llama_stack_api import (
|
||||||
ViolationLevel,
|
ViolationLevel,
|
||||||
)
|
)
|
||||||
|
|
||||||
from llama_stack.log import get_logger
|
|
||||||
from llama_stack.providers.utils.inference.prompt_adapter import (
|
|
||||||
interleaved_content_as_str,
|
|
||||||
)
|
|
||||||
|
|
||||||
from .config import CodeScannerConfig
|
from .config import CodeScannerConfig
|
||||||
|
|
||||||
log = get_logger(name=__name__, category="safety")
|
log = get_logger(name=__name__, category="safety")
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,13 @@ import uuid
|
||||||
from string import Template
|
from string import Template
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
from llama_stack.core.datatypes import Api
|
||||||
|
from llama_stack.log import get_logger
|
||||||
|
from llama_stack.models.llama.datatypes import Role
|
||||||
|
from llama_stack.models.llama.sku_types import CoreModelId
|
||||||
|
from llama_stack.providers.utils.inference.prompt_adapter import (
|
||||||
|
interleaved_content_as_str,
|
||||||
|
)
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
ImageContentItem,
|
ImageContentItem,
|
||||||
Inference,
|
Inference,
|
||||||
|
|
@ -26,14 +33,6 @@ from llama_stack_api import (
|
||||||
ViolationLevel,
|
ViolationLevel,
|
||||||
)
|
)
|
||||||
|
|
||||||
from llama_stack.core.datatypes import Api
|
|
||||||
from llama_stack.log import get_logger
|
|
||||||
from llama_stack.models.llama.datatypes import Role
|
|
||||||
from llama_stack.models.llama.sku_types import CoreModelId
|
|
||||||
from llama_stack.providers.utils.inference.prompt_adapter import (
|
|
||||||
interleaved_content_as_str,
|
|
||||||
)
|
|
||||||
|
|
||||||
from .config import LlamaGuardConfig
|
from .config import LlamaGuardConfig
|
||||||
|
|
||||||
CANNED_RESPONSE_TEXT = "I can't answer that. Can I help with something else?"
|
CANNED_RESPONSE_TEXT = "I can't answer that. Can I help with something else?"
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,11 @@
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
|
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
||||||
|
|
||||||
|
from llama_stack.core.utils.model_utils import model_local_dir
|
||||||
|
from llama_stack.log import get_logger
|
||||||
|
from llama_stack.providers.utils.inference.prompt_adapter import interleaved_content_as_str
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
ModerationObject,
|
ModerationObject,
|
||||||
OpenAIMessageParam,
|
OpenAIMessageParam,
|
||||||
|
|
@ -18,11 +23,6 @@ from llama_stack_api import (
|
||||||
ShieldStore,
|
ShieldStore,
|
||||||
ViolationLevel,
|
ViolationLevel,
|
||||||
)
|
)
|
||||||
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
|
||||||
|
|
||||||
from llama_stack.core.utils.model_utils import model_local_dir
|
|
||||||
from llama_stack.log import get_logger
|
|
||||||
from llama_stack.providers.utils.inference.prompt_adapter import interleaved_content_as_str
|
|
||||||
|
|
||||||
from .config import PromptGuardConfig, PromptGuardType
|
from .config import PromptGuardConfig, PromptGuardType
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,11 @@
|
||||||
# the root directory of this source tree.
|
# the root directory of this source tree.
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
from llama_stack.core.datatypes import Api
|
||||||
|
from llama_stack.providers.utils.common.data_schema_validator import (
|
||||||
|
get_valid_schemas,
|
||||||
|
validate_dataset_schema,
|
||||||
|
)
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
DatasetIO,
|
DatasetIO,
|
||||||
Datasets,
|
Datasets,
|
||||||
|
|
@ -17,12 +22,6 @@ from llama_stack_api import (
|
||||||
ScoringResult,
|
ScoringResult,
|
||||||
)
|
)
|
||||||
|
|
||||||
from llama_stack.core.datatypes import Api
|
|
||||||
from llama_stack.providers.utils.common.data_schema_validator import (
|
|
||||||
get_valid_schemas,
|
|
||||||
validate_dataset_schema,
|
|
||||||
)
|
|
||||||
|
|
||||||
from .config import BasicScoringConfig
|
from .config import BasicScoringConfig
|
||||||
from .scoring_fn.docvqa_scoring_fn import DocVQAScoringFn
|
from .scoring_fn.docvqa_scoring_fn import DocVQAScoringFn
|
||||||
from .scoring_fn.equality_scoring_fn import EqualityScoringFn
|
from .scoring_fn.equality_scoring_fn import EqualityScoringFn
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,8 @@ import json
|
||||||
import re
|
import re
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from llama_stack_api import ScoringFnParams, ScoringResultRow
|
|
||||||
|
|
||||||
from llama_stack.providers.utils.scoring.base_scoring_fn import RegisteredBaseScoringFn
|
from llama_stack.providers.utils.scoring.base_scoring_fn import RegisteredBaseScoringFn
|
||||||
|
from llama_stack_api import ScoringFnParams, ScoringResultRow
|
||||||
|
|
||||||
from .fn_defs.docvqa import docvqa
|
from .fn_defs.docvqa import docvqa
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,8 @@
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from llama_stack_api import ScoringFnParams, ScoringResultRow
|
|
||||||
|
|
||||||
from llama_stack.providers.utils.scoring.base_scoring_fn import RegisteredBaseScoringFn
|
from llama_stack.providers.utils.scoring.base_scoring_fn import RegisteredBaseScoringFn
|
||||||
|
from llama_stack_api import ScoringFnParams, ScoringResultRow
|
||||||
|
|
||||||
from .fn_defs.equality import equality
|
from .fn_defs.equality import equality
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,8 @@
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from llama_stack_api import ScoringFnParams, ScoringResultRow
|
|
||||||
|
|
||||||
from llama_stack.providers.utils.scoring.base_scoring_fn import RegisteredBaseScoringFn
|
from llama_stack.providers.utils.scoring.base_scoring_fn import RegisteredBaseScoringFn
|
||||||
|
from llama_stack_api import ScoringFnParams, ScoringResultRow
|
||||||
|
|
||||||
from .fn_defs.ifeval import (
|
from .fn_defs.ifeval import (
|
||||||
ifeval,
|
ifeval,
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,8 @@
|
||||||
# the root directory of this source tree.
|
# the root directory of this source tree.
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from llama_stack_api import ScoringFnParams, ScoringFnParamsType, ScoringResultRow
|
|
||||||
|
|
||||||
from llama_stack.providers.utils.scoring.base_scoring_fn import RegisteredBaseScoringFn
|
from llama_stack.providers.utils.scoring.base_scoring_fn import RegisteredBaseScoringFn
|
||||||
|
from llama_stack_api import ScoringFnParams, ScoringFnParamsType, ScoringResultRow
|
||||||
|
|
||||||
from ..utils.math_utils import first_answer, normalize_final_answer, try_evaluate_frac, try_evaluate_latex
|
from ..utils.math_utils import first_answer, normalize_final_answer, try_evaluate_frac, try_evaluate_latex
|
||||||
from .fn_defs.regex_parser_math_response import (
|
from .fn_defs.regex_parser_math_response import (
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,8 @@
|
||||||
import re
|
import re
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from llama_stack_api import ScoringFnParams, ScoringFnParamsType, ScoringResultRow
|
|
||||||
|
|
||||||
from llama_stack.providers.utils.scoring.base_scoring_fn import RegisteredBaseScoringFn
|
from llama_stack.providers.utils.scoring.base_scoring_fn import RegisteredBaseScoringFn
|
||||||
|
from llama_stack_api import ScoringFnParams, ScoringFnParamsType, ScoringResultRow
|
||||||
|
|
||||||
from .fn_defs.regex_parser_multiple_choice_answer import (
|
from .fn_defs.regex_parser_multiple_choice_answer import (
|
||||||
regex_parser_multiple_choice_answer,
|
regex_parser_multiple_choice_answer,
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,8 @@
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from llama_stack_api import ScoringFnParams, ScoringResultRow
|
|
||||||
|
|
||||||
from llama_stack.providers.utils.scoring.base_scoring_fn import RegisteredBaseScoringFn
|
from llama_stack.providers.utils.scoring.base_scoring_fn import RegisteredBaseScoringFn
|
||||||
|
from llama_stack_api import ScoringFnParams, ScoringResultRow
|
||||||
|
|
||||||
from .fn_defs.subset_of import subset_of
|
from .fn_defs.subset_of import subset_of
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,16 @@ from autoevals.ragas import (
|
||||||
ContextRelevancy,
|
ContextRelevancy,
|
||||||
Faithfulness,
|
Faithfulness,
|
||||||
)
|
)
|
||||||
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
from llama_stack.core.datatypes import Api
|
||||||
|
from llama_stack.core.request_headers import NeedsRequestProviderData
|
||||||
|
from llama_stack.providers.utils.common.data_schema_validator import (
|
||||||
|
get_valid_schemas,
|
||||||
|
validate_dataset_schema,
|
||||||
|
validate_row_schema,
|
||||||
|
)
|
||||||
|
from llama_stack.providers.utils.scoring.aggregation_utils import aggregate_metrics
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
DatasetIO,
|
DatasetIO,
|
||||||
Datasets,
|
Datasets,
|
||||||
|
|
@ -29,16 +39,6 @@ from llama_stack_api import (
|
||||||
ScoringResult,
|
ScoringResult,
|
||||||
ScoringResultRow,
|
ScoringResultRow,
|
||||||
)
|
)
|
||||||
from pydantic import BaseModel
|
|
||||||
|
|
||||||
from llama_stack.core.datatypes import Api
|
|
||||||
from llama_stack.core.request_headers import NeedsRequestProviderData
|
|
||||||
from llama_stack.providers.utils.common.data_schema_validator import (
|
|
||||||
get_valid_schemas,
|
|
||||||
validate_dataset_schema,
|
|
||||||
validate_row_schema,
|
|
||||||
)
|
|
||||||
from llama_stack.providers.utils.scoring.aggregation_utils import aggregate_metrics
|
|
||||||
|
|
||||||
from .config import BraintrustScoringConfig
|
from .config import BraintrustScoringConfig
|
||||||
from .scoring_fn.fn_defs.answer_correctness import answer_correctness_fn_def
|
from .scoring_fn.fn_defs.answer_correctness import answer_correctness_fn_def
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,11 @@
|
||||||
# the root directory of this source tree.
|
# the root directory of this source tree.
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
from llama_stack.core.datatypes import Api
|
||||||
|
from llama_stack.providers.utils.common.data_schema_validator import (
|
||||||
|
get_valid_schemas,
|
||||||
|
validate_dataset_schema,
|
||||||
|
)
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
DatasetIO,
|
DatasetIO,
|
||||||
Datasets,
|
Datasets,
|
||||||
|
|
@ -18,12 +23,6 @@ from llama_stack_api import (
|
||||||
ScoringResult,
|
ScoringResult,
|
||||||
)
|
)
|
||||||
|
|
||||||
from llama_stack.core.datatypes import Api
|
|
||||||
from llama_stack.providers.utils.common.data_schema_validator import (
|
|
||||||
get_valid_schemas,
|
|
||||||
validate_dataset_schema,
|
|
||||||
)
|
|
||||||
|
|
||||||
from .config import LlmAsJudgeScoringConfig
|
from .config import LlmAsJudgeScoringConfig
|
||||||
from .scoring_fn.llm_as_judge_scoring_fn import LlmAsJudgeScoringFn
|
from .scoring_fn.llm_as_judge_scoring_fn import LlmAsJudgeScoringFn
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,8 @@
|
||||||
import re
|
import re
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from llama_stack_api import Inference, OpenAIChatCompletionRequestWithExtraBody, ScoringFnParams, ScoringResultRow
|
|
||||||
|
|
||||||
from llama_stack.providers.utils.scoring.base_scoring_fn import RegisteredBaseScoringFn
|
from llama_stack.providers.utils.scoring.base_scoring_fn import RegisteredBaseScoringFn
|
||||||
|
from llama_stack_api import Inference, OpenAIChatCompletionRequestWithExtraBody, ScoringFnParams, ScoringResultRow
|
||||||
|
|
||||||
from .fn_defs.llm_as_judge_405b_simpleqa import llm_as_judge_405b_simpleqa
|
from .fn_defs.llm_as_judge_405b_simpleqa import llm_as_judge_405b_simpleqa
|
||||||
from .fn_defs.llm_as_judge_base import llm_as_judge_base
|
from .fn_defs.llm_as_judge_base import llm_as_judge_base
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,10 @@
|
||||||
|
|
||||||
|
|
||||||
from jinja2 import Template
|
from jinja2 import Template
|
||||||
|
|
||||||
|
from llama_stack.providers.utils.inference.prompt_adapter import (
|
||||||
|
interleaved_content_as_str,
|
||||||
|
)
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
DefaultRAGQueryGeneratorConfig,
|
DefaultRAGQueryGeneratorConfig,
|
||||||
InterleavedContent,
|
InterleavedContent,
|
||||||
|
|
@ -16,10 +20,6 @@ from llama_stack_api import (
|
||||||
RAGQueryGeneratorConfig,
|
RAGQueryGeneratorConfig,
|
||||||
)
|
)
|
||||||
|
|
||||||
from llama_stack.providers.utils.inference.prompt_adapter import (
|
|
||||||
interleaved_content_as_str,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
async def generate_rag_query(
|
async def generate_rag_query(
|
||||||
config: RAGQueryGeneratorConfig,
|
config: RAGQueryGeneratorConfig,
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,11 @@ from typing import Any
|
||||||
|
|
||||||
import httpx
|
import httpx
|
||||||
from fastapi import UploadFile
|
from fastapi import UploadFile
|
||||||
|
from pydantic import TypeAdapter
|
||||||
|
|
||||||
|
from llama_stack.log import get_logger
|
||||||
|
from llama_stack.providers.utils.inference.prompt_adapter import interleaved_content_as_str
|
||||||
|
from llama_stack.providers.utils.memory.vector_store import parse_data_url
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
URL,
|
URL,
|
||||||
Files,
|
Files,
|
||||||
|
|
@ -34,11 +39,6 @@ from llama_stack_api import (
|
||||||
VectorStoreChunkingStrategyStatic,
|
VectorStoreChunkingStrategyStatic,
|
||||||
VectorStoreChunkingStrategyStaticConfig,
|
VectorStoreChunkingStrategyStaticConfig,
|
||||||
)
|
)
|
||||||
from pydantic import TypeAdapter
|
|
||||||
|
|
||||||
from llama_stack.log import get_logger
|
|
||||||
from llama_stack.providers.utils.inference.prompt_adapter import interleaved_content_as_str
|
|
||||||
from llama_stack.providers.utils.memory.vector_store import parse_data_url
|
|
||||||
|
|
||||||
from .config import RagToolRuntimeConfig
|
from .config import RagToolRuntimeConfig
|
||||||
from .context_retriever import generate_rag_query
|
from .context_retriever import generate_rag_query
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from llama_stack_api import json_schema_type
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
from llama_stack.core.storage.datatypes import KVStoreReference
|
from llama_stack.core.storage.datatypes import KVStoreReference
|
||||||
|
from llama_stack_api import json_schema_type
|
||||||
|
|
||||||
|
|
||||||
@json_schema_type
|
@json_schema_type
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from llama_stack_api import json_schema_type
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
from llama_stack.core.storage.datatypes import KVStoreReference
|
from llama_stack.core.storage.datatypes import KVStoreReference
|
||||||
|
from llama_stack_api import json_schema_type
|
||||||
|
|
||||||
|
|
||||||
@json_schema_type
|
@json_schema_type
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,13 @@ from typing import Any
|
||||||
|
|
||||||
import faiss # type: ignore[import-untyped]
|
import faiss # type: ignore[import-untyped]
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
from numpy.typing import NDArray
|
||||||
|
|
||||||
|
from llama_stack.log import get_logger
|
||||||
|
from llama_stack.providers.utils.kvstore import kvstore_impl
|
||||||
|
from llama_stack.providers.utils.kvstore.api import KVStore
|
||||||
|
from llama_stack.providers.utils.memory.openai_vector_store_mixin import OpenAIVectorStoreMixin
|
||||||
|
from llama_stack.providers.utils.memory.vector_store import ChunkForDeletion, EmbeddingIndex, VectorStoreWithIndex
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
Chunk,
|
Chunk,
|
||||||
Files,
|
Files,
|
||||||
|
|
@ -25,13 +32,6 @@ from llama_stack_api import (
|
||||||
VectorStoreNotFoundError,
|
VectorStoreNotFoundError,
|
||||||
VectorStoresProtocolPrivate,
|
VectorStoresProtocolPrivate,
|
||||||
)
|
)
|
||||||
from numpy.typing import NDArray
|
|
||||||
|
|
||||||
from llama_stack.log import get_logger
|
|
||||||
from llama_stack.providers.utils.kvstore import kvstore_impl
|
|
||||||
from llama_stack.providers.utils.kvstore.api import KVStore
|
|
||||||
from llama_stack.providers.utils.memory.openai_vector_store_mixin import OpenAIVectorStoreMixin
|
|
||||||
from llama_stack.providers.utils.memory.vector_store import ChunkForDeletion, EmbeddingIndex, VectorStoreWithIndex
|
|
||||||
|
|
||||||
from .config import FaissVectorIOConfig
|
from .config import FaissVectorIOConfig
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from llama_stack_api import json_schema_type
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
from llama_stack.core.storage.datatypes import KVStoreReference
|
from llama_stack.core.storage.datatypes import KVStoreReference
|
||||||
|
from llama_stack_api import json_schema_type
|
||||||
|
|
||||||
|
|
||||||
@json_schema_type
|
@json_schema_type
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,10 @@
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from llama_stack_api import json_schema_type
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
from llama_stack.core.storage.datatypes import KVStoreReference
|
from llama_stack.core.storage.datatypes import KVStoreReference
|
||||||
|
from llama_stack_api import json_schema_type
|
||||||
|
|
||||||
|
|
||||||
@json_schema_type
|
@json_schema_type
|
||||||
|
|
|
||||||
|
|
@ -12,16 +12,6 @@ from typing import Any
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import sqlite_vec # type: ignore[import-untyped]
|
import sqlite_vec # type: ignore[import-untyped]
|
||||||
from llama_stack_api import (
|
|
||||||
Chunk,
|
|
||||||
Files,
|
|
||||||
Inference,
|
|
||||||
QueryChunksResponse,
|
|
||||||
VectorIO,
|
|
||||||
VectorStore,
|
|
||||||
VectorStoreNotFoundError,
|
|
||||||
VectorStoresProtocolPrivate,
|
|
||||||
)
|
|
||||||
from numpy.typing import NDArray
|
from numpy.typing import NDArray
|
||||||
|
|
||||||
from llama_stack.log import get_logger
|
from llama_stack.log import get_logger
|
||||||
|
|
@ -35,6 +25,16 @@ from llama_stack.providers.utils.memory.vector_store import (
|
||||||
VectorStoreWithIndex,
|
VectorStoreWithIndex,
|
||||||
)
|
)
|
||||||
from llama_stack.providers.utils.vector_io.vector_utils import WeightedInMemoryAggregator
|
from llama_stack.providers.utils.vector_io.vector_utils import WeightedInMemoryAggregator
|
||||||
|
from llama_stack_api import (
|
||||||
|
Chunk,
|
||||||
|
Files,
|
||||||
|
Inference,
|
||||||
|
QueryChunksResponse,
|
||||||
|
VectorIO,
|
||||||
|
VectorStore,
|
||||||
|
VectorStoreNotFoundError,
|
||||||
|
VectorStoresProtocolPrivate,
|
||||||
|
)
|
||||||
|
|
||||||
logger = get_logger(name=__name__, category="vector_io")
|
logger = get_logger(name=__name__, category="vector_io")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,14 +5,13 @@
|
||||||
# the root directory of this source tree.
|
# the root directory of this source tree.
|
||||||
|
|
||||||
|
|
||||||
|
from llama_stack.providers.utils.kvstore import kvstore_dependencies
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
Api,
|
Api,
|
||||||
InlineProviderSpec,
|
InlineProviderSpec,
|
||||||
ProviderSpec,
|
ProviderSpec,
|
||||||
)
|
)
|
||||||
|
|
||||||
from llama_stack.providers.utils.kvstore import kvstore_dependencies
|
|
||||||
|
|
||||||
|
|
||||||
def available_providers() -> list[ProviderSpec]:
|
def available_providers() -> list[ProviderSpec]:
|
||||||
return [
|
return [
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,8 @@
|
||||||
# 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 llama_stack_api import Api, InlineProviderSpec, ProviderSpec, RemoteProviderSpec
|
|
||||||
|
|
||||||
from llama_stack.providers.utils.sqlstore.sqlstore import sql_store_pip_packages
|
from llama_stack.providers.utils.sqlstore.sqlstore import sql_store_pip_packages
|
||||||
|
from llama_stack_api import Api, InlineProviderSpec, ProviderSpec, RemoteProviderSpec
|
||||||
|
|
||||||
|
|
||||||
def available_providers() -> list[ProviderSpec]:
|
def available_providers() -> list[ProviderSpec]:
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
# the root directory of this source tree.
|
# the root directory of this source tree.
|
||||||
|
|
||||||
|
|
||||||
|
from llama_stack.providers.registry.vector_io import DEFAULT_VECTOR_IO_DEPS
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
Api,
|
Api,
|
||||||
InlineProviderSpec,
|
InlineProviderSpec,
|
||||||
|
|
@ -12,8 +13,6 @@ from llama_stack_api import (
|
||||||
RemoteProviderSpec,
|
RemoteProviderSpec,
|
||||||
)
|
)
|
||||||
|
|
||||||
from llama_stack.providers.registry.vector_io import DEFAULT_VECTOR_IO_DEPS
|
|
||||||
|
|
||||||
|
|
||||||
def available_providers() -> list[ProviderSpec]:
|
def available_providers() -> list[ProviderSpec]:
|
||||||
return [
|
return [
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,9 @@
|
||||||
from typing import Any
|
from typing import Any
|
||||||
from urllib.parse import parse_qs, urlparse
|
from urllib.parse import parse_qs, urlparse
|
||||||
|
|
||||||
from llama_stack_api import Dataset, DatasetIO, DatasetsProtocolPrivate, PaginatedResponse
|
|
||||||
|
|
||||||
from llama_stack.providers.utils.kvstore import kvstore_impl
|
from llama_stack.providers.utils.kvstore import kvstore_impl
|
||||||
from llama_stack.providers.utils.pagination import paginate_records
|
from llama_stack.providers.utils.pagination import paginate_records
|
||||||
|
from llama_stack_api import Dataset, DatasetIO, DatasetsProtocolPrivate, PaginatedResponse
|
||||||
|
|
||||||
from .config import HuggingfaceDatasetIOConfig
|
from .config import HuggingfaceDatasetIOConfig
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
|
|
||||||
from llama_stack_api import URL, Dataset, PaginatedResponse, ParamType
|
from llama_stack_api import URL, Dataset, PaginatedResponse, ParamType
|
||||||
|
|
||||||
from .config import NvidiaDatasetIOConfig
|
from .config import NvidiaDatasetIOConfig
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
from llama_stack.providers.utils.inference.model_registry import ModelRegistryHelper
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
Agents,
|
Agents,
|
||||||
Benchmark,
|
Benchmark,
|
||||||
|
|
@ -22,8 +24,6 @@ from llama_stack_api import (
|
||||||
ScoringResult,
|
ScoringResult,
|
||||||
)
|
)
|
||||||
|
|
||||||
from llama_stack.providers.utils.inference.model_registry import ModelRegistryHelper
|
|
||||||
|
|
||||||
from .config import NVIDIAEvalConfig
|
from .config import NVIDIAEvalConfig
|
||||||
|
|
||||||
DEFAULT_NAMESPACE = "nvidia"
|
DEFAULT_NAMESPACE = "nvidia"
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,12 @@ from datetime import UTC, datetime
|
||||||
from typing import Annotated, Any
|
from typing import Annotated, Any
|
||||||
|
|
||||||
from fastapi import Depends, File, Form, Response, UploadFile
|
from fastapi import Depends, File, Form, Response, UploadFile
|
||||||
|
|
||||||
|
from llama_stack.core.datatypes import AccessRule
|
||||||
|
from llama_stack.providers.utils.files.form_data import parse_expires_after
|
||||||
|
from llama_stack.providers.utils.sqlstore.api import ColumnDefinition, ColumnType
|
||||||
|
from llama_stack.providers.utils.sqlstore.authorized_sqlstore import AuthorizedSqlStore
|
||||||
|
from llama_stack.providers.utils.sqlstore.sqlstore import sqlstore_impl
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
ExpiresAfter,
|
ExpiresAfter,
|
||||||
Files,
|
Files,
|
||||||
|
|
@ -18,12 +24,6 @@ from llama_stack_api import (
|
||||||
Order,
|
Order,
|
||||||
ResourceNotFoundError,
|
ResourceNotFoundError,
|
||||||
)
|
)
|
||||||
|
|
||||||
from llama_stack.core.datatypes import AccessRule
|
|
||||||
from llama_stack.providers.utils.files.form_data import parse_expires_after
|
|
||||||
from llama_stack.providers.utils.sqlstore.api import ColumnDefinition, ColumnType
|
|
||||||
from llama_stack.providers.utils.sqlstore.authorized_sqlstore import AuthorizedSqlStore
|
|
||||||
from llama_stack.providers.utils.sqlstore.sqlstore import sqlstore_impl
|
|
||||||
from openai import OpenAI
|
from openai import OpenAI
|
||||||
|
|
||||||
from .config import OpenAIFilesImplConfig
|
from .config import OpenAIFilesImplConfig
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,12 @@ from fastapi import Depends, File, Form, Response, UploadFile
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from mypy_boto3_s3.client import S3Client
|
from mypy_boto3_s3.client import S3Client
|
||||||
|
|
||||||
|
from llama_stack.core.datatypes import AccessRule
|
||||||
|
from llama_stack.core.id_generation import generate_object_id
|
||||||
|
from llama_stack.providers.utils.files.form_data import parse_expires_after
|
||||||
|
from llama_stack.providers.utils.sqlstore.api import ColumnDefinition, ColumnType
|
||||||
|
from llama_stack.providers.utils.sqlstore.authorized_sqlstore import AuthorizedSqlStore
|
||||||
|
from llama_stack.providers.utils.sqlstore.sqlstore import sqlstore_impl
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
ExpiresAfter,
|
ExpiresAfter,
|
||||||
Files,
|
Files,
|
||||||
|
|
@ -28,13 +34,6 @@ from llama_stack_api import (
|
||||||
ResourceNotFoundError,
|
ResourceNotFoundError,
|
||||||
)
|
)
|
||||||
|
|
||||||
from llama_stack.core.datatypes import AccessRule
|
|
||||||
from llama_stack.core.id_generation import generate_object_id
|
|
||||||
from llama_stack.providers.utils.files.form_data import parse_expires_after
|
|
||||||
from llama_stack.providers.utils.sqlstore.api import ColumnDefinition, ColumnType
|
|
||||||
from llama_stack.providers.utils.sqlstore.authorized_sqlstore import AuthorizedSqlStore
|
|
||||||
from llama_stack.providers.utils.sqlstore.sqlstore import sqlstore_impl
|
|
||||||
|
|
||||||
from .config import S3FilesImplConfig
|
from .config import S3FilesImplConfig
|
||||||
|
|
||||||
# TODO: provider data for S3 credentials
|
# TODO: provider data for S3 credentials
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from llama_stack_api import json_schema_type
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
from llama_stack.providers.utils.inference.model_registry import RemoteInferenceProviderConfig
|
from llama_stack.providers.utils.inference.model_registry import RemoteInferenceProviderConfig
|
||||||
|
from llama_stack_api import json_schema_type
|
||||||
|
|
||||||
|
|
||||||
class AnthropicProviderDataValidator(BaseModel):
|
class AnthropicProviderDataValidator(BaseModel):
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,10 @@
|
||||||
import os
|
import os
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from llama_stack_api import json_schema_type
|
|
||||||
from pydantic import BaseModel, Field, HttpUrl, SecretStr
|
from pydantic import BaseModel, Field, HttpUrl, SecretStr
|
||||||
|
|
||||||
from llama_stack.providers.utils.inference.model_registry import RemoteInferenceProviderConfig
|
from llama_stack.providers.utils.inference.model_registry import RemoteInferenceProviderConfig
|
||||||
|
from llama_stack_api import json_schema_type
|
||||||
|
|
||||||
|
|
||||||
class AzureProviderDataValidator(BaseModel):
|
class AzureProviderDataValidator(BaseModel):
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,11 @@
|
||||||
|
|
||||||
from collections.abc import AsyncIterator, Iterable
|
from collections.abc import AsyncIterator, Iterable
|
||||||
|
|
||||||
|
from openai import AuthenticationError
|
||||||
|
|
||||||
|
from llama_stack.core.telemetry.tracing import get_current_span
|
||||||
|
from llama_stack.log import get_logger
|
||||||
|
from llama_stack.providers.utils.inference.openai_mixin import OpenAIMixin
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
OpenAIChatCompletion,
|
OpenAIChatCompletion,
|
||||||
OpenAIChatCompletionChunk,
|
OpenAIChatCompletionChunk,
|
||||||
|
|
@ -15,11 +20,6 @@ from llama_stack_api import (
|
||||||
OpenAIEmbeddingsRequestWithExtraBody,
|
OpenAIEmbeddingsRequestWithExtraBody,
|
||||||
OpenAIEmbeddingsResponse,
|
OpenAIEmbeddingsResponse,
|
||||||
)
|
)
|
||||||
from openai import AuthenticationError
|
|
||||||
|
|
||||||
from llama_stack.core.telemetry.tracing import get_current_span
|
|
||||||
from llama_stack.log import get_logger
|
|
||||||
from llama_stack.providers.utils.inference.openai_mixin import OpenAIMixin
|
|
||||||
|
|
||||||
from .config import BedrockConfig
|
from .config import BedrockConfig
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,12 @@
|
||||||
|
|
||||||
from urllib.parse import urljoin
|
from urllib.parse import urljoin
|
||||||
|
|
||||||
|
from llama_stack.providers.utils.inference.openai_mixin import OpenAIMixin
|
||||||
from llama_stack_api import (
|
from llama_stack_api import (
|
||||||
OpenAIEmbeddingsRequestWithExtraBody,
|
OpenAIEmbeddingsRequestWithExtraBody,
|
||||||
OpenAIEmbeddingsResponse,
|
OpenAIEmbeddingsResponse,
|
||||||
)
|
)
|
||||||
|
|
||||||
from llama_stack.providers.utils.inference.openai_mixin import OpenAIMixin
|
|
||||||
|
|
||||||
from .config import CerebrasImplConfig
|
from .config import CerebrasImplConfig
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,10 @@
|
||||||
import os
|
import os
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from llama_stack_api import json_schema_type
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
from llama_stack.providers.utils.inference.model_registry import RemoteInferenceProviderConfig
|
from llama_stack.providers.utils.inference.model_registry import RemoteInferenceProviderConfig
|
||||||
|
from llama_stack_api import json_schema_type
|
||||||
|
|
||||||
DEFAULT_BASE_URL = "https://api.cerebras.ai"
|
DEFAULT_BASE_URL = "https://api.cerebras.ai"
|
||||||
|
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue