38 lines
936 B
Python
38 lines
936 B
Python
# ruff: noqa: INP001
|
|
"""Domain models for knowledge search MCP server."""
|
|
|
|
from dataclasses import dataclass
|
|
from enum import Enum
|
|
from typing import TYPE_CHECKING, TypedDict
|
|
|
|
if TYPE_CHECKING:
|
|
from google import genai
|
|
|
|
from .clients.vector_search import GoogleCloudVectorSearch
|
|
from .config import Settings
|
|
|
|
|
|
class SourceNamespace(str, Enum):
|
|
"""Allowed values for the 'source' namespace filter."""
|
|
|
|
EDUCACION_FINANCIERA = "Educacion Financiera"
|
|
PRODUCTOS_Y_SERVICIOS = "Productos y Servicios"
|
|
FUNCIONALIDADES_APP_MOVIL = "Funcionalidades de la App Movil"
|
|
|
|
|
|
class SearchResult(TypedDict):
|
|
"""Structured response item returned by the vector search API."""
|
|
|
|
id: str
|
|
distance: float
|
|
content: str
|
|
|
|
|
|
@dataclass
|
|
class AppContext:
|
|
"""Shared resources initialised once at server startup."""
|
|
|
|
vector_search: "GoogleCloudVectorSearch"
|
|
genai_client: "genai.Client"
|
|
settings: "Settings"
|