Class ModelInterceptor
java.lang.Object
com.alibaba.cloud.ai.graph.agent.interceptor.ModelInterceptor
- All Implemented Interfaces:
Interceptor
- Direct Known Subclasses:
ContextEditingInterceptor,FilesystemInterceptor,ModelFallbackInterceptor,PatchToolCallsInterceptor,SubAgentInterceptor,TodoListInterceptor,ToolSelectionInterceptor
Model interceptor that can wrap model calls.
Implementations can modify requests, responses, or add behavior like retry, fallback, etc.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionList<org.springframework.ai.tool.ToolCallback>getTools()Get tools provided by this interceptor.abstract ModelResponseinterceptModel(ModelRequest request, ModelCallHandler handler) Wrap a model call with custom logic.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.alibaba.cloud.ai.graph.agent.interceptor.Interceptor
getName
-
Constructor Details
-
ModelInterceptor
public ModelInterceptor()
-
-
Method Details
-
interceptModel
Wrap a model call with custom logic. Implementations can: - Modify the request before calling the handler - Call the handler multiple times (retry logic) - Modify the response after handler returns - Handle exceptions and provide fallbacks- Parameters:
request- The model requesthandler- The next handler in the chain (or base handler)- Returns:
- The model response
-
getTools
Get tools provided by this interceptor. Interceptors can provide built-in tools that will be automatically added to the agent.- Returns:
- List of tools provided by this interceptor, empty list by default
-