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 sends the summarization prompt to 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.SummarizerwithStreamingChatModelProvider(AgenticScope agenticScope, Function<AgenticScope, StreamingChatModel> streamingChatModelProvider, String... agentNames) Creates a summarizer whoseStreamingChatModelis 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 same model.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 sends the summarization prompt to 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 same model. -
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. -
withStreamingChatModelProvider
public static Context.Summarizer withStreamingChatModelProvider(AgenticScope agenticScope, Function<AgenticScope, StreamingChatModel> streamingChatModelProvider, String... agentNames) Creates a summarizer whoseStreamingChatModelis resolved through the given provider at summarization time, so it follows model changes across scopes or invocations.
-