From 4d399baf6adeac6ef9457900cf96697345ca2139 Mon Sep 17 00:00:00 2001 From: lizb Date: Tue, 29 Apr 2025 09:13:26 +0800 Subject: [PATCH] convert LLMNodeError to ValueError --- api/core/llm_generator/llm_generator.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/api/core/llm_generator/llm_generator.py b/api/core/llm_generator/llm_generator.py index 6c749a4719..e5dbc30689 100644 --- a/api/core/llm_generator/llm_generator.py +++ b/api/core/llm_generator/llm_generator.py @@ -24,7 +24,6 @@ from core.ops.entities.trace_entity import TraceTaskName from core.ops.ops_trace_manager import TraceQueueManager, TraceTask from core.ops.utils import measure_time from core.prompt.utils.prompt_template_parser import PromptTemplateParser -from core.workflow.nodes.llm.exc import LLMNodeError class LLMGenerator: @@ -372,7 +371,7 @@ class LLMGenerator: raw_content = response.message.content if not isinstance(raw_content, str): - raise LLMNodeError(f"LLM response content must be a string, got: {type(raw_content)}") + raise ValueError(f"LLM response content must be a string, got: {type(raw_content)}") try: parsed_content = json.loads(raw_content) @@ -380,7 +379,7 @@ class LLMGenerator: parsed_content = json_repair.loads(raw_content) if not isinstance(parsed_content, dict | list): - raise LLMNodeError(f"Failed to parse structured output from llm: {raw_content}") + raise ValueError(f"Failed to parse structured output from llm: {raw_content}") generated_json_schema = json.dumps(parsed_content, indent=2, ensure_ascii=False) return {"output": generated_json_schema, "error": ""}