mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-12 12:06:04 +00:00
fixes
This commit is contained in:
parent
490b212576
commit
84372fa831
6 changed files with 31 additions and 17 deletions
|
|
@ -79,13 +79,13 @@ See [Chroma's documentation](https://docs.trychroma.com/docs/overview/introducti
|
||||||
| Field | Type | Required | Default | Description |
|
| Field | Type | Required | Default | Description |
|
||||||
|-------|------|----------|---------|-------------|
|
|-------|------|----------|---------|-------------|
|
||||||
| `db_path` | `<class 'str'>` | No | | |
|
| `db_path` | `<class 'str'>` | No | | |
|
||||||
| `kvstore` | `<class 'llama_stack.core.storage.datatypes.KVStoreReference'>` | No | | Config for KV store backend |
|
| `persistence` | `<class 'llama_stack.core.storage.datatypes.KVStoreReference'>` | No | | Config for KV store backend |
|
||||||
|
|
||||||
## Sample Configuration
|
## Sample Configuration
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
db_path: ${env.CHROMADB_PATH}
|
db_path: ${env.CHROMADB_PATH}
|
||||||
kvstore:
|
persistence:
|
||||||
namespace: vector_io::chroma
|
namespace: vector_io::chroma
|
||||||
backend: kv_default
|
backend: kv_default
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -78,13 +78,13 @@ See [Chroma's documentation](https://docs.trychroma.com/docs/overview/introducti
|
||||||
| Field | Type | Required | Default | Description |
|
| Field | Type | Required | Default | Description |
|
||||||
|-------|------|----------|---------|-------------|
|
|-------|------|----------|---------|-------------|
|
||||||
| `url` | `str \| None` | No | | |
|
| `url` | `str \| None` | No | | |
|
||||||
| `kvstore` | `<class 'llama_stack.core.storage.datatypes.KVStoreReference'>` | No | | Config for KV store backend |
|
| `persistence` | `<class 'llama_stack.core.storage.datatypes.KVStoreReference'>` | No | | Config for KV store backend |
|
||||||
|
|
||||||
## Sample Configuration
|
## Sample Configuration
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
url: ${env.CHROMADB_URL}
|
url: ${env.CHROMADB_URL}
|
||||||
kvstore:
|
persistence:
|
||||||
namespace: vector_io::chroma_remote
|
namespace: vector_io::chroma_remote
|
||||||
backend: kv_default
|
backend: kv_default
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -294,7 +294,7 @@ def _generate_run_config(
|
||||||
Generate a run.yaml template file for user to edit from a build.yaml file
|
Generate a run.yaml template file for user to edit from a build.yaml file
|
||||||
"""
|
"""
|
||||||
apis = list(build_config.distribution_spec.providers.keys())
|
apis = list(build_config.distribution_spec.providers.keys())
|
||||||
distro_dir = f"~/.llama/distributions/{image_name}"
|
distro_dir = DISTRIBS_BASE_DIR / image_name
|
||||||
storage = StorageConfig(
|
storage = StorageConfig(
|
||||||
backends={
|
backends={
|
||||||
"kv_default": SqliteKVStoreConfig(
|
"kv_default": SqliteKVStoreConfig(
|
||||||
|
|
|
||||||
|
|
@ -17,10 +17,19 @@ from llama_stack.core.datatypes import (
|
||||||
BuildConfig,
|
BuildConfig,
|
||||||
Provider,
|
Provider,
|
||||||
StackRunConfig,
|
StackRunConfig,
|
||||||
|
StorageConfig,
|
||||||
)
|
)
|
||||||
from llama_stack.core.distribution import get_provider_registry
|
from llama_stack.core.distribution import get_provider_registry
|
||||||
from llama_stack.core.resolver import InvalidProviderError
|
from llama_stack.core.resolver import InvalidProviderError
|
||||||
from llama_stack.core.utils.config_dirs import EXTERNAL_PROVIDERS_DIR
|
from llama_stack.core.storage.datatypes import (
|
||||||
|
InferenceStoreReference,
|
||||||
|
KVStoreReference,
|
||||||
|
ServerStoresConfig,
|
||||||
|
SqliteKVStoreConfig,
|
||||||
|
SqliteSqlStoreConfig,
|
||||||
|
SqlStoreReference,
|
||||||
|
)
|
||||||
|
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.providers.datatypes import Api
|
from llama_stack.providers.datatypes import Api
|
||||||
|
|
@ -51,11 +60,23 @@ def generate_run_config(
|
||||||
Generate a run.yaml template file for user to edit from a build.yaml file
|
Generate a run.yaml template file for user to edit from a build.yaml file
|
||||||
"""
|
"""
|
||||||
apis = list(build_config.distribution_spec.providers.keys())
|
apis = list(build_config.distribution_spec.providers.keys())
|
||||||
|
distro_dir = DISTRIBS_BASE_DIR / image_name
|
||||||
run_config = StackRunConfig(
|
run_config = StackRunConfig(
|
||||||
container_image=(image_name if build_config.image_type == LlamaStackImageType.CONTAINER.value else None),
|
container_image=(image_name if build_config.image_type == LlamaStackImageType.CONTAINER.value else None),
|
||||||
image_name=image_name,
|
image_name=image_name,
|
||||||
apis=apis,
|
apis=apis,
|
||||||
providers={},
|
providers={},
|
||||||
|
storage=StorageConfig(
|
||||||
|
backends={
|
||||||
|
"kv_default": SqliteKVStoreConfig(db_path=str(distro_dir / "kvstore.db")),
|
||||||
|
"sql_default": SqliteSqlStoreConfig(db_path=str(distro_dir / "sql_store.db")),
|
||||||
|
},
|
||||||
|
stores=ServerStoresConfig(
|
||||||
|
metadata=KVStoreReference(backend="kv_default", namespace="registry"),
|
||||||
|
inference=InferenceStoreReference(backend="sql_default", table_name="inference_store"),
|
||||||
|
conversations=SqlStoreReference(backend="sql_default", table_name="openai_conversations"),
|
||||||
|
),
|
||||||
|
),
|
||||||
external_providers_dir=build_config.external_providers_dir
|
external_providers_dir=build_config.external_providers_dir
|
||||||
if build_config.external_providers_dir
|
if build_config.external_providers_dir
|
||||||
else EXTERNAL_PROVIDERS_DIR,
|
else EXTERNAL_PROVIDERS_DIR,
|
||||||
|
|
|
||||||
|
|
@ -29,19 +29,15 @@ from llama_stack.providers.inline.agents.meta_reference.persistence import Agent
|
||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
def setup_backends(tmp_path):
|
def setup_backends(tmp_path):
|
||||||
"""Register KV and SQL store backends for testing."""
|
"""Register KV and SQL store backends for testing."""
|
||||||
from llama_stack.core.storage.datatypes import SqliteSqlStoreConfig, SqliteKVStoreConfig
|
from llama_stack.core.storage.datatypes import SqliteKVStoreConfig, SqliteSqlStoreConfig
|
||||||
from llama_stack.providers.utils.kvstore.kvstore import register_kvstore_backends
|
from llama_stack.providers.utils.kvstore.kvstore import register_kvstore_backends
|
||||||
from llama_stack.providers.utils.sqlstore.sqlstore import register_sqlstore_backends
|
from llama_stack.providers.utils.sqlstore.sqlstore import register_sqlstore_backends
|
||||||
|
|
||||||
kv_path = str(tmp_path / "test_kv.db")
|
kv_path = str(tmp_path / "test_kv.db")
|
||||||
sql_path = str(tmp_path / "test_sql.db")
|
sql_path = str(tmp_path / "test_sql.db")
|
||||||
|
|
||||||
register_kvstore_backends({
|
register_kvstore_backends({"kv_default": SqliteKVStoreConfig(db_path=kv_path)})
|
||||||
"kv_default": SqliteKVStoreConfig(db_path=kv_path)
|
register_sqlstore_backends({"sql_default": SqliteSqlStoreConfig(db_path=sql_path)})
|
||||||
})
|
|
||||||
register_sqlstore_backends({
|
|
||||||
"sql_default": SqliteSqlStoreConfig(db_path=sql_path)
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@
|
||||||
# the root directory of this source tree.
|
# the root directory of this source tree.
|
||||||
|
|
||||||
import time
|
import time
|
||||||
from tempfile import TemporaryDirectory
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
@ -25,9 +24,7 @@ from llama_stack.providers.utils.sqlstore.sqlstore import register_sqlstore_back
|
||||||
def setup_backends(tmp_path):
|
def setup_backends(tmp_path):
|
||||||
"""Register SQL store backends for testing."""
|
"""Register SQL store backends for testing."""
|
||||||
db_path = str(tmp_path / "test.db")
|
db_path = str(tmp_path / "test.db")
|
||||||
register_sqlstore_backends({
|
register_sqlstore_backends({"sql_default": SqliteSqlStoreConfig(db_path=db_path)})
|
||||||
"sql_default": SqliteSqlStoreConfig(db_path=db_path)
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
def create_test_chat_completion(
|
def create_test_chat_completion(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue