Class WebFetchTool
java.lang.Object
com.alibaba.cloud.ai.graph.agent.tools.WebFetchTool
- All Implemented Interfaces:
BiFunction<WebFetchTool.Request,org.springframework.ai.chat.model.ToolContext, String>
public class WebFetchTool
extends Object
implements BiFunction<WebFetchTool.Request,org.springframework.ai.chat.model.ToolContext,String>
Web fetch tool that retrieves content from URLs and processes it using an AI model for
summarization.
Features:
- Fetches HTML content and converts it to Markdown
- Includes a 15-minute cache for faster repeated access
- Automatic content truncation with configurable limits
- Retry on network errors and 5xx server errors
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic final recordstatic classCustom exception for web fetch errors. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionapply(WebFetchTool.Request request, org.springframework.ai.chat.model.ToolContext toolContext) static WebFetchTool.Builderbuilder(org.springframework.ai.chat.client.ChatClient chatClient) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.function.BiFunction
andThen
-
Field Details
-
DEFAULT_TOOL_DESCRIPTION
- See Also:
-
-
Method Details
-
apply
public String apply(WebFetchTool.Request request, org.springframework.ai.chat.model.ToolContext toolContext) - Specified by:
applyin interfaceBiFunction<WebFetchTool.Request,org.springframework.ai.chat.model.ToolContext, String>
-
builder
public static WebFetchTool.Builder builder(org.springframework.ai.chat.client.ChatClient chatClient)
-