repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
public Clawd ADK gateway launch mirror
stars
latest
clone command
git clone gitlawb://did:key:z6Mkq5mY...iFZ5/my-project-publ...git clone gitlawb://did:key:z6Mkq5mY.../my-project-publ...2fa351d6docs: add automaton and perps launch sources16d ago| #1 | import logging |
| #2 | from typing import Optional |
| #3 | |
| #4 | from embedchain.config.base_config import BaseConfig |
| #5 | from embedchain.helpers.json_serializable import JSONSerializable |
| #6 | from embedchain.vectordb.base import BaseVectorDB |
| #7 | |
| #8 | logger = logging.getLogger(__name__) |
| #9 | |
| #10 | |
| #11 | class BaseAppConfig(BaseConfig, JSONSerializable): |
| #12 | """ |
| #13 | Parent config to initialize an instance of `App`. |
| #14 | """ |
| #15 | |
| #16 | def __init__( |
| #17 | self, |
| #18 | log_level: str = "WARNING", |
| #19 | db: Optional[BaseVectorDB] = None, |
| #20 | id: Optional[str] = None, |
| #21 | collect_metrics: bool = True, |
| #22 | collection_name: Optional[str] = None, |
| #23 | ): |
| #24 | """ |
| #25 | Initializes a configuration class instance for an App. |
| #26 | Most of the configuration is done in the `App` class itself. |
| #27 | |
| #28 | :param log_level: Debug level ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'], defaults to "WARNING" |
| #29 | :type log_level: str, optional |
| #30 | :param db: A database class. It is recommended to set this directly in the `App` class, not this config, |
| #31 | defaults to None |
| #32 | :type db: Optional[BaseVectorDB], optional |
| #33 | :param id: ID of the app. Document metadata will have this id., defaults to None |
| #34 | :type id: Optional[str], optional |
| #35 | :param collect_metrics: Send anonymous telemetry to improve embedchain, defaults to True |
| #36 | :type collect_metrics: Optional[bool], optional |
| #37 | :param collection_name: Default collection name. It's recommended to use app.db.set_collection_name() instead, |
| #38 | defaults to None |
| #39 | :type collection_name: Optional[str], optional |
| #40 | """ |
| #41 | self.id = id |
| #42 | self.collect_metrics = True if (collect_metrics is True or collect_metrics is None) else False |
| #43 | self.collection_name = collection_name |
| #44 | |
| #45 | if db: |
| #46 | self._db = db |
| #47 | logger.warning( |
| #48 | "DEPRECATION WARNING: Please supply the database as the second parameter during app init. " |
| #49 | "Such as `app(config=config, db=db)`." |
| #50 | ) |
| #51 | |
| #52 | if collection_name: |
| #53 | logger.warning("DEPRECATION WARNING: Please supply the collection name to the database config.") |
| #54 | return |
| #55 | |
| #56 | def _setup_logging(self, log_level): |
| #57 | logger.basicConfig(format="%(asctime)s [%(name)s] [%(levelname)s] %(message)s", level=log_level) |
| #58 | self.logger = logger.getLogger(__name__) |
| #59 |