Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
refactor(api): type hit testing retrieve responses with TypedDict (#34484)
YBoy71d299d0d366
diff --git a/api/services/hit_testing_service.py b/api/services/hit_testing_service.pyindex 82e0b0f8b1f..7900f6da266 100644--- a/api/services/hit_testing_service.py+++ b/api/services/hit_testing_service.py@@ -1,7 +1,7 @@import jsonimport loggingimport time-from typing import Any+from typing import Any, TypedDictfrom graphon.model_runtime.entities import LLMMode@@ -18,6 +18,16 @@ from models.enums import CreatorUserRole, DatasetQuerySourcelogger = logging.getLogger(__name__)++class QueryDict(TypedDict):+ content: str+++class RetrieveResponseDict(TypedDict):+ query: QueryDict+ records: list[dict[str, Any]]++default_retrieval_model = {"search_method": RetrievalMethod.SEMANTIC_SEARCH,"reranking_enable": False,@@ -150,7 +160,7 @@ class HitTestingService:return dict(cls.compact_external_retrieve_response(dataset, query, all_documents))@classmethod- def compact_retrieve_response(cls, query: str, documents: list[Document]) -> dict[Any, Any]:+ def compact_retrieve_response(cls, query: str, documents: list[Document]) -> RetrieveResponseDict:records = RetrievalService.format_retrieval_documents(documents)return {@@ -161,7 +171,7 @@ class HitTestingService:}@classmethod- def compact_external_retrieve_response(cls, dataset: Dataset, query: str, documents: list) -> dict[Any, Any]:+ def compact_external_retrieve_response(cls, dataset: Dataset, query: str, documents: list) -> RetrieveResponseDict:records = []if dataset.provider == "external":for document in documents: