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 LLM generator results with TypedDict (#34621)
Statxc0bce6b35b45b
diff --git a/api/core/llm_generator/llm_generator.py b/api/core/llm_generator/llm_generator.pyindex d39630ad951..8071770c0f0 100644--- a/api/core/llm_generator/llm_generator.py+++ b/api/core/llm_generator/llm_generator.py@@ -2,7 +2,7 @@ import jsonimport loggingimport refrom collections.abc import Sequence-from typing import Protocol, cast+from typing import Protocol, TypedDict, castimport json_repairfrom graphon.enums import WorkflowNodeExecutionMetadataKey@@ -49,6 +49,17 @@ class WorkflowServiceInterface(Protocol):pass+class CodeGenerateResultDict(TypedDict):+ code: str+ language: str+ error: str+++class StructuredOutputResultDict(TypedDict):+ output: str+ error: str++class LLMGenerator:@classmethoddef generate_conversation_name(@@ -293,7 +304,7 @@ class LLMGenerator:cls,tenant_id: str,args: RuleCodeGeneratePayload,- ):+ ) -> CodeGenerateResultDict:if args.code_language == "python":prompt_template = PromptTemplateParser(PYTHON_CODE_GENERATOR_PROMPT_TEMPLATE)else:@@ -362,7 +373,9 @@ class LLMGenerator:return answer.strip()@classmethod- def generate_structured_output(cls, tenant_id: str, args: RuleStructuredOutputPayload):+ def generate_structured_output(+ cls, tenant_id: str, args: RuleStructuredOutputPayload+ ) -> StructuredOutputResultDict:model_manager = ModelManager.for_tenant(tenant_id=tenant_id)model_instance = model_manager.get_model_instance(tenant_id=tenant_id,