open_source_app_config.py 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. from typing import Optional
  2. from embedchain.helper.json_serializable import register_deserializable
  3. from .base_app_config import BaseAppConfig
  4. @register_deserializable
  5. class OpenSourceAppConfig(BaseAppConfig):
  6. """
  7. Config to initialize an embedchain custom `OpenSourceApp` instance, with extra config options.
  8. """
  9. def __init__(
  10. self,
  11. log_level: str = "WARNING",
  12. id: Optional[str] = None,
  13. collect_metrics: Optional[bool] = None,
  14. model: str = "orca-mini-3b.ggmlv3.q4_0.bin",
  15. collection_name: Optional[str] = None,
  16. ):
  17. """
  18. Initializes a configuration class instance for an Open Source App.
  19. :param log_level: Debug level ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'], defaults to "WARNING"
  20. :type log_level: str, optional
  21. :param id: ID of the app. Document metadata will have this id., defaults to None
  22. :type id: Optional[str], optional
  23. :param collect_metrics: Send anonymous telemetry to improve embedchain, defaults to True
  24. :type collect_metrics: Optional[bool], optional
  25. :param model: GPT4ALL uses the model to instantiate the class.
  26. Unlike `App`, it has to be provided before querying, defaults to "orca-mini-3b.ggmlv3.q4_0.bin"
  27. :type model: str, optional
  28. :param collection_name: Default collection name. It's recommended to use app.db.set_collection_name() instead,
  29. defaults to None
  30. :type collection_name: Optional[str], optional
  31. """
  32. self.model = model or "orca-mini-3b.ggmlv3.q4_0.bin"
  33. super().__init__(log_level=log_level, id=id, collect_metrics=collect_metrics, collection_name=collection_name)