Class Context.Summarizer
java.lang.Object
dev.langchain4j.agentic.internal.Context.AgenticScopeContextGenerator
dev.langchain4j.agentic.internal.Context.Summarizer
- All Implemented Interfaces:
UserMessageTransformer, BiFunction<ChatRequest, Object, ChatRequest>
- Enclosing class:
Context
-
Constructor Summary
ConstructorsConstructorDescriptionSummarizer(AgenticScope agenticScope, ChatModel chatModel, String... agentNames) Creates a summarizer that eagerly builds its own summarizer AI service from the givenChatModel. -
Method Summary
Modifier and TypeMethodDescriptionstatic Context.SummarizerwithChatModelProvider(AgenticScope agenticScope, Function<AgenticScope, ChatModel> chatModelProvider, String... agentNames) Creates a summarizer whoseChatModelis resolved through the given provider at summarization time, so it follows model changes across scopes or invocations.static Context.SummarizerwithSummarizer(AgenticScope agenticScope, Context.ContextSummarizer summarizer, String... agentNames) Creates a summarizer backed by a pre-builtContext.ContextSummarizer, typically one shared by the caller across agents or invocations using the sameChatModel.Methods inherited from class Context.AgenticScopeContextGenerator
transformUserMessageMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface BiFunction
andThenMethods inherited from interface UserMessageTransformer
apply
-
Constructor Details
-
Summarizer
Creates a summarizer that eagerly builds its own summarizer AI service from the givenChatModel.- Throws:
IllegalConfigurationException- ifchatModelisnull
-
-
Method Details
-
withSummarizer
public static Context.Summarizer withSummarizer(AgenticScope agenticScope, Context.ContextSummarizer summarizer, String... agentNames) Creates a summarizer backed by a pre-builtContext.ContextSummarizer, typically one shared by the caller across agents or invocations using the sameChatModel. -
withChatModelProvider
public static Context.Summarizer withChatModelProvider(AgenticScope agenticScope, Function<AgenticScope, ChatModel> chatModelProvider, String... agentNames) Creates a summarizer whoseChatModelis resolved through the given provider at summarization time, so it follows model changes across scopes or invocations. The service built for the last resolved model is cached per summarizer instance.
-