mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-28 19:04:19 +00:00
Fix Chroma adapter (#893)
Chroma method had the wrong signature. ## Test Plan Start Chroma: `chroma run --path /tmp/foo/chroma2 --host localhost --port 6001` Modify run.yaml to include Chroma server pointing to localhost:6001 and run `llama stack run` Then: ```bash LLAMA_STACK_BASE_URL=http://localhost:8321 pytest -s -v agents/test_agents.py -k rag ``` passes
This commit is contained in:
parent
ec3ebb5bcf
commit
f2feb7d15c
1 changed files with 4 additions and 3 deletions
|
@ -46,11 +46,12 @@ class ChromaIndex(EmbeddingIndex):
|
|||
embeddings
|
||||
), f"Chunk length {len(chunks)} does not match embedding length {len(embeddings)}"
|
||||
|
||||
ids = [f"{c.metadata['document_id']}:chunk-{i}" for i, c in enumerate(chunks)]
|
||||
await maybe_await(
|
||||
self.collection.add(
|
||||
documents=[chunk.model_dump_json() for chunk in chunks],
|
||||
embeddings=embeddings,
|
||||
ids=[f"{c.document_id}:chunk-{i}" for i, c in enumerate(chunks)],
|
||||
ids=ids,
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -140,11 +141,11 @@ class ChromaVectorIOAdapter(VectorIO, VectorDBsProtocolPrivate):
|
|||
self,
|
||||
vector_db_id: str,
|
||||
chunks: List[Chunk],
|
||||
embeddings: NDArray,
|
||||
ttl_seconds: Optional[int] = None,
|
||||
) -> None:
|
||||
index = await self._get_and_cache_vector_db_index(vector_db_id)
|
||||
|
||||
await index.insert_chunks(chunks, embeddings)
|
||||
await index.insert_chunks(chunks)
|
||||
|
||||
async def query_chunks(
|
||||
self,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue