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 os |
| #2 | from typing import Optional |
| #3 | |
| #4 | from embedchain.config.vector_db.base import BaseVectorDbConfig |
| #5 | from embedchain.helpers.json_serializable import register_deserializable |
| #6 | |
| #7 | |
| #8 | @register_deserializable |
| #9 | class ZillizDBConfig(BaseVectorDbConfig): |
| #10 | def __init__( |
| #11 | self, |
| #12 | collection_name: Optional[str] = None, |
| #13 | dir: Optional[str] = None, |
| #14 | uri: Optional[str] = None, |
| #15 | token: Optional[str] = None, |
| #16 | vector_dim: Optional[str] = None, |
| #17 | metric_type: Optional[str] = None, |
| #18 | ): |
| #19 | """ |
| #20 | Initializes a configuration class instance for the vector database. |
| #21 | |
| #22 | :param collection_name: Default name for the collection, defaults to None |
| #23 | :type collection_name: Optional[str], optional |
| #24 | :param dir: Path to the database directory, where the database is stored, defaults to "db" |
| #25 | :type dir: str, optional |
| #26 | :param uri: Cluster endpoint obtained from the Zilliz Console, defaults to None |
| #27 | :type uri: Optional[str], optional |
| #28 | :param token: API Key, if a Serverless Cluster, username:password, if a Dedicated Cluster, defaults to None |
| #29 | :type token: Optional[str], optional |
| #30 | """ |
| #31 | self.uri = uri or os.environ.get("ZILLIZ_CLOUD_URI") |
| #32 | if not self.uri: |
| #33 | raise AttributeError( |
| #34 | "Zilliz needs a URI attribute, " |
| #35 | "this can either be passed to `ZILLIZ_CLOUD_URI` or as `ZILLIZ_CLOUD_URI` in `.env`" |
| #36 | ) |
| #37 | |
| #38 | self.token = token or os.environ.get("ZILLIZ_CLOUD_TOKEN") |
| #39 | if not self.token: |
| #40 | raise AttributeError( |
| #41 | "Zilliz needs a token attribute, " |
| #42 | "this can either be passed to `ZILLIZ_CLOUD_TOKEN` or as `ZILLIZ_CLOUD_TOKEN` in `.env`," |
| #43 | "if having a username and password, pass it in the form 'username:password' to `ZILLIZ_CLOUD_TOKEN`" |
| #44 | ) |
| #45 | |
| #46 | self.metric_type = metric_type if metric_type else "L2" |
| #47 | |
| #48 | self.vector_dim = vector_dim |
| #49 | super().__init__(collection_name=collection_name, dir=dir) |
| #50 |