chroma.py 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. from typing import Optional
  2. from embedchain.config.vectordb.base import BaseVectorDbConfig
  3. from embedchain.helpers.json_serializable import register_deserializable
  4. @register_deserializable
  5. class ChromaDbConfig(BaseVectorDbConfig):
  6. def __init__(
  7. self,
  8. collection_name: Optional[str] = None,
  9. dir: Optional[str] = None,
  10. host: Optional[str] = None,
  11. port: Optional[str] = None,
  12. batch_size: Optional[int] = 100,
  13. allow_reset=False,
  14. chroma_settings: Optional[dict] = None,
  15. ):
  16. """
  17. Initializes a configuration class instance for ChromaDB.
  18. :param collection_name: Default name for the collection, defaults to None
  19. :type collection_name: Optional[str], optional
  20. :param dir: Path to the database directory, where the database is stored, defaults to None
  21. :type dir: Optional[str], optional
  22. :param host: Database connection remote host. Use this if you run Embedchain as a client, defaults to None
  23. :type host: Optional[str], optional
  24. :param port: Database connection remote port. Use this if you run Embedchain as a client, defaults to None
  25. :type port: Optional[str], optional
  26. :param batch_size: Number of items to insert in one batch, defaults to 100
  27. :type batch_size: Optional[int], optional
  28. :param allow_reset: Resets the database. defaults to False
  29. :type allow_reset: bool
  30. :param chroma_settings: Chroma settings dict, defaults to None
  31. :type chroma_settings: Optional[dict], optional
  32. """
  33. self.chroma_settings = chroma_settings
  34. self.allow_reset = allow_reset
  35. self.batch_size = batch_size
  36. super().__init__(collection_name=collection_name, dir=dir, host=host, port=port)