Package org.springframework.ai.document
Class Document
java.lang.Object
org.springframework.ai.document.Document
- All Implemented Interfaces:
Content
,MediaContent
A document is a container for the content and metadata of a document. It also contains
the document's unique ID and an optional embedding.
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
ConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptionstatic Document.Builder
builder()
boolean
Get the content of the message.float[]
getFormattedContent
(ContentFormatter formatter, MetadataMode metadataMode) Helper content extractor that uses and externalContentFormatter
.getFormattedContent
(MetadataMode metadataMode) getId()
getMedia()
Get the media associated with the content.return Get the metadata associated with the content.int
hashCode()
void
setContentFormatter
(ContentFormatter contentFormatter) Replace the document'sContentFormatter
.void
setEmbedding
(float[] embedding) toString()
-
Field Details
-
DEFAULT_CONTENT_FORMATTER
-
EMPTY_TEXT
- See Also:
-
-
Constructor Details
-
Document
-
Document
-
Document
-
Document
-
Document
-
Document
-
-
Method Details
-
builder
-
getId
-
getContent
Description copied from interface:Content
Get the content of the message.- Specified by:
getContent
in interfaceContent
-
getMedia
Description copied from interface:MediaContent
Get the media associated with the content.- Specified by:
getMedia
in interfaceMediaContent
-
getFormattedContent
-
getFormattedContent
-
getFormattedContent
Helper content extractor that uses and externalContentFormatter
. -
setEmbedding
public void setEmbedding(float[] embedding) -
setContentFormatter
Replace the document'sContentFormatter
.- Parameters:
contentFormatter
- new formatter to use.
-
getMetadata
Description copied from interface:Content
return Get the metadata associated with the content.- Specified by:
getMetadata
in interfaceContent
-
getEmbedding
public float[] getEmbedding() -
getContentFormatter
-
hashCode
public int hashCode() -
equals
-
toString
-