Uses of Interface
dev.langchain4j.data.message.ChatMessage
Package
Description
-
Uses of ChatMessage in dev.langchain4j.data.message
Modifier and TypeClassDescriptionclass
Represents a response message from an AI (language model).class
Represents a system message, typically defined by a developer.class
Represents the result of a tool execution in response to aToolExecutionRequest
.class
Represents a message from a user, typically an end user of the application.Modifier and TypeMethodDescriptionstatic ChatMessage
ChatMessageDeserializer.messageFromJson
(String json) Deserializes a JSON string into aChatMessage
.ChatMessageJsonCodec.messageFromJson
(String json) Deserializes a JSON string to aChatMessage
object.GsonChatMessageJsonCodec.messageFromJson
(String json) Modifier and TypeMethodDescriptionClass
<? extends ChatMessage> ChatMessageType.messageClass()
Returns the class of the message type.static List
<ChatMessage> ChatMessageDeserializer.messagesFromJson
(String json) Deserializes a JSON string into a list ofChatMessage
.ChatMessageJsonCodec.messagesFromJson
(String json) Deserializes a JSON string to a list ofChatMessage
objects.GsonChatMessageJsonCodec.messagesFromJson
(String json) Modifier and TypeMethodDescriptionChatMessageJsonCodec.messageToJson
(ChatMessage message) Serializes aChatMessage
object to a JSON string.static String
ChatMessageSerializer.messageToJson
(ChatMessage message) Serializes a chat message into a JSON string.GsonChatMessageJsonCodec.messageToJson
(ChatMessage message) Modifier and TypeMethodDescriptionChatMessageJsonCodec.messagesToJson
(List<ChatMessage> messages) Serializes a list ofChatMessage
objects to a JSON string.static String
ChatMessageSerializer.messagesToJson
(List<ChatMessage> messages) Serializes a list of chat messages into a JSON string.GsonChatMessageJsonCodec.messagesToJson
(List<ChatMessage> messages) -
Uses of ChatMessage in dev.langchain4j.memory
Modifier and TypeMethodDescriptionvoid
ChatMemory.add
(ChatMessage message) Adds a message to the chat memory. -
Uses of ChatMessage in dev.langchain4j.memory.chat
Modifier and TypeMethodDescriptionMessageWindowChatMemory.messages()
TokenWindowChatMemory.messages()
Modifier and TypeMethodDescriptionvoid
MessageWindowChatMemory.add
(ChatMessage message) void
TokenWindowChatMemory.add
(ChatMessage message) -
Uses of ChatMessage in dev.langchain4j.model
Modifier and TypeMethodDescriptionint
Tokenizer.estimateTokenCountInMessage
(ChatMessage message) Estimates the count of tokens in the given message.Modifier and TypeMethodDescriptionint
Tokenizer.estimateTokenCountInMessages
(Iterable<ChatMessage> messages) Estimates the count of tokens in the given messages. -
Uses of ChatMessage in dev.langchain4j.model.anthropic
Modifier and TypeMethodDescriptionAnthropicChatModel.generate
(List<ChatMessage> messages) AnthropicChatModel.generate
(List<ChatMessage> messages, List<ToolSpecification> toolSpecifications) void
AnthropicStreamingChatModel.generate
(List<ChatMessage> messages, ToolSpecification toolSpecification, StreamingResponseHandler<AiMessage> handler) void
AnthropicStreamingChatModel.generate
(List<ChatMessage> messages, StreamingResponseHandler<AiMessage> handler) void
AnthropicStreamingChatModel.generate
(List<ChatMessage> messages, List<ToolSpecification> toolSpecifications, StreamingResponseHandler<AiMessage> handler) -
Uses of ChatMessage in dev.langchain4j.model.anthropic.internal.mapper
Modifier and TypeMethodDescriptionstatic List
<AnthropicMessage> AnthropicMapper.toAnthropicMessages
(List<ChatMessage> messages) static List
<AnthropicTextContent> AnthropicMapper.toAnthropicSystemPrompt
(List<ChatMessage> messages, AnthropicCacheType cacheType) -
Uses of ChatMessage in dev.langchain4j.model.anthropic.internal.sanitizer
Modifier and TypeMethodDescriptionstatic List
<ChatMessage> MessageSanitizer.sanitizeMessages
(List<ChatMessage> messages) Modifier and TypeMethodDescriptionstatic List
<ChatMessage> MessageSanitizer.sanitizeMessages
(List<ChatMessage> messages) -
Uses of ChatMessage in dev.langchain4j.model.azure
Modifier and TypeMethodDescriptionint
AzureOpenAiTokenizer.estimateTokenCountInMessage
(ChatMessage message) Modifier and TypeMethodDescriptionint
AzureOpenAiChatModel.estimateTokenCount
(List<ChatMessage> messages) int
AzureOpenAiStreamingChatModel.estimateTokenCount
(List<ChatMessage> messages) int
AzureOpenAiTokenizer.estimateTokenCountInMessages
(Iterable<ChatMessage> messages) AzureOpenAiChatModel.generate
(List<ChatMessage> messages) AzureOpenAiChatModel.generate
(List<ChatMessage> messages, ToolSpecification toolSpecification) AzureOpenAiChatModel.generate
(List<ChatMessage> messages, List<ToolSpecification> toolSpecifications) void
AzureOpenAiStreamingChatModel.generate
(List<ChatMessage> messages, ToolSpecification toolSpecification, StreamingResponseHandler<AiMessage> handler) void
AzureOpenAiStreamingChatModel.generate
(List<ChatMessage> messages, StreamingResponseHandler<AiMessage> handler) void
AzureOpenAiStreamingChatModel.generate
(List<ChatMessage> messages, List<ToolSpecification> toolSpecifications, StreamingResponseHandler<AiMessage> handler) -
Uses of ChatMessage in dev.langchain4j.model.bedrock
Modifier and TypeMethodDescriptionBedrockAnthropicMessageChatModel.generate
(List<ChatMessage> messages) BedrockAnthropicMessageChatModel.generate
(List<ChatMessage> messages, ToolSpecification toolSpecification) BedrockAnthropicMessageChatModel.generate
(List<ChatMessage> messages, List<ToolSpecification> toolSpecifications) BedrockMistralAiChatModel.generate
(List<ChatMessage> messages) -
Uses of ChatMessage in dev.langchain4j.model.bedrock.internal
Modifier and TypeMethodDescriptionprotected String
AbstractSharedBedrockChatModel.chatMessageToString
(ChatMessage message) Convert chat message to stringModifier and TypeMethodDescriptionprotected String
AbstractSharedBedrockChatModel.convertMessagesToAwsBody
(List<ChatMessage> messages) protected ChatModelRequest
AbstractSharedBedrockChatModel.createModelListenerRequest
(software.amazon.awssdk.services.bedrockruntime.model.InvokeModelRequest invokeModelRequest, List<ChatMessage> messages, List<ToolSpecification> toolSpecifications) protected ChatModelRequest
AbstractSharedBedrockChatModel.createModelListenerRequest
(software.amazon.awssdk.services.bedrockruntime.model.InvokeModelWithResponseStreamRequest invokeModelRequest, List<ChatMessage> messages, List<ToolSpecification> toolSpecifications) AbstractBedrockChatModel.generate
(List<ChatMessage> messages) void
AbstractBedrockStreamingChatModel.generate
(List<ChatMessage> messages, StreamingResponseHandler<AiMessage> handler) -
Uses of ChatMessage in dev.langchain4j.model.bedrock.internal.sanitizer
Modifier and TypeMethodDescriptionstatic List
<ChatMessage> BedrockAnthropicMessageSanitizer.sanitizeMessages
(List<ChatMessage> messages) Modifier and TypeMethodDescriptionstatic List
<ChatMessage> BedrockAnthropicMessageSanitizer.sanitizeMessages
(List<ChatMessage> messages) -
Uses of ChatMessage in dev.langchain4j.model.chat
Modifier and TypeMethodDescriptionChatLanguageModel.generate
(ChatMessage... messages) Generates a response from the model based on a sequence of messages.DisabledChatLanguageModel.generate
(ChatMessage... messages) Modifier and TypeMethodDescriptionint
TokenCountEstimator.estimateTokenCount
(List<ChatMessage> messages) Estimates the count of tokens in the specified list of messages.ChatLanguageModel.generate
(List<ChatMessage> messages) Generates a response from the model based on a sequence of messages.ChatLanguageModel.generate
(List<ChatMessage> messages, ToolSpecification toolSpecification) Generates a response from the model based on a list of messages and a single tool specification.ChatLanguageModel.generate
(List<ChatMessage> messages, List<ToolSpecification> toolSpecifications) Generates a response from the model based on a list of messages and a list of tool specifications.DisabledChatLanguageModel.generate
(List<ChatMessage> messages) DisabledChatLanguageModel.generate
(List<ChatMessage> messages, ToolSpecification toolSpecification) DisabledChatLanguageModel.generate
(List<ChatMessage> messages, List<ToolSpecification> toolSpecifications) void
DisabledStreamingChatLanguageModel.generate
(List<ChatMessage> messages, ToolSpecification toolSpecification, StreamingResponseHandler<AiMessage> handler) void
DisabledStreamingChatLanguageModel.generate
(List<ChatMessage> messages, StreamingResponseHandler<AiMessage> handler) void
DisabledStreamingChatLanguageModel.generate
(List<ChatMessage> messages, List<ToolSpecification> toolSpecifications, StreamingResponseHandler<AiMessage> handler) default void
StreamingChatLanguageModel.generate
(List<ChatMessage> messages, ToolSpecification toolSpecification, StreamingResponseHandler<AiMessage> handler) Generates a response from the model based on a list of messages and a single tool specification.void
StreamingChatLanguageModel.generate
(List<ChatMessage> messages, StreamingResponseHandler<AiMessage> handler) Generates a response from the model based on a sequence of messages.default void
StreamingChatLanguageModel.generate
(List<ChatMessage> messages, List<ToolSpecification> toolSpecifications, StreamingResponseHandler<AiMessage> handler) Generates a response from the model based on a list of messages and a list of tool specifications. -
Uses of ChatMessage in dev.langchain4j.model.chat.listener
Modifier and TypeMethodDescriptionChatModelRequest.ChatModelRequestBuilder.messages
(List<ChatMessage> messages) ModifierConstructorDescriptionChatModelRequest
(String model, Double temperature, Double topP, Integer maxTokens, List<ChatMessage> messages, List<ToolSpecification> toolSpecifications) -
Uses of ChatMessage in dev.langchain4j.model.chat.request
-
Uses of ChatMessage in dev.langchain4j.model.github
Modifier and TypeMethodDescriptionGitHubModelsChatModel.generate
(List<ChatMessage> messages) GitHubModelsChatModel.generate
(List<ChatMessage> messages, ToolSpecification toolSpecification) GitHubModelsChatModel.generate
(List<ChatMessage> messages, List<ToolSpecification> toolSpecifications) void
GitHubModelsStreamingChatModel.generate
(List<ChatMessage> messages, ToolSpecification toolSpecification, StreamingResponseHandler<AiMessage> handler) void
GitHubModelsStreamingChatModel.generate
(List<ChatMessage> messages, StreamingResponseHandler<AiMessage> handler) void
GitHubModelsStreamingChatModel.generate
(List<ChatMessage> messages, List<ToolSpecification> toolSpecifications, StreamingResponseHandler<AiMessage> handler) -
Uses of ChatMessage in dev.langchain4j.model.googleai
Modifier and TypeMethodDescriptionint
GoogleAiGeminiTokenizer.estimateTokenCountInMessage
(ChatMessage message) Modifier and TypeMethodDescriptionint
GoogleAiGeminiChatModel.estimateTokenCount
(List<ChatMessage> messages) int
GoogleAiGeminiTokenizer.estimateTokenCountInMessages
(Iterable<ChatMessage> messages) GoogleAiGeminiChatModel.generate
(List<ChatMessage> messages) GoogleAiGeminiChatModel.generate
(List<ChatMessage> messages, ToolSpecification toolSpecification) GoogleAiGeminiChatModel.generate
(List<ChatMessage> messages, List<ToolSpecification> toolSpecifications) void
GoogleAiGeminiStreamingChatModel.generate
(List<ChatMessage> messages, ToolSpecification toolSpecification, StreamingResponseHandler<AiMessage> handler) void
GoogleAiGeminiStreamingChatModel.generate
(List<ChatMessage> messages, StreamingResponseHandler<AiMessage> handler) void
GoogleAiGeminiStreamingChatModel.generate
(List<ChatMessage> messages, List<ToolSpecification> toolSpecifications, StreamingResponseHandler<AiMessage> handler) -
Uses of ChatMessage in dev.langchain4j.model.huggingface
-
Uses of ChatMessage in dev.langchain4j.model.jlama
Modifier and TypeMethodDescriptionJlamaChatModel.generate
(List<ChatMessage> messages) JlamaChatModel.generate
(List<ChatMessage> messages, List<ToolSpecification> toolSpecifications) void
JlamaStreamingChatModel.generate
(List<ChatMessage> messages, StreamingResponseHandler<AiMessage> handler) void
JlamaStreamingChatModel.generate
(List<ChatMessage> messages, List<ToolSpecification> toolSpecifications, StreamingResponseHandler<AiMessage> handler) -
Uses of ChatMessage in dev.langchain4j.model.localai
Modifier and TypeMethodDescriptionLocalAiChatModel.generate
(List<ChatMessage> messages) LocalAiChatModel.generate
(List<ChatMessage> messages, ToolSpecification toolSpecification) LocalAiChatModel.generate
(List<ChatMessage> messages, List<ToolSpecification> toolSpecifications) void
LocalAiStreamingChatModel.generate
(List<ChatMessage> messages, ToolSpecification toolSpecification, StreamingResponseHandler<AiMessage> handler) void
LocalAiStreamingChatModel.generate
(List<ChatMessage> messages, StreamingResponseHandler<AiMessage> handler) void
LocalAiStreamingChatModel.generate
(List<ChatMessage> messages, List<ToolSpecification> toolSpecifications, StreamingResponseHandler<AiMessage> handler) -
Uses of ChatMessage in dev.langchain4j.model.mistralai
Modifier and TypeMethodDescriptionMistralAiChatModel.generate
(List<ChatMessage> messages) Generates chat response based on the given list of messages.MistralAiChatModel.generate
(List<ChatMessage> messages, ToolSpecification toolSpecification) Generates an AI message response based on the given list of chat messages and a tool specification.MistralAiChatModel.generate
(List<ChatMessage> messages, List<ToolSpecification> toolSpecifications) Generates an AI message response based on the given list of chat messages and tool specifications.void
MistralAiStreamingChatModel.generate
(List<ChatMessage> messages, ToolSpecification toolSpecification, StreamingResponseHandler<AiMessage> handler) Generates streamed token response based on the given list of messages and tool specification.void
MistralAiStreamingChatModel.generate
(List<ChatMessage> messages, StreamingResponseHandler<AiMessage> handler) Generates streamed token response based on the given list of messages.void
MistralAiStreamingChatModel.generate
(List<ChatMessage> messages, List<ToolSpecification> toolSpecifications, StreamingResponseHandler<AiMessage> handler) Generates streamed token response based on the given list of messages and tool specifications.MistralAiModerationModel.moderate
(List<ChatMessage> messages) -
Uses of ChatMessage in dev.langchain4j.model.mistralai.internal.mapper
Modifier and TypeMethodDescriptionstatic List
<MistralAiChatMessage> MistralAiMapper.toMistralAiMessages
(List<ChatMessage> messages) -
Uses of ChatMessage in dev.langchain4j.model.moderation
Modifier and TypeMethodDescriptionDisabledModerationModel.moderate
(ChatMessage message) default Response
<Moderation> ModerationModel.moderate
(ChatMessage message) Moderates the given chat message.Modifier and TypeMethodDescriptionDisabledModerationModel.moderate
(List<ChatMessage> messages) ModerationModel.moderate
(List<ChatMessage> messages) Moderates the given list of chat messages. -
Uses of ChatMessage in dev.langchain4j.model.ollama
Modifier and TypeMethodDescriptionOllamaChatModel.generate
(List<ChatMessage> messages) OllamaChatModel.generate
(List<ChatMessage> messages, List<ToolSpecification> toolSpecifications) void
OllamaStreamingChatModel.generate
(List<ChatMessage> messages, StreamingResponseHandler<AiMessage> handler) void
OllamaStreamingChatModel.generate
(List<ChatMessage> messages, List<ToolSpecification> toolSpecifications, StreamingResponseHandler<AiMessage> handler) -
Uses of ChatMessage in dev.langchain4j.model.openai
Modifier and TypeMethodDescriptionint
OpenAiTokenizer.estimateTokenCountInMessage
(ChatMessage message) static dev.ai4j.openai4j.chat.Message
InternalOpenAiHelper.toOpenAiMessage
(ChatMessage message) Modifier and TypeMethodDescriptionint
OpenAiChatModel.estimateTokenCount
(List<ChatMessage> messages) int
OpenAiStreamingChatModel.estimateTokenCount
(List<ChatMessage> messages) int
OpenAiTokenizer.estimateTokenCountInMessages
(Iterable<ChatMessage> messages) OpenAiChatModel.generate
(List<ChatMessage> messages) OpenAiChatModel.generate
(List<ChatMessage> messages, ToolSpecification toolSpecification) OpenAiChatModel.generate
(List<ChatMessage> messages, List<ToolSpecification> toolSpecifications) void
OpenAiStreamingChatModel.generate
(List<ChatMessage> messages, ToolSpecification toolSpecification, StreamingResponseHandler<AiMessage> handler) void
OpenAiStreamingChatModel.generate
(List<ChatMessage> messages, StreamingResponseHandler<AiMessage> handler) void
OpenAiStreamingChatModel.generate
(List<ChatMessage> messages, List<ToolSpecification> toolSpecifications, StreamingResponseHandler<AiMessage> handler) OpenAiModerationModel.moderate
(List<ChatMessage> messages) static List
<dev.ai4j.openai4j.chat.Message> InternalOpenAiHelper.toOpenAiMessages
(List<ChatMessage> messages) -
Uses of ChatMessage in dev.langchain4j.model.vertexai
Modifier and TypeMethodDescriptionVertexAiChatModel.generate
(List<ChatMessage> messages) VertexAiGeminiChatModel.generate
(List<ChatMessage> messages) VertexAiGeminiChatModel.generate
(List<ChatMessage> messages, ToolSpecification toolSpecification) VertexAiGeminiChatModel.generate
(List<ChatMessage> messages, List<ToolSpecification> toolSpecifications) void
VertexAiGeminiStreamingChatModel.generate
(List<ChatMessage> messages, ToolSpecification toolSpecification, StreamingResponseHandler<AiMessage> handler) void
VertexAiGeminiStreamingChatModel.generate
(List<ChatMessage> messages, StreamingResponseHandler<AiMessage> handler) void
VertexAiGeminiStreamingChatModel.generate
(List<ChatMessage> messages, List<ToolSpecification> toolSpecifications, StreamingResponseHandler<AiMessage> handler) -
Uses of ChatMessage in dev.langchain4j.model.workersai
Modifier and TypeMethodDescriptionWorkersAiChatModel.generate
(@NonNull ChatMessage... messages) Generates a response from the model based on a sequence of messages.Modifier and TypeMethodDescriptionWorkersAiChatModel.generate
(List<ChatMessage> messages) Generates a response from the model based on a sequence of messages.WorkersAiChatModel.generate
(List<ChatMessage> messages, ToolSpecification toolSpecification) Generates a response from the model based on a list of messages and a single tool specification.WorkersAiChatModel.generate
(List<ChatMessage> messages, List<ToolSpecification> toolSpecifications) Generates a response from the model based on a list of messages and a list of tool specifications. -
Uses of ChatMessage in dev.langchain4j.rag
Modifier and TypeMethodDescriptionAugmentationRequest.chatMessage()
AugmentationResult.chatMessage()
Modifier and TypeMethodDescriptionAugmentationResult.AugmentationResultBuilder.chatMessage
(ChatMessage chatMessage) ModifierConstructorDescriptionAugmentationRequest
(ChatMessage chatMessage, Metadata metadata) AugmentationResult
(ChatMessage chatMessage, List<Content> contents) -
Uses of ChatMessage in dev.langchain4j.rag.content.injector
Modifier and TypeMethodDescriptiondefault ChatMessage
ContentInjector.inject
(List<Content> contents, ChatMessage chatMessage) Injects givenContent
s into a givenChatMessage
.DefaultContentInjector.inject
(List<Content> contents, ChatMessage chatMessage) Modifier and TypeMethodDescriptionprotected Prompt
DefaultContentInjector.createPrompt
(ChatMessage chatMessage, List<Content> contents) default ChatMessage
ContentInjector.inject
(List<Content> contents, ChatMessage chatMessage) Injects givenContent
s into a givenChatMessage
.DefaultContentInjector.inject
(List<Content> contents, ChatMessage chatMessage) -
Uses of ChatMessage in dev.langchain4j.rag.query
Modifier and TypeMethodDescriptionstatic Metadata
Metadata.from
(UserMessage userMessage, Object chatMemoryId, List<ChatMessage> chatMemory) ModifierConstructorDescriptionMetadata
(UserMessage userMessage, Object chatMemoryId, List<ChatMessage> chatMemory) -
Uses of ChatMessage in dev.langchain4j.rag.query.transformer
Modifier and TypeMethodDescriptionprotected String
CompressingQueryTransformer.format
(ChatMessage message) Modifier and TypeMethodDescriptionprotected String
CompressingQueryTransformer.format
(List<ChatMessage> chatMemory) -
Uses of ChatMessage in dev.langchain4j.service
Modifier and TypeMethodDescriptionstatic List
<ChatMessage> AiServices.removeToolMessages
(List<ChatMessage> messages) Modifier and TypeMethodDescriptionstatic List
<ChatMessage> AiServices.removeToolMessages
(List<ChatMessage> messages) ModifierConstructorDescriptionAiServiceTokenStream
(List<ChatMessage> messages, List<ToolSpecification> toolSpecifications, Map<String, ToolExecutor> toolExecutors, List<Content> retrievedContents, AiServiceContext context, Object memoryId) -
Uses of ChatMessage in dev.langchain4j.store.memory.chat
Modifier and TypeMethodDescriptionChatMemoryStore.getMessages
(Object memoryId) Retrieves messages for a specified chat memory.InMemoryChatMemoryStore.getMessages
(Object memoryId) Modifier and TypeMethodDescriptionvoid
ChatMemoryStore.updateMessages
(Object memoryId, List<ChatMessage> messages) Updates messages for a specified chat memory.void
InMemoryChatMemoryStore.updateMessages
(Object memoryId, List<ChatMessage> messages) -
Uses of ChatMessage in dev.langchain4j.store.memory.chat.cassandra
Modifier and TypeMethodDescriptionCassandraChatMemoryStore.getMessages
(@NonNull Object memoryId) Retrieves messages for a specified chat memory.Modifier and TypeMethodDescriptionvoid
CassandraChatMemoryStore.updateMessages
(@NonNull Object memoryId, @NonNull List<ChatMessage> messages) Updates messages for a specified chat memory. -
Uses of ChatMessage in dev.langchain4j.store.memory.chat.coherence
Modifier and TypeMethodDescriptionvoid
CoherenceChatMemoryStore.updateMessages
(Object memoryId, List<ChatMessage> messages) -
Uses of ChatMessage in dev.langchain4j.store.memory.chat.redis
Modifier and TypeMethodDescriptionvoid
RedisChatMemoryStore.updateMessages
(Object memoryId, List<ChatMessage> messages) -
Uses of ChatMessage in dev.langchain4j.store.memory.chat.tablestore
Modifier and TypeMethodDescriptionvoid
TablestoreChatMemoryStore.updateMessages
(Object memoryId, List<ChatMessage> messages)