Verified Owner
Top Inners Fields Constructors Methods
org.jabref.model.ai.chatting

public final Record ChatMessage

extends Record
Class Inheritance
Record Components
id:String 
timestamp:Instant 
role:ChatMessage.Role 
content:String 
relevantInformation:List<RelevantInformation> 
Imports
java.time.Instant, java.util.List, .Optional, .UUID, org.jabref.model.ai.pipeline.RelevantInformation, com.fasterxml.jackson.annotation.JsonCreator, .JsonProperty, dev.langchain4j.data.message.AiMessage, dev.langchain4j.data.message.SystemMessage, dev.langchain4j.data.message.UserMessage

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum

Field Summary

Modifier and TypeField and Description
private final String
content

Record Component accessed by content().

private final String
id

Record Component accessed by id().

private final List<RelevantInformation>
relevantInformation

Record Component accessed by relevantInformation().

private final ChatMessage.Role
role

Record Component accessed by role().

private final Instant
timestamp

Record Component accessed by timestamp().

Constructor Summary

AccessConstructor and Description
public
ChatMessage(String id, Instant timestamp, ChatMessage.Role role, String content, List<RelevantInformation> relevantInformation)

Method Summary

Modifier and TypeMethod and Description
public static ChatMessage
aiMessage(String content, List<RelevantInformation> relevantInformation)

public String
content()

Record Component getter of content.

private static ChatMessage
dummyChatMessage(ChatMessage.Role role, String content, Instant timestamp, List<RelevantInformation> relevantInformation)

public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public static ChatMessage
public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public String
id()

Record Component getter of id.

public List<RelevantInformation>
relevantInformation()

Record Component getter of relevantInformation.

public ChatMessage.Role
role()

Record Component getter of role.

public static ChatMessage
public static ChatMessage
systemMessage(Instant timestamp, String content)

public Instant
timestamp()

Record Component getter of timestamp.

public Optional<dev.langchain4j.data.message.ChatMessage>
public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

public static ChatMessage
public static ChatMessage
userMessage(Instant timestamp, String content)

Field Detail

contentback to summary
private final String content

Record Component accessed by content().

idback to summary
private final String id

Record Component accessed by id().

relevantInformationback to summary
private final List<RelevantInformation> relevantInformation

Record Component accessed by relevantInformation().

roleback to summary
private final ChatMessage.Role role

Record Component accessed by role().

timestampback to summary
private final Instant timestamp

Record Component accessed by timestamp().

Constructor Detail

ChatMessageback to summary
public ChatMessage(String id, Instant timestamp, ChatMessage.Role role, String content, List<RelevantInformation> relevantInformation)
Annotations
@JsonCreator

Method Detail

aiMessageback to summary
public static ChatMessage aiMessage(String content, List<RelevantInformation> relevantInformation)
contentback to summary
public String content()

Record Component getter of content.

dummyChatMessageback to summary
private static ChatMessage dummyChatMessage(ChatMessage.Role role, String content, Instant timestamp, List<RelevantInformation> relevantInformation)
equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
errorMessageback to summary
public static ChatMessage errorMessage(Throwable throwable)
hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

idback to summary
public String id()

Record Component getter of id.

relevantInformationback to summary
public List<RelevantInformation> relevantInformation()

Record Component getter of relevantInformation.

roleback to summary
public ChatMessage.Role role()

Record Component getter of role.

systemMessageback to summary
public static ChatMessage systemMessage(String content)
systemMessageback to summary
public static ChatMessage systemMessage(Instant timestamp, String content)
timestampback to summary
public Instant timestamp()

Record Component getter of timestamp.

toLangChainMessageback to summary
public Optional<dev.langchain4j.data.message.ChatMessage> toLangChainMessage()
toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.

userMessageback to summary
public static ChatMessage userMessage(String content)
userMessageback to summary
public static ChatMessage userMessage(Instant timestamp, String content)
org.jabref.model.ai.chatting back to summary

public final Enum ChatMessage.Role

extends Enum<ChatMessage.Role>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final ChatMessage.Role
public static final ChatMessage.Role
public static final ChatMessage.Role
public static final ChatMessage.Role

Constructor Summary

AccessConstructor and Description
private
Role()

Method Summary

Modifier and TypeMethod and Description
public boolean
public static ChatMessage.Role
public static ChatMessage.Role[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

AIback to summary
public static final ChatMessage.Role AI
ERRORback to summary
public static final ChatMessage.Role ERROR
SYSTEMback to summary
public static final ChatMessage.Role SYSTEM
USERback to summary
public static final ChatMessage.Role USER

Constructor Detail

Roleback to summary
private Role()

Method Detail

canRegenerateback to summary
public boolean canRegenerate()
valueOfback to summary
public static ChatMessage.Role valueOf(String name)
valuesback to summary
public static ChatMessage.Role[] values()