mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-17 16:19:53 +00:00
Allow using an "inline" version of Chroma using PersistentClient
This commit is contained in:
parent
e2054d53e4
commit
44ab7d93fb
9 changed files with 71 additions and 69 deletions
26
llama_stack/providers/remote/memory/chroma/config.py
Normal file
26
llama_stack/providers/remote/memory/chroma/config.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under the terms described in the LICENSE file in
|
||||
# the root directory of this source tree.
|
||||
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
from llama_models.schema_utils import json_schema_type
|
||||
from pydantic import BaseModel, model_validator
|
||||
|
||||
|
||||
@json_schema_type
|
||||
class ChromaConfig(BaseModel):
|
||||
# You can either specify the url of the chroma server or the path to the local db
|
||||
url: Optional[str] = None
|
||||
db_path: Optional[str] = None
|
||||
|
||||
@model_validator(mode="after")
|
||||
def check_url_or_db_path(self):
|
||||
if not (self.url or self.db_path):
|
||||
raise ValueError("Either url or db_path must be specified")
|
||||
|
||||
@classmethod
|
||||
def sample_config(cls) -> Dict[str, Any]:
|
||||
return {"url": "{env.CHROMADB_URL}"}
|
||||
Loading…
Add table
Add a link
Reference in a new issue