mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-08 04:54:38 +00:00
kvstore impls for redis / sqlite moved
This commit is contained in:
parent
c1ab66f1e6
commit
61974e337f
16 changed files with 137 additions and 114 deletions
30
llama_stack/providers/utils/kvstore/kvstore.py
Normal file
30
llama_stack/providers/utils/kvstore/kvstore.py
Normal file
|
@ -0,0 +1,30 @@
|
|||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under the terms described in the LICENSE file in
|
||||
# the root directory of this source tree.
|
||||
|
||||
from .api import * # noqa: F403
|
||||
from .config import * # noqa: F403
|
||||
|
||||
|
||||
def kvstore_dependencies():
|
||||
return ["aiosqlite", "psycopg2-binary", "redis"]
|
||||
|
||||
|
||||
async def kvstore_impl(config: KVStoreConfig) -> KVStore:
|
||||
if config.type == KVStoreType.redis:
|
||||
from .redis import RedisKVStoreImpl
|
||||
|
||||
impl = RedisKVStoreImpl(config)
|
||||
elif config.type == KVStoreType.sqlite:
|
||||
from .sqlite import SqliteKVStoreImpl
|
||||
|
||||
impl = SqliteKVStoreImpl(config)
|
||||
elif config.type == KVStoreType.pgvector:
|
||||
raise NotImplementedError()
|
||||
else:
|
||||
raise ValueError(f"Unknown kvstore type {config.type}")
|
||||
|
||||
await impl.initialize()
|
||||
return impl
|
Loading…
Add table
Add a link
Reference in a new issue