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, Dict, Optional |
| #2 | |
| #3 | from pydantic import BaseModel, ConfigDict, Field, model_validator |
| #4 | |
| #5 | from databricks.sdk.service.vectorsearch import EndpointType, VectorIndexType, PipelineType |
| #6 | |
| #7 | |
| #8 | class DatabricksConfig(BaseModel): |
| #9 | """Configuration for Databricks Vector Search vector store.""" |
| #10 | |
| #11 | workspace_url: str = Field(..., description="Databricks workspace URL") |
| #12 | access_token: Optional[str] = Field(None, description="Personal access token for authentication") |
| #13 | client_id: Optional[str] = Field(None, description="Databricks Service principal client ID") |
| #14 | client_secret: Optional[str] = Field(None, description="Databricks Service principal client secret") |
| #15 | azure_client_id: Optional[str] = Field(None, description="Azure AD application client ID (for Azure Databricks)") |
| #16 | azure_client_secret: Optional[str] = Field( |
| #17 | None, description="Azure AD application client secret (for Azure Databricks)" |
| #18 | ) |
| #19 | endpoint_name: str = Field(..., description="Vector search endpoint name") |
| #20 | catalog: str = Field(..., description="The Unity Catalog catalog name") |
| #21 | schema: str = Field(..., description="The Unity Catalog schama name") |
| #22 | table_name: str = Field(..., description="Source Delta table name") |
| #23 | collection_name: str = Field("mem0", description="Vector search index name") |
| #24 | index_type: VectorIndexType = Field("DELTA_SYNC", description="Index type: DELTA_SYNC or DIRECT_ACCESS") |
| #25 | embedding_model_endpoint_name: Optional[str] = Field( |
| #26 | None, description="Embedding model endpoint for Databricks-computed embeddings" |
| #27 | ) |
| #28 | embedding_dimension: int = Field(1536, description="Vector embedding dimensions") |
| #29 | endpoint_type: EndpointType = Field("STANDARD", description="Endpoint type: STANDARD or STORAGE_OPTIMIZED") |
| #30 | pipeline_type: PipelineType = Field("TRIGGERED", description="Sync pipeline type: TRIGGERED or CONTINUOUS") |
| #31 | warehouse_name: Optional[str] = Field(None, description="Databricks SQL warehouse Name") |
| #32 | query_type: str = Field("ANN", description="Query type: `ANN` and `HYBRID`") |
| #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 | |
| #46 | @model_validator(mode="after") |
| #47 | def validate_authentication(self): |
| #48 | """Validate that either access_token or service principal credentials are provided.""" |
| #49 | has_token = self.access_token is not None |
| #50 | has_service_principal = (self.client_id is not None and self.client_secret is not None) or ( |
| #51 | self.azure_client_id is not None and self.azure_client_secret is not None |
| #52 | ) |
| #53 | |
| #54 | if not has_token and not has_service_principal: |
| #55 | raise ValueError( |
| #56 | "Either access_token or both client_id/client_secret or azure_client_id/azure_client_secret must be provided" |
| #57 | ) |
| #58 | |
| #59 | return self |
| #60 | |
| #61 | model_config = ConfigDict(arbitrary_types_allowed=True) |
| #62 |