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 enum import Enum |
| #2 | from typing import Any, Dict |
| #3 | |
| #4 | from pydantic import BaseModel, ConfigDict, Field, model_validator |
| #5 | |
| #6 | |
| #7 | class MetricType(str, Enum): |
| #8 | """ |
| #9 | Metric Constant for milvus/ zilliz server. |
| #10 | """ |
| #11 | |
| #12 | def __str__(self) -> str: |
| #13 | return str(self.value) |
| #14 | |
| #15 | L2 = "L2" |
| #16 | IP = "IP" |
| #17 | COSINE = "COSINE" |
| #18 | HAMMING = "HAMMING" |
| #19 | JACCARD = "JACCARD" |
| #20 | |
| #21 | |
| #22 | class MilvusDBConfig(BaseModel): |
| #23 | url: str = Field("http://localhost:19530", description="Full URL for Milvus/Zilliz server") |
| #24 | token: str = Field(None, description="Token for Zilliz server / local setup defaults to None.") |
| #25 | collection_name: str = Field("mem0", description="Name of the collection") |
| #26 | embedding_model_dims: int = Field(1536, description="Dimensions of the embedding model") |
| #27 | metric_type: str = Field("L2", description="Metric type for similarity search") |
| #28 | db_name: str = Field("", description="Name of the database") |
| #29 | |
| #30 | @model_validator(mode="before") |
| #31 | @classmethod |
| #32 | def validate_extra_fields(cls, values: Dict[str, Any]) -> Dict[str, Any]: |
| #33 | allowed_fields = set(cls.model_fields.keys()) |
| #34 | input_fields = set(values.keys()) |
| #35 | extra_fields = input_fields - allowed_fields |
| #36 | if extra_fields: |
| #37 | raise ValueError( |
| #38 | f"Extra fields not allowed: {', '.join(extra_fields)}. Please input only the following fields: {', '.join(allowed_fields)}" |
| #39 | ) |
| #40 | return values |
| #41 | |
| #42 | model_config = ConfigDict(arbitrary_types_allowed=True) |
| #43 |