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.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.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
- Returns:
- the content of the message
-
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
. -
getMetadata
Description copied from interface:Content
Get the metadata associated with the content.- Specified by:
getMetadata
in 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
-