mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-07-29 15:23:51 +00:00
parent
cbd4fa6044
commit
ee77431b64
4 changed files with 36 additions and 28 deletions
|
@ -389,7 +389,12 @@ def main(yaml_config: str, port: int = 5000, disable_ipv6: bool = False):
|
||||||
cprint(f"StackRunConfig: {config}", "blue")
|
cprint(f"StackRunConfig: {config}", "blue")
|
||||||
app = FastAPI()
|
app = FastAPI()
|
||||||
|
|
||||||
impls, specs = asyncio.run(resolve_impls_with_routing(config))
|
# check if routing table exists
|
||||||
|
if config.provider_routing_table is not None:
|
||||||
|
impls, specs = asyncio.run(resolve_impls_with_routing(config))
|
||||||
|
else:
|
||||||
|
# keeping this for backwards compatibility
|
||||||
|
impls, specs = asyncio.run(resolve_impls(config.provider_map))
|
||||||
|
|
||||||
if Api.telemetry in impls:
|
if Api.telemetry in impls:
|
||||||
setup_logger(impls[Api.telemetry])
|
setup_logger(impls[Api.telemetry])
|
||||||
|
|
|
@ -33,6 +33,7 @@ async def instantiate_provider(
|
||||||
|
|
||||||
assert isinstance(provider_config, GenericProviderConfig)
|
assert isinstance(provider_config, GenericProviderConfig)
|
||||||
config_type = instantiate_class_type(provider_spec.config_class)
|
config_type = instantiate_class_type(provider_spec.config_class)
|
||||||
|
print("!!!", provider_config)
|
||||||
config = config_type(**provider_config.config)
|
config = config_type(**provider_config.config)
|
||||||
args = [config, deps]
|
args = [config, deps]
|
||||||
elif isinstance(provider_spec, RouterProviderSpec):
|
elif isinstance(provider_spec, RouterProviderSpec):
|
||||||
|
|
|
@ -128,35 +128,36 @@ class PGVectorMemoryAdapter(Memory):
|
||||||
self.cache = {}
|
self.cache = {}
|
||||||
|
|
||||||
async def initialize(self) -> None:
|
async def initialize(self) -> None:
|
||||||
try:
|
print("Init PGVector!")
|
||||||
self.conn = psycopg2.connect(
|
# try:
|
||||||
host=self.config.host,
|
# self.conn = psycopg2.connect(
|
||||||
port=self.config.port,
|
# host=self.config.host,
|
||||||
database=self.config.db,
|
# port=self.config.port,
|
||||||
user=self.config.user,
|
# database=self.config.db,
|
||||||
password=self.config.password,
|
# user=self.config.user,
|
||||||
)
|
# password=self.config.password,
|
||||||
self.cursor = self.conn.cursor()
|
# )
|
||||||
|
# self.cursor = self.conn.cursor()
|
||||||
|
|
||||||
version = check_extension_version(self.cursor)
|
# version = check_extension_version(self.cursor)
|
||||||
if version:
|
# if version:
|
||||||
print(f"Vector extension version: {version}")
|
# print(f"Vector extension version: {version}")
|
||||||
else:
|
# else:
|
||||||
raise RuntimeError("Vector extension is not installed.")
|
# raise RuntimeError("Vector extension is not installed.")
|
||||||
|
|
||||||
self.cursor.execute(
|
# self.cursor.execute(
|
||||||
"""
|
# """
|
||||||
CREATE TABLE IF NOT EXISTS metadata_store (
|
# CREATE TABLE IF NOT EXISTS metadata_store (
|
||||||
key TEXT PRIMARY KEY,
|
# key TEXT PRIMARY KEY,
|
||||||
data JSONB
|
# data JSONB
|
||||||
)
|
# )
|
||||||
"""
|
# """
|
||||||
)
|
# )
|
||||||
except Exception as e:
|
# except Exception as e:
|
||||||
import traceback
|
# import traceback
|
||||||
|
|
||||||
traceback.print_exc()
|
# traceback.print_exc()
|
||||||
raise RuntimeError("Could not connect to PGVector database server") from e
|
# raise RuntimeError("Could not connect to PGVector database server") from e
|
||||||
|
|
||||||
async def shutdown(self) -> None:
|
async def shutdown(self) -> None:
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -68,7 +68,8 @@ class FaissMemoryImpl(Memory):
|
||||||
self.config = config
|
self.config = config
|
||||||
self.cache = {}
|
self.cache = {}
|
||||||
|
|
||||||
async def initialize(self) -> None: ...
|
async def initialize(self) -> None:
|
||||||
|
print("INIT meta-reference")
|
||||||
|
|
||||||
async def shutdown(self) -> None: ...
|
async def shutdown(self) -> None: ...
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue