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: update Callback to an abstract class (#8868)
zhuhaof97607370a2d
diff --git a/api/core/model_runtime/callbacks/base_callback.py b/api/core/model_runtime/callbacks/base_callback.pyindex 92da53c9a46..6bd9325785a 100644--- a/api/core/model_runtime/callbacks/base_callback.py+++ b/api/core/model_runtime/callbacks/base_callback.py@@ -1,3 +1,4 @@+from abc import ABC, abstractmethodfrom typing import Optionalfrom core.model_runtime.entities.llm_entities import LLMResult, LLMResultChunk@@ -13,7 +14,7 @@ _TEXT_COLOR_MAPPING = {}-class Callback:+class Callback(ABC):"""Base class for callbacks.Only for LLM.@@ -21,6 +22,7 @@ class Callback:raise_error: bool = False+ @abstractmethoddef on_before_invoke(self,llm_instance: AIModel,@@ -48,6 +50,7 @@ class Callback:"""raise NotImplementedError()+ @abstractmethoddef on_new_chunk(self,llm_instance: AIModel,@@ -77,6 +80,7 @@ class Callback:"""raise NotImplementedError()+ @abstractmethoddef on_after_invoke(self,llm_instance: AIModel,@@ -106,6 +110,7 @@ class Callback:"""raise NotImplementedError()+ @abstractmethoddef on_invoke_error(self,llm_instance: AIModel,