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, Optional |
| #3 | |
| #4 | from pydantic import BaseModel, Field, model_validator |
| #5 | |
| #6 | |
| #7 | class IndexMethod(str, Enum): |
| #8 | AUTO = "auto" |
| #9 | HNSW = "hnsw" |
| #10 | IVFFLAT = "ivfflat" |
| #11 | |
| #12 | |
| #13 | class IndexMeasure(str, Enum): |
| #14 | COSINE = "cosine_distance" |
| #15 | L2 = "l2_distance" |
| #16 | L1 = "l1_distance" |
| #17 | MAX_INNER_PRODUCT = "max_inner_product" |
| #18 | |
| #19 | |
| #20 | class SupabaseConfig(BaseModel): |
| #21 | connection_string: str = Field(..., description="PostgreSQL connection string") |
| #22 | collection_name: str = Field("mem0", description="Name for the vector collection") |
| #23 | embedding_model_dims: Optional[int] = Field(1536, description="Dimensions of the embedding model") |
| #24 | index_method: Optional[IndexMethod] = Field(IndexMethod.AUTO, description="Index method to use") |
| #25 | index_measure: Optional[IndexMeasure] = Field(IndexMeasure.COSINE, description="Distance measure to use") |
| #26 | |
| #27 | @model_validator(mode="before") |
| #28 | def check_connection_string(cls, values): |
| #29 | conn_str = values.get("connection_string") |
| #30 | if not conn_str or not conn_str.startswith("postgresql://"): |
| #31 | raise ValueError("A valid PostgreSQL connection string must be provided") |
| #32 | return values |
| #33 | |
| #34 | @model_validator(mode="before") |
| #35 | @classmethod |
| #36 | def validate_extra_fields(cls, values: Dict[str, Any]) -> Dict[str, Any]: |
| #37 | allowed_fields = set(cls.model_fields.keys()) |
| #38 | input_fields = set(values.keys()) |
| #39 | extra_fields = input_fields - allowed_fields |
| #40 | if extra_fields: |
| #41 | raise ValueError( |
| #42 | f"Extra fields not allowed: {', '.join(extra_fields)}. Please input only the following fields: {', '.join(allowed_fields)}" |
| #43 | ) |
| #44 | return values |
| #45 |