Class CitationDocument.Builder
java.lang.Object
org.springframework.ai.anthropic.api.CitationDocument.Builder
- Enclosing class:
CitationDocument
Builder class for CitationDocument.
- Since:
- 1.1.0
- Author:
- Soby Chacko
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Build the CitationDocument.citationsEnabled(boolean enabled) Enable or disable citations for this document.Set the document context (optional, not included in citations).customContent(String... textBlocks) Create a custom content document from text blocks.customContent(List<AnthropicApi.ContentBlock> contentBlocks) Create a custom content document with user-defined blocks.pdf(byte[] pdfBytes) Create a PDF document from byte array.Create a PDF document from file path.Create a plain text document.Set the document title (optional, not included in citations).
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
plainText
Create a plain text document.- Parameters:
text- The document text content- Returns:
- Builder for method chaining
-
pdf
Create a PDF document from byte array.- Parameters:
pdfBytes- The PDF file content as bytes- Returns:
- Builder for method chaining
-
pdfFile
Create a PDF document from file path.- Parameters:
filePath- Path to the PDF file- Returns:
- Builder for method chaining
- Throws:
IOException- if file cannot be read
-
customContent
Create a custom content document with user-defined blocks.- Parameters:
contentBlocks- List of content blocks for fine-grained citation control- Returns:
- Builder for method chaining
-
customContent
Create a custom content document from text blocks.- Parameters:
textBlocks- Variable number of text strings to create content blocks- Returns:
- Builder for method chaining
-
title
Set the document title (optional, not included in citations).- Parameters:
title- Document title for reference- Returns:
- Builder for method chaining
-
context
Set the document context (optional, not included in citations).- Parameters:
context- Additional context or metadata about the document- Returns:
- Builder for method chaining
-
citationsEnabled
Enable or disable citations for this document.- Parameters:
enabled- Whether citations should be enabled- Returns:
- Builder for method chaining
-
build
-