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 | from typing import Dict, Optional |
| #2 | |
| #3 | from pydantic import BaseModel, Field, model_validator |
| #4 | |
| #5 | |
| #6 | class VectorStoreConfig(BaseModel): |
| #7 | provider: str = Field( |
| #8 | description="Provider of the vector store (e.g., 'qdrant', 'chroma', 'upstash_vector')", |
| #9 | default="qdrant", |
| #10 | ) |
| #11 | config: Optional[Dict] = Field(description="Configuration for the specific vector store", default=None) |
| #12 | |
| #13 | _provider_configs: Dict[str, str] = { |
| #14 | "qdrant": "QdrantConfig", |
| #15 | "chroma": "ChromaDbConfig", |
| #16 | "pgvector": "PGVectorConfig", |
| #17 | "pinecone": "PineconeConfig", |
| #18 | "mongodb": "MongoDBConfig", |
| #19 | "milvus": "MilvusDBConfig", |
| #20 | "baidu": "BaiduDBConfig", |
| #21 | "cassandra": "CassandraConfig", |
| #22 | "neptune": "NeptuneAnalyticsConfig", |
| #23 | "upstash_vector": "UpstashVectorConfig", |
| #24 | "azure_ai_search": "AzureAISearchConfig", |
| #25 | "azure_mysql": "AzureMySQLConfig", |
| #26 | "redis": "RedisDBConfig", |
| #27 | "valkey": "ValkeyConfig", |
| #28 | "databricks": "DatabricksConfig", |
| #29 | "elasticsearch": "ElasticsearchConfig", |
| #30 | "vertex_ai_vector_search": "GoogleMatchingEngineConfig", |
| #31 | "opensearch": "OpenSearchConfig", |
| #32 | "supabase": "SupabaseConfig", |
| #33 | "weaviate": "WeaviateConfig", |
| #34 | "faiss": "FAISSConfig", |
| #35 | "langchain": "LangchainConfig", |
| #36 | "s3_vectors": "S3VectorsConfig", |
| #37 | } |
| #38 | |
| #39 | @model_validator(mode="after") |
| #40 | def validate_and_create_config(self) -> "VectorStoreConfig": |
| #41 | provider = self.provider |
| #42 | config = self.config |
| #43 | |
| #44 | if provider not in self._provider_configs: |
| #45 | raise ValueError(f"Unsupported vector store provider: {provider}") |
| #46 | |
| #47 | module = __import__( |
| #48 | f"mem0.configs.vector_stores.{provider}", |
| #49 | fromlist=[self._provider_configs[provider]], |
| #50 | ) |
| #51 | config_class = getattr(module, self._provider_configs[provider]) |
| #52 | |
| #53 | if config is None: |
| #54 | config = {} |
| #55 | |
| #56 | if not isinstance(config, dict): |
| #57 | if not isinstance(config, config_class): |
| #58 | raise ValueError(f"Invalid config type for provider {provider}") |
| #59 | return self |
| #60 | |
| #61 | # also check if path in allowed kays for pydantic model, and whether config extra fields are allowed |
| #62 | if "path" not in config and "path" in config_class.__annotations__: |
| #63 | config["path"] = f"/tmp/{provider}" |
| #64 | |
| #65 | self.config = config_class(**config) |
| #66 | return self |
| #67 |