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 PineconeDBConfig(BaseVectorDbConfig): |
| #10 | def __init__( |
| #11 | self, |
| #12 | index_name: Optional[str] = None, |
| #13 | api_key: Optional[str] = None, |
| #14 | vector_dimension: int = 1536, |
| #15 | metric: Optional[str] = "cosine", |
| #16 | pod_config: Optional[dict[str, any]] = None, |
| #17 | serverless_config: Optional[dict[str, any]] = None, |
| #18 | hybrid_search: bool = False, |
| #19 | bm25_encoder: any = None, |
| #20 | batch_size: Optional[int] = 100, |
| #21 | **extra_params: dict[str, any], |
| #22 | ): |
| #23 | self.metric = metric |
| #24 | self.api_key = api_key |
| #25 | self.index_name = index_name |
| #26 | self.vector_dimension = vector_dimension |
| #27 | self.extra_params = extra_params |
| #28 | self.hybrid_search = hybrid_search |
| #29 | self.bm25_encoder = bm25_encoder |
| #30 | self.batch_size = batch_size |
| #31 | if pod_config is None and serverless_config is None: |
| #32 | # If no config is provided, use the default pod spec config |
| #33 | pod_environment = os.environ.get("PINECONE_ENV", "gcp-starter") |
| #34 | self.pod_config = {"environment": pod_environment, "metadata_config": {"indexed": ["*"]}} |
| #35 | else: |
| #36 | self.pod_config = pod_config |
| #37 | self.serverless_config = serverless_config |
| #38 | |
| #39 | if self.pod_config and self.serverless_config: |
| #40 | raise ValueError("Only one of pod_config or serverless_config can be provided.") |
| #41 | |
| #42 | if self.hybrid_search and self.metric != "dotproduct": |
| #43 | raise ValueError( |
| #44 | "Hybrid search is only supported with dotproduct metric in Pinecone. See full docs here: https://docs.pinecone.io/docs/hybrid-search#limitations" |
| #45 | ) # noqa:E501 |
| #46 | |
| #47 | super().__init__(collection_name=self.index_name, dir=None) |
| #48 |