From 210e291c5761df9c7c43316ed638221fe609ea96 Mon Sep 17 00:00:00 2001 From: Ashwin Bharambe Date: Wed, 11 Dec 2024 15:44:55 -0800 Subject: [PATCH] Undo the unnecessary revert for the client code path --- llama_stack/providers/remote/memory/chroma/chroma.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/llama_stack/providers/remote/memory/chroma/chroma.py b/llama_stack/providers/remote/memory/chroma/chroma.py index 3fe6aa938..f4fb50a7c 100644 --- a/llama_stack/providers/remote/memory/chroma/chroma.py +++ b/llama_stack/providers/remote/memory/chroma/chroma.py @@ -7,6 +7,7 @@ import asyncio import json import logging from typing import List +from urllib.parse import urlparse import chromadb from numpy.typing import NDArray @@ -96,7 +97,15 @@ class ChromaMemoryAdapter(Memory, MemoryBanksProtocolPrivate): async def initialize(self) -> None: if isinstance(self.config, ChromaRemoteImplConfig): 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: log.info(f"Connecting to Chroma local db at: {self.config.db_path}") self.client = chromadb.PersistentClient(path=self.config.db_path)