CustomAppConfig.py 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. from typing import Optional
  2. from dotenv import load_dotenv
  3. from embedchain.helper_classes.json_serializable import register_deserializable
  4. from .BaseAppConfig import BaseAppConfig
  5. load_dotenv()
  6. @register_deserializable
  7. class CustomAppConfig(BaseAppConfig):
  8. """
  9. Config to initialize an embedchain custom `App` instance, with extra config options.
  10. """
  11. def __init__(
  12. self,
  13. log_level=None,
  14. db=None,
  15. id=None,
  16. collect_metrics: Optional[bool] = None,
  17. collection_name: Optional[str] = None,
  18. ):
  19. """
  20. :param log_level: Optional. (String) Debug level
  21. ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'].
  22. :param db: Optional. (Vector) database to use for embeddings.
  23. :param id: Optional. ID of the app. Document metadata will have this id.
  24. :param provider: Optional. (Providers): LLM Provider to use.
  25. :param open_source_app_config: Optional. Config instance needed for open source apps.
  26. :param collect_metrics: Defaults to True. Send anonymous telemetry to improve embedchain.
  27. :param collection_name: Optional. Default collection name.
  28. It's recommended to use app.set_collection_name() instead.
  29. """
  30. super().__init__(
  31. log_level=log_level, db=db, id=id, collect_metrics=collect_metrics, collection_name=collection_name
  32. )