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 Any, ClassVar, Dict, Optional |
| #2 | |
| #3 | from pydantic import BaseModel, ConfigDict, Field, model_validator |
| #4 | |
| #5 | |
| #6 | class QdrantConfig(BaseModel): |
| #7 | from qdrant_client import QdrantClient |
| #8 | |
| #9 | QdrantClient: ClassVar[type] = QdrantClient |
| #10 | |
| #11 | collection_name: str = Field("mem0", description="Name of the collection") |
| #12 | embedding_model_dims: Optional[int] = Field(1536, description="Dimensions of the embedding model") |
| #13 | client: Optional[QdrantClient] = Field(None, description="Existing Qdrant client instance") |
| #14 | host: Optional[str] = Field(None, description="Host address for Qdrant server") |
| #15 | port: Optional[int] = Field(None, description="Port for Qdrant server") |
| #16 | path: Optional[str] = Field("/tmp/qdrant", description="Path for local Qdrant database") |
| #17 | url: Optional[str] = Field(None, description="Full URL for Qdrant server") |
| #18 | api_key: Optional[str] = Field(None, description="API key for Qdrant server") |
| #19 | on_disk: Optional[bool] = Field(False, description="Enables persistent storage") |
| #20 | |
| #21 | @model_validator(mode="before") |
| #22 | @classmethod |
| #23 | def check_host_port_or_path(cls, values: Dict[str, Any]) -> Dict[str, Any]: |
| #24 | host, port, path, url, api_key = ( |
| #25 | values.get("host"), |
| #26 | values.get("port"), |
| #27 | values.get("path"), |
| #28 | values.get("url"), |
| #29 | values.get("api_key"), |
| #30 | ) |
| #31 | if not path and not (host and port) and not (url and api_key): |
| #32 | raise ValueError("Either 'host' and 'port' or 'url' and 'api_key' or 'path' must be provided.") |
| #33 | return values |
| #34 | |
| #35 | @model_validator(mode="before") |
| #36 | @classmethod |
| #37 | def validate_extra_fields(cls, values: Dict[str, Any]) -> Dict[str, Any]: |
| #38 | allowed_fields = set(cls.model_fields.keys()) |
| #39 | input_fields = set(values.keys()) |
| #40 | extra_fields = input_fields - allowed_fields |
| #41 | if extra_fields: |
| #42 | raise ValueError( |
| #43 | f"Extra fields not allowed: {', '.join(extra_fields)}. Please input only the following fields: {', '.join(allowed_fields)}" |
| #44 | ) |
| #45 | return values |
| #46 | |
| #47 | model_config = ConfigDict(arbitrary_types_allowed=True) |
| #48 |