Class Context
java.lang.Object
dev.langchain4j.agentic.internal.Context
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic interfacestatic class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Context.ContextSummarizercreateStreamingSummarizer(StreamingChatModel streamingChatModel) Creates a new stateless summarizer that sends the summarization prompt to the givenStreamingChatModeland returns the text of its answer.static Context.ContextSummarizercreateSummarizer(ChatModel chatModel) Creates a new stateless summarizer that sends the summarization prompt to the givenChatModeland returns the text of its answer.static Context.ContextSummarizercreateSummarizer(ChatModel chatModel, Consumer<ChatResponse> responseConsumer) Creates a new stateless summarizer that sends the summarization prompt to the givenChatModel, passes the response of the model to the given consumer, for instance to report its token usage, and returns the text of its answer.
-
Constructor Details
-
Context
public Context()
-
-
Method Details
-
createSummarizer
Creates a new stateless summarizer that sends the summarization prompt to the givenChatModeland returns the text of its answer.- Throws:
IllegalConfigurationException- ifchatModelisnull
-
createSummarizer
public static Context.ContextSummarizer createSummarizer(ChatModel chatModel, Consumer<ChatResponse> responseConsumer) Creates a new stateless summarizer that sends the summarization prompt to the givenChatModel, passes the response of the model to the given consumer, for instance to report its token usage, and returns the text of its answer.- Throws:
IllegalConfigurationException- ifchatModelisnull
-
createStreamingSummarizer
public static Context.ContextSummarizer createStreamingSummarizer(StreamingChatModel streamingChatModel) Creates a new stateless summarizer that sends the summarization prompt to the givenStreamingChatModeland returns the text of its answer. The returned summarizer blocks until the streamed answer is complete.- Throws:
IllegalConfigurationException- ifstreamingChatModelisnull
-