mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-08-03 09:21:45 +00:00
Undo the unnecessary revert for the client code path
This commit is contained in:
parent
f0e045d1c8
commit
210e291c57
1 changed files with 10 additions and 1 deletions
|
@ -7,6 +7,7 @@ import asyncio
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
from typing import List
|
from typing import List
|
||||||
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
import chromadb
|
import chromadb
|
||||||
from numpy.typing import NDArray
|
from numpy.typing import NDArray
|
||||||
|
@ -96,7 +97,15 @@ class ChromaMemoryAdapter(Memory, MemoryBanksProtocolPrivate):
|
||||||
async def initialize(self) -> None:
|
async def initialize(self) -> None:
|
||||||
if isinstance(self.config, ChromaRemoteImplConfig):
|
if isinstance(self.config, ChromaRemoteImplConfig):
|
||||||
log.info(f"Connecting to Chroma server at: {self.config.url}")
|
log.info(f"Connecting to Chroma server at: {self.config.url}")
|
||||||
self.client = await chromadb.AsyncHttpClient(url=self.config.url)
|
url = self.config.url.rstrip("/")
|
||||||
|
parsed = urlparse(url)
|
||||||
|
|
||||||
|
if parsed.path and parsed.path != "/":
|
||||||
|
raise ValueError("URL should not contain a path")
|
||||||
|
|
||||||
|
self.client = await chromadb.AsyncHttpClient(
|
||||||
|
host=parsed.hostname, port=parsed.port
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
log.info(f"Connecting to Chroma local db at: {self.config.db_path}")
|
log.info(f"Connecting to Chroma local db at: {self.config.db_path}")
|
||||||
self.client = chromadb.PersistentClient(path=self.config.db_path)
|
self.client = chromadb.PersistentClient(path=self.config.db_path)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue