Package org.springframework.ai.document
Class Document.Builder
java.lang.Object
org.springframework.ai.document.Document.Builder
- Enclosing class:
- Document
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
idGenerator
(IdGenerator idGenerator) Sets the media content of the document.Sets a score value for this document.Sets the text content of the document.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
idGenerator
-
id
-
text
Sets the text content of the document.Either text or media content must be set before building the document, but not both.
- Parameters:
text
- the text content- Returns:
- the builder instance
- See Also:
-
media
Sets the media content of the document.Either text or media content must be set before building the document, but not both.
- Parameters:
media
- the media content- Returns:
- the builder instance
- See Also:
-
metadata
-
metadata
-
score
Sets a score value for this document.Common uses include:
- Measure of similarity between the embedding value of the document's text/media and a query vector, where higher scores indicate greater similarity (opposite of distance measure)
- Text relevancy rankings from retrieval systems
- Custom relevancy metrics from RAG patterns
Higher values typically indicate greater relevance or similarity.
- Parameters:
score
- the document score, may be null- Returns:
- the builder instance
-
build
-