Uses of Interface
dev.langchain4j.data.message.ChatMessage
Packages that use ChatMessage
Package
Description
-
Uses of ChatMessage in dev.langchain4j.data.message
Classes in dev.langchain4j.data.message that implement ChatMessageModifier and TypeClassDescriptionclass
Represents a response message from an AI (language model).class
Represents a custom message.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.Methods in dev.langchain4j.data.message that return ChatMessageModifier and TypeMethodDescriptionstatic ChatMessage
ChatMessageDeserializer.messageFromJson
(String json) Deserializes a JSON string into aChatMessage
.ChatMessageJsonCodec.messageFromJson
(String json) Deserializes a JSON string to aChatMessage
object.Methods in dev.langchain4j.data.message that return types with arguments of type ChatMessageModifier 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.Methods in dev.langchain4j.data.message with parameters of type ChatMessageModifier 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.Method parameters in dev.langchain4j.data.message with type arguments of type ChatMessageModifier 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. -
Uses of ChatMessage in dev.langchain4j.memory
Methods in dev.langchain4j.memory that return types with arguments of type ChatMessageMethods in dev.langchain4j.memory with parameters of type ChatMessageModifier and TypeMethodDescriptionvoid
ChatMemory.add
(ChatMessage message) Adds a message to the chat memory. -
Uses of ChatMessage in dev.langchain4j.memory.chat
Methods in dev.langchain4j.memory.chat that return types with arguments of type ChatMessageModifier and TypeMethodDescriptionMessageWindowChatMemory.messages()
TokenWindowChatMemory.messages()
Methods in dev.langchain4j.memory.chat with parameters of type ChatMessageModifier and TypeMethodDescriptionvoid
MessageWindowChatMemory.add
(ChatMessage message) void
TokenWindowChatMemory.add
(ChatMessage message) -
Uses of ChatMessage in dev.langchain4j.model
Methods in dev.langchain4j.model with parameters of type ChatMessageModifier and TypeMethodDescriptionint
Tokenizer.estimateTokenCountInMessage
(ChatMessage message) Estimates the count of tokens in the given message.Method parameters in dev.langchain4j.model with type arguments of type ChatMessageModifier and TypeMethodDescriptionint
Tokenizer.estimateTokenCountInMessages
(Iterable<ChatMessage> messages) Estimates the count of tokens in the given messages. -
Uses of ChatMessage in dev.langchain4j.model.anthropic.internal.mapper
Method parameters in dev.langchain4j.model.anthropic.internal.mapper with type arguments of type ChatMessageModifier 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
Methods in dev.langchain4j.model.anthropic.internal.sanitizer that return types with arguments of type ChatMessageModifier and TypeMethodDescriptionstatic List
<ChatMessage> MessageSanitizer.sanitizeMessages
(List<ChatMessage> messages) Method parameters in dev.langchain4j.model.anthropic.internal.sanitizer with type arguments of type ChatMessageModifier and TypeMethodDescriptionstatic List
<ChatMessage> MessageSanitizer.sanitizeMessages
(List<ChatMessage> messages) -
Uses of ChatMessage in dev.langchain4j.model.azure
Methods in dev.langchain4j.model.azure with parameters of type ChatMessageModifier and TypeMethodDescriptionint
AzureOpenAiTokenizer.estimateTokenCountInMessage
(ChatMessage message) Method parameters in dev.langchain4j.model.azure with type arguments of type ChatMessageModifier and TypeMethodDescriptionint
AzureOpenAiChatModel.estimateTokenCount
(List<ChatMessage> messages) int
AzureOpenAiStreamingChatModel.estimateTokenCount
(List<ChatMessage> messages) int
AzureOpenAiTokenizer.estimateTokenCountInMessages
(Iterable<ChatMessage> messages) -
Uses of ChatMessage in dev.langchain4j.model.bedrock
Method parameters in dev.langchain4j.model.bedrock with type arguments of type ChatMessageModifier and TypeMethodDescriptionBedrockAnthropicMessageChatModel.generate
(List<ChatMessage> messages) Deprecated, for removal: This API element is subject to removal in a future version.BedrockMistralAiChatModel.generate
(List<ChatMessage> messages) Deprecated, for removal: This API element is subject to removal in a future version. -
Uses of ChatMessage in dev.langchain4j.model.bedrock.internal
Methods in dev.langchain4j.model.bedrock.internal with parameters of type ChatMessageModifier and TypeMethodDescriptionprotected String
AbstractSharedBedrockChatModel.chatMessageToString
(ChatMessage message) Convert chat message to stringMethod parameters in dev.langchain4j.model.bedrock.internal with type arguments of type ChatMessageModifier 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) -
Uses of ChatMessage in dev.langchain4j.model.bedrock.internal.sanitizer
Methods in dev.langchain4j.model.bedrock.internal.sanitizer that return types with arguments of type ChatMessageModifier and TypeMethodDescriptionstatic List
<ChatMessage> BedrockAnthropicMessageSanitizer.sanitizeMessages
(List<ChatMessage> messages) Method parameters in dev.langchain4j.model.bedrock.internal.sanitizer with type arguments of type ChatMessageModifier and TypeMethodDescriptionstatic List
<ChatMessage> BedrockAnthropicMessageSanitizer.sanitizeMessages
(List<ChatMessage> messages) -
Uses of ChatMessage in dev.langchain4j.model.chat
Methods in dev.langchain4j.model.chat with parameters of type ChatMessageModifier and TypeMethodDescriptiondefault ChatResponse
ChatLanguageModel.chat
(ChatMessage... messages) Method parameters in dev.langchain4j.model.chat with type arguments of type ChatMessageModifier and TypeMethodDescriptiondefault ChatResponse
ChatLanguageModel.chat
(List<ChatMessage> messages) default void
StreamingChatLanguageModel.chat
(List<ChatMessage> messages, StreamingChatResponseHandler handler) int
TokenCountEstimator.estimateTokenCount
(List<ChatMessage> messages) Estimates the count of tokens in the specified list of messages. -
Uses of ChatMessage in dev.langchain4j.model.chat.listener
Methods in dev.langchain4j.model.chat.listener that return types with arguments of type ChatMessageModifier and TypeMethodDescriptionChatModelRequest.messages()
Deprecated, for removal: This API element is subject to removal in a future version.Method parameters in dev.langchain4j.model.chat.listener with type arguments of type ChatMessageModifier and TypeMethodDescriptionChatModelRequest.ChatModelRequestBuilder.messages
(List<ChatMessage> messages) Constructor parameters in dev.langchain4j.model.chat.listener with type arguments of type ChatMessageModifierConstructorDescriptionChatModelRequest
(String model, Double temperature, Double topP, Integer maxTokens, List<ChatMessage> messages, List<ToolSpecification> toolSpecifications) Deprecated, for removal: This API element is subject to removal in a future version. -
Uses of ChatMessage in dev.langchain4j.model.chat.request
Methods in dev.langchain4j.model.chat.request that return types with arguments of type ChatMessageMethods in dev.langchain4j.model.chat.request with parameters of type ChatMessageMethod parameters in dev.langchain4j.model.chat.request with type arguments of type ChatMessageModifier and TypeMethodDescriptionChatRequest.Builder.messages
(List<ChatMessage> messages) static void
ChatRequestValidator.validateMessages
(List<ChatMessage> messages) -
Uses of ChatMessage in dev.langchain4j.model.googleai
Methods in dev.langchain4j.model.googleai with parameters of type ChatMessageModifier and TypeMethodDescriptionint
GoogleAiGeminiTokenizer.estimateTokenCountInMessage
(ChatMessage message) Method parameters in dev.langchain4j.model.googleai with type arguments of type ChatMessageModifier and TypeMethodDescriptionint
GoogleAiGeminiChatModel.estimateTokenCount
(List<ChatMessage> messages) int
GoogleAiGeminiTokenizer.estimateTokenCountInMessages
(Iterable<ChatMessage> messages) -
Uses of ChatMessage in dev.langchain4j.model.mistralai
Method parameters in dev.langchain4j.model.mistralai with type arguments of type ChatMessage -
Uses of ChatMessage in dev.langchain4j.model.mistralai.internal.mapper
Method parameters in dev.langchain4j.model.mistralai.internal.mapper with type arguments of type ChatMessageModifier and TypeMethodDescriptionstatic List
<MistralAiChatMessage> MistralAiMapper.toMistralAiMessages
(List<ChatMessage> messages) -
Uses of ChatMessage in dev.langchain4j.model.moderation
Methods in dev.langchain4j.model.moderation with parameters of type ChatMessageModifier and TypeMethodDescriptionDisabledModerationModel.moderate
(ChatMessage message) default Response
<Moderation> ModerationModel.moderate
(ChatMessage message) Moderates the given chat message.Method parameters in dev.langchain4j.model.moderation with type arguments of type ChatMessageModifier 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.openai
Methods in dev.langchain4j.model.openai with parameters of type ChatMessageModifier and TypeMethodDescriptionint
OpenAiTokenizer.estimateTokenCountInMessage
(ChatMessage message) static Message
InternalOpenAiHelper.toOpenAiMessage
(ChatMessage message) Method parameters in dev.langchain4j.model.openai with type arguments of type ChatMessageModifier and TypeMethodDescriptionint
OpenAiChatModel.estimateTokenCount
(List<ChatMessage> messages) int
OpenAiStreamingChatModel.estimateTokenCount
(List<ChatMessage> messages) int
OpenAiTokenizer.estimateTokenCountInMessages
(Iterable<ChatMessage> messages) OpenAiModerationModel.moderate
(List<ChatMessage> messages) InternalOpenAiHelper.toOpenAiMessages
(List<ChatMessage> messages) -
Uses of ChatMessage in dev.langchain4j.rag
Methods in dev.langchain4j.rag that return ChatMessageModifier and TypeMethodDescriptionAugmentationRequest.chatMessage()
AugmentationResult.chatMessage()
Methods in dev.langchain4j.rag with parameters of type ChatMessageModifier and TypeMethodDescriptionAugmentationResult.AugmentationResultBuilder.chatMessage
(ChatMessage chatMessage) Constructors in dev.langchain4j.rag with parameters of type ChatMessageModifierConstructorDescriptionAugmentationRequest
(ChatMessage chatMessage, Metadata metadata) AugmentationResult
(ChatMessage chatMessage, List<Content> contents) -
Uses of ChatMessage in dev.langchain4j.rag.content.injector
Methods in dev.langchain4j.rag.content.injector that return ChatMessageModifier and TypeMethodDescriptiondefault ChatMessage
ContentInjector.inject
(List<Content> contents, ChatMessage chatMessage) Injects givenContent
s into a givenChatMessage
.DefaultContentInjector.inject
(List<Content> contents, ChatMessage chatMessage) Methods in dev.langchain4j.rag.content.injector with parameters of type ChatMessageModifier 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
Methods in dev.langchain4j.rag.query that return types with arguments of type ChatMessageMethod parameters in dev.langchain4j.rag.query with type arguments of type ChatMessageModifier and TypeMethodDescriptionstatic Metadata
Metadata.from
(UserMessage userMessage, Object chatMemoryId, List<ChatMessage> chatMemory) Constructor parameters in dev.langchain4j.rag.query with type arguments of type ChatMessageModifierConstructorDescriptionMetadata
(UserMessage userMessage, Object chatMemoryId, List<ChatMessage> chatMemory) -
Uses of ChatMessage in dev.langchain4j.rag.query.transformer
Methods in dev.langchain4j.rag.query.transformer with parameters of type ChatMessageModifier and TypeMethodDescriptionprotected String
CompressingQueryTransformer.format
(ChatMessage message) Method parameters in dev.langchain4j.rag.query.transformer with type arguments of type ChatMessageModifier and TypeMethodDescriptionprotected String
CompressingQueryTransformer.format
(List<ChatMessage> chatMemory) -
Uses of ChatMessage in dev.langchain4j.service
Methods in dev.langchain4j.service that return types with arguments of type ChatMessageModifier and TypeMethodDescriptionstatic List
<ChatMessage> AiServices.removeToolMessages
(List<ChatMessage> messages) Method parameters in dev.langchain4j.service with type arguments of type ChatMessageModifier and TypeMethodDescriptionstatic List
<ChatMessage> AiServices.removeToolMessages
(List<ChatMessage> messages) Constructor parameters in dev.langchain4j.service with type arguments of type ChatMessageModifierConstructorDescriptionAiServiceTokenStream
(List<ChatMessage> messages, List<ToolSpecification> toolSpecifications, Map<String, ToolExecutor> toolExecutors, List<Content> retrievedContents, AiServiceContext context, Object memoryId) -
Uses of ChatMessage in dev.langchain4j.service.tool
Method parameters in dev.langchain4j.service.tool with type arguments of type ChatMessageModifier and TypeMethodDescriptionToolService.executeInferenceAndToolsLoop
(ChatResponse chatResponse, ChatRequestParameters parameters, List<ChatMessage> messages, ChatLanguageModel chatModel, ChatMemory chatMemory, Object memoryId, Map<String, ToolExecutor> toolExecutors) -
Uses of ChatMessage in dev.langchain4j.store.memory.chat
Methods in dev.langchain4j.store.memory.chat that return types with arguments of type ChatMessageModifier and TypeMethodDescriptionChatMemoryStore.getMessages
(Object memoryId) Retrieves messages for a specified chat memory.InMemoryChatMemoryStore.getMessages
(Object memoryId) Method parameters in dev.langchain4j.store.memory.chat with type arguments of type ChatMessageModifier 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
Methods in dev.langchain4j.store.memory.chat.cassandra that return types with arguments of type ChatMessageModifier and TypeMethodDescriptionCassandraChatMemoryStore.getMessages
(@NonNull Object memoryId) Retrieves messages for a specified chat memory.Method parameters in dev.langchain4j.store.memory.chat.cassandra with type arguments of type ChatMessageModifier 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
Methods in dev.langchain4j.store.memory.chat.coherence that return types with arguments of type ChatMessageMethod parameters in dev.langchain4j.store.memory.chat.coherence with type arguments of type ChatMessageModifier and TypeMethodDescriptionvoid
CoherenceChatMemoryStore.updateMessages
(Object memoryId, List<ChatMessage> messages) -
Uses of ChatMessage in dev.langchain4j.store.memory.chat.tablestore
Methods in dev.langchain4j.store.memory.chat.tablestore that return types with arguments of type ChatMessageMethod parameters in dev.langchain4j.store.memory.chat.tablestore with type arguments of type ChatMessageModifier and TypeMethodDescriptionvoid
TablestoreChatMemoryStore.updateMessages
(Object memoryId, List<ChatMessage> messages)