mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-07-29 15:23:51 +00:00
clean up
This commit is contained in:
parent
d8fab77a4f
commit
bc4ac2ceb4
4 changed files with 28 additions and 36 deletions
|
@ -389,12 +389,7 @@ 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()
|
||||||
|
|
||||||
# check if routing table exists
|
impls, specs = asyncio.run(resolve_impls_with_routing(config))
|
||||||
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,7 +33,6 @@ 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,36 +128,35 @@ class PGVectorMemoryAdapter(Memory):
|
||||||
self.cache = {}
|
self.cache = {}
|
||||||
|
|
||||||
async def initialize(self) -> None:
|
async def initialize(self) -> None:
|
||||||
print("Init PGVector!")
|
try:
|
||||||
# try:
|
self.conn = psycopg2.connect(
|
||||||
# self.conn = psycopg2.connect(
|
host=self.config.host,
|
||||||
# host=self.config.host,
|
port=self.config.port,
|
||||||
# port=self.config.port,
|
database=self.config.db,
|
||||||
# database=self.config.db,
|
user=self.config.user,
|
||||||
# user=self.config.user,
|
password=self.config.password,
|
||||||
# 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,8 +68,7 @@ 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