Record Class SourceExtract
java.lang.Object
java.lang.Record
com.vaadin.flow.component.ai.common.SourceExtract
- Record Components:
text- the snippet as the model reports it, notnulllocation- where the snippet sits inside the source document, ornullwhen the source has no position to point at (for example pasted text)
- All Implemented Interfaces:
Serializable
public record SourceExtract(String text, SourceLocation location)
extends Record
implements Serializable
One snippet the LLM says it read to produce a value. The text is what the
model reports, not a verified quote: the controller never sees the source
document, so the snippet records what the AI said its source was rather than
proof that the value is correct.
The location says where the snippet sits inside its source document, but not which document. Sources are unambiguous only when a single document is attached per prompt.
- Since:
- 25.3
- Author:
- Vaadin Ltd
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionSourceExtract(String text, SourceLocation location) Creates a new source extract. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.location()Returns the value of thelocationrecord component.text()Returns the value of thetextrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
SourceExtract
Creates a new source extract.- Parameters:
text- the snippet as the model reports it, notnulllocation- where the snippet sits inside the source document, ornullwhen the source has no position to point at- Throws:
NullPointerException- iftextisnull
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
text
Returns the value of thetextrecord component.- Returns:
- the value of the
textrecord component
-
location
Returns the value of thelocationrecord component.- Returns:
- the value of the
locationrecord component
-