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
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptionstatic Document.Builderbuilder()booleanGet the content of the message.Deprecated.We are considering getting rid of this, please comment on https://github.com/spring-projects/spring-ai/issues/1782float[]Deprecated.We are considering getting rid of this, please comment on https://github.com/spring-projects/spring-ai/issues/1781getFormattedContent(ContentFormatter formatter, MetadataMode metadataMode) Helper content extractor that uses and externalContentFormatter.getFormattedContent(MetadataMode metadataMode) getId()getMedia()Get the media associated with the content.Get the metadata associated with the content.inthashCode()voidsetContentFormatter(ContentFormatter contentFormatter) Replace the document'sContentFormatter.voidsetEmbedding(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:ContentGet the content of the message.- Specified by:
getContentin interfaceContent- Returns:
- the content of the message
-
getMedia
Description copied from interface:MediaContentGet the media associated with the content.- Specified by:
getMediain interfaceMediaContent
-
getFormattedContent
-
getFormattedContent
-
getFormattedContent
Helper content extractor that uses and externalContentFormatter. -
getMetadata
Description copied from interface:ContentGet the metadata associated with the content.- Specified by:
getMetadatain interfaceContent- Returns:
- the metadata associated with the content
-
getEmbedding
Deprecated.We are considering getting rid of this, please comment on https://github.com/spring-projects/spring-ai/issues/1781Return the embedding that were calculated.- Returns:
- the embeddings
-
setEmbedding
public void setEmbedding(float[] embedding) -
getContentFormatter
Deprecated.We are considering getting rid of this, please comment on https://github.com/spring-projects/spring-ai/issues/1782Returns the content formatter associated with this document.- Returns:
- the current ContentFormatter instance used for formatting the document content.
-
setContentFormatter
Replace the document'sContentFormatter.- Parameters:
contentFormatter- new formatter to use.
-
hashCode
public int hashCode() -
equals
-
toString
-