Create a separate inline::chromadb provider

This commit is contained in:
Ashwin Bharambe 2024-12-11 14:11:08 -08:00
parent 44ab7d93fb
commit f0e045d1c8
7 changed files with 73 additions and 45 deletions

View file

@ -4,22 +4,13 @@
# 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 typing import Any, Dict
from llama_models.schema_utils import json_schema_type
from pydantic import BaseModel, model_validator
from pydantic import BaseModel
@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")
class ChromaRemoteImplConfig(BaseModel):
url: str
@classmethod
def sample_config(cls) -> Dict[str, Any]: