mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-04 12:07:34 +00:00
Revert "fix(test): chrome db test fails due to reusing deleted collection"
This reverts commit aac26e8c6c2965fa6a5d2918c2b92ea34b074c46.
This commit is contained in:
parent
733d0c70fe
commit
5482396459
1 changed files with 2 additions and 9 deletions
|
@ -56,11 +56,10 @@ class ChromaIndex(EmbeddingIndex):
|
||||||
def __init__(self, client: ChromaClientType, collection, kvstore: KVStore | None = None):
|
def __init__(self, client: ChromaClientType, collection, kvstore: KVStore | None = None):
|
||||||
self.client = client
|
self.client = client
|
||||||
self.collection = collection
|
self.collection = collection
|
||||||
self.collection_name = collection.name
|
|
||||||
self.kvstore = kvstore
|
self.kvstore = kvstore
|
||||||
|
|
||||||
async def initialize(self):
|
async def initialize(self):
|
||||||
self.collection = await maybe_await(self.client.get_or_create_collection(self.collection_name))
|
pass
|
||||||
|
|
||||||
async def add_chunks(self, chunks: list[Chunk], embeddings: NDArray):
|
async def add_chunks(self, chunks: list[Chunk], embeddings: NDArray):
|
||||||
assert len(chunks) == len(embeddings), (
|
assert len(chunks) == len(embeddings), (
|
||||||
|
@ -107,13 +106,7 @@ class ChromaIndex(EmbeddingIndex):
|
||||||
return QueryChunksResponse(chunks=chunks, scores=scores)
|
return QueryChunksResponse(chunks=chunks, scores=scores)
|
||||||
|
|
||||||
async def delete(self):
|
async def delete(self):
|
||||||
try:
|
await maybe_await(self.client.delete_collection(self.collection.name))
|
||||||
await maybe_await(self.client.delete_collection(self.collection.name))
|
|
||||||
except Exception as e:
|
|
||||||
if "does not exists" in str(e):
|
|
||||||
log.warning(f"Collection {self.collection.name} already deleted")
|
|
||||||
else:
|
|
||||||
raise
|
|
||||||
|
|
||||||
async def query_keyword(
|
async def query_keyword(
|
||||||
self,
|
self,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue