Uses of Class
dev.langchain4j.data.message.UserMessage
Packages that use UserMessage
Package
Description
-
Uses of UserMessage in dev.langchain4j.agentic.internal
Methods in dev.langchain4j.agentic.internal that return UserMessageMethods in dev.langchain4j.agentic.internal with parameters of type UserMessageModifier and TypeMethodDescriptionstatic StringUserMessageTransformer.text(UserMessage userMessage) The text contents of the given user message joined by new lines, or an empty string if it has none: the message can also have other contents, like the image sent to a multimodal agent. -
Uses of UserMessage in dev.langchain4j.agentic.scope
Methods in dev.langchain4j.agentic.scope with parameters of type UserMessageModifier and TypeMethodDescriptionvoidDefaultAgenticScope.registerContext(AgentInstance agent, Object agentObject, UserMessage userMessage, Object output) Adds to the context of this scope the messages exchanged by an AI agent in the invocation that just completed: the last user message and the last answer of its chat memory when it has one, otherwise the user message of its last model call, when known, and its output. -
Uses of UserMessage in dev.langchain4j.data.message
Methods in dev.langchain4j.data.message that return UserMessageModifier and TypeMethodDescriptionUserMessage.Builder.build()static UserMessageCreate aUserMessagefrom contents.static UserMessageCreate aUserMessagefrom a text.static UserMessageCreate aUserMessagefrom a name and contents.static UserMessageCreate aUserMessagefrom a name and a text.static UserMessageCreate aUserMessagefrom a name and contents.static UserMessageCreate aUserMessagefrom contents.static UserMessageUserMessage.userMessage(Content... contents) Create aUserMessagefrom contents.static UserMessageUserMessage.userMessage(String text) Create aUserMessagefrom a text.static UserMessageUserMessage.userMessage(String name, Content... contents) Create aUserMessagefrom a name and contents.static UserMessageUserMessage.userMessage(String name, String text) Create aUserMessagefrom a name and a text.static UserMessageUserMessage.userMessage(String name, List<Content> contents) Create aUserMessagefrom a name and contents.static UserMessageUserMessage.userMessage(List<Content> contents) Create aUserMessagefrom contents.Methods in dev.langchain4j.data.message that return types with arguments of type UserMessageModifier and TypeMethodDescriptionstatic Optional<UserMessage> UserMessage.findLast(Collection<ChatMessage> messages) Methods in dev.langchain4j.data.message with parameters of type UserMessageModifier and TypeMethodDescriptionstatic List<ChatMessage> UserMessage.replaceLast(List<ChatMessage> messages, UserMessage replacement) Replaces the lastUserMessagein the given list with the specified replacement, if the lastUserMessagediffers from the replacement. -
Uses of UserMessage in dev.langchain4j.guardrail
Methods in dev.langchain4j.guardrail that return UserMessageModifier and TypeMethodDescriptionInputGuardrailRequest.rewriteUserMessage(String text) InputGuardrailRequest.userMessage()Returns the user message.InputGuardrailResult.userMessage(InputGuardrailRequest params) Gets theUserMessagecomputed from the combination of the originalUserMessagein theInputGuardrailRequestand this resultMethods in dev.langchain4j.guardrail with parameters of type UserMessageModifier and TypeMethodDescriptionInputGuardrailRequest.Builder.userMessage(UserMessage userMessage) Sets the user message.default InputGuardrailResultInputGuardrail.validate(UserMessage userMessage) Validates theuser messagethat will be sent to the LLM. -
Uses of UserMessage in dev.langchain4j.guardrails
Methods in dev.langchain4j.guardrails with parameters of type UserMessageModifier and TypeMethodDescriptionDecisionModelInputGuardrail.validate(UserMessage userMessage) MessageModeratorInputGuardrail.validate(UserMessage userMessage) Validates the provided user message using the configuredModerationModel.PatternBasedPromptInjectionGuardrail.validate(UserMessage userMessage) -
Uses of UserMessage in dev.langchain4j.internal
Methods in dev.langchain4j.internal with parameters of type UserMessageModifier and TypeMethodDescriptionstatic booleanDecisionModelInputUtils.hasText(UserMessage userMessage) Whether the user message contains text, not only other content such as images. -
Uses of UserMessage in dev.langchain4j.invocation
Methods in dev.langchain4j.invocation that return UserMessageModifier and TypeMethodDescriptionDefaultInvocationContext.originalUserMessage()InvocationContext.Builder.originalUserMessage()default UserMessageInvocationContext.originalUserMessage()TheUserMessagecreated from the AI Service method and its prompt template, before any transformation (RAG augmentation, content injection, input guardrails, output format instructions).DefaultInvocationContext.userMessage()InvocationContext.Builder.userMessage()default UserMessageInvocationContext.userMessage()TheUserMessageto be sent to the LLM.Methods in dev.langchain4j.invocation with parameters of type UserMessageModifier and TypeMethodDescriptionInvocationContext.Builder.originalUserMessage(UserMessage originalUserMessage) Sets the user message before any transformation, seeInvocationContext.originalUserMessage().InvocationContext.Builder.userMessage(UserMessage userMessage) Sets the final user message that was sent to the LLM. -
Uses of UserMessage in dev.langchain4j.model.input
Methods in dev.langchain4j.model.input that return UserMessageModifier and TypeMethodDescriptionPrompt.toUserMessage()Convert this prompt to a UserMessage.Prompt.toUserMessage(String userName) Convert this prompt to a UserMessage with specified userName. -
Uses of UserMessage in dev.langchain4j.observability.api.event
Methods in dev.langchain4j.observability.api.event that return UserMessageModifier and TypeMethodDescriptionInputGuardrailExecutedEvent.rewrittenUserMessage()Retrieves a rewritten user message if a successful rewritten result exists.AiServiceStartedEvent.AiServiceStartedEventBuilder.userMessage()AiServiceStartedEvent.userMessage()Retrieves the user message associated with the invocation.Methods in dev.langchain4j.observability.api.event with parameters of type UserMessageModifier and TypeMethodDescriptionAiServiceStartedEvent.AiServiceStartedEventBuilder.userMessage(UserMessage userMessage) Sets the user message. -
Uses of UserMessage in dev.langchain4j.observability.event
Methods in dev.langchain4j.observability.event that return UserMessageModifier and TypeMethodDescriptionDefaultInputGuardrailExecutedEvent.rewrittenUserMessage()DefaultAiServiceStartedEvent.userMessage() -
Uses of UserMessage in dev.langchain4j.service.guardrail
Methods in dev.langchain4j.service.guardrail that return UserMessageModifier and TypeMethodDescriptiondefault <MethodKey>
UserMessageGuardrailService.executeGuardrails(MethodKey method, InputGuardrailRequest request) Executes the input guardrails associated with the given method and parameters, and retrieves a modified or validatedUserMessagebased on the result.Methods in dev.langchain4j.service.guardrail that return types with arguments of type UserMessageModifier and TypeMethodDescriptiondefault <MethodKey>
CompletableFuture<UserMessage> GuardrailService.executeGuardrailsAsync(MethodKey method, InputGuardrailRequest request) Non-blocking counterpart ofGuardrailService.executeGuardrails(Object, InputGuardrailRequest): runs the input guardrails without blocking the calling thread and yields the (possibly rewritten)UserMessage. -
Uses of UserMessage in dev.langchain4j.service.tool
Methods in dev.langchain4j.service.tool that return UserMessageMethods in dev.langchain4j.service.tool with parameters of type UserMessageModifier and TypeMethodDescriptionToolService.createContext(InvocationContext invocationContext, UserMessage userMessage, List<ChatMessage> messages) ToolProviderRequest.Builder.userMessage(UserMessage userMessage) Constructors in dev.langchain4j.service.tool with parameters of type UserMessage