Package com.tnsai.knowledge
Class Document.Builder
java.lang.Object
com.tnsai.knowledge.Document.Builder
- Enclosing class:
Document
Builder for creating Document instances.
-
Method Details
-
id
Sets the document ID. If not set, a UUID will be generated.- Parameters:
id- the document ID- Returns:
- this builder
-
content
Sets the document content.- Parameters:
content- the content text- Returns:
- this builder
-
metadata
Adds a metadata entry.- Parameters:
key- the metadata keyvalue- the metadata value- Returns:
- this builder
-
metadata
Adds multiple metadata entries.- Parameters:
metadata- the metadata map- Returns:
- this builder
-
embedding
Sets the document embedding.- Parameters:
embedding- the embedding vector- Returns:
- this builder
-
build
Builds the document.- Returns:
- the new document
- Throws:
IllegalStateException- if content is not set
-