base.py 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. from typing import Optional
  2. from embedchain.config.base_config import BaseConfig
  3. class BaseVectorDbConfig(BaseConfig):
  4. def __init__(
  5. self,
  6. collection_name: Optional[str] = None,
  7. dir: str = "db",
  8. host: Optional[str] = None,
  9. port: Optional[str] = None,
  10. batch_size: Optional[int] = 100,
  11. **kwargs,
  12. ):
  13. """
  14. Initializes a configuration class instance for the vector database.
  15. :param collection_name: Default name for the collection, defaults to None
  16. :type collection_name: Optional[str], optional
  17. :param dir: Path to the database directory, where the database is stored, defaults to "db"
  18. :type dir: str, optional
  19. :param host: Database connection remote host. Use this if you run Embedchain as a client, defaults to None
  20. :type host: Optional[str], optional
  21. :param host: Database connection remote port. Use this if you run Embedchain as a client, defaults to None
  22. :type port: Optional[str], optional
  23. :param batch_size: Number of items to insert in one batch, defaults to 100
  24. :type batch_size: Optional[int], optional
  25. :param kwargs: Additional keyword arguments
  26. :type kwargs: dict
  27. """
  28. self.collection_name = collection_name or "embedchain_store"
  29. self.dir = dir
  30. self.host = host
  31. self.port = port
  32. self.batch_size = batch_size
  33. # Assign additional keyword arguments
  34. if kwargs:
  35. for key, value in kwargs.items():
  36. setattr(self, key, value)