Class DoclingServeClient
java.lang.Object
org.apache.camel.component.docling.DoclingServeClient
Client for interacting with Docling-Serve API.
-
Constructor Summary
ConstructorsConstructorDescriptionDoclingServeClient(String baseUrl) DoclingServeClient(String baseUrl, AuthenticationScheme authenticationScheme, String authenticationToken, String apiKeyHeader) DoclingServeClient(String baseUrl, AuthenticationScheme authenticationScheme, String authenticationToken, String apiKeyHeader, String convertEndpoint) DoclingServeClient(String baseUrl, AuthenticationScheme authenticationScheme, String authenticationToken, String apiKeyHeader, String convertEndpoint, long asyncPollInterval, long asyncTimeout) DoclingServeClient(String baseUrl, AuthenticationScheme authenticationScheme, String authenticationToken, String apiKeyHeader, String convertEndpoint, long asyncPollInterval, long asyncTimeout, int maxTotalConnections, int maxConnectionsPerRoute, int connectionTimeout, int socketTimeout, int connectionRequestTimeout, long connectionTimeToLive, int validateAfterInactivity, boolean evictIdleConnections, long maxIdleTime) -
Method Summary
Modifier and TypeMethodDescriptioncheckConversionStatus(String taskId) Check the status of an async conversion task.voidclose()convertDocument(String inputSource, String outputFormat) Convert a document using the docling-serve API.convertDocumentAsync(String inputSource, String outputFormat) Convert a document using the docling-serve async API and return the task ID.convertDocumentAsyncAndWait(String inputSource, String outputFormat) Convert a document asynchronously and wait for completion by polling.convertDocumentsBatch(List<String> inputSources, String outputFormat, int batchSize, int parallelism, boolean failOnFirstError, boolean useAsync, long batchTimeout) Convert multiple documents in batch using parallel processing.extractMetadata(String inputSource, boolean extractAll, boolean includeRawMetadata) Extract metadata from a document using the docling-serve API.Get connection pool statistics for monitoring.
-
Constructor Details
-
DoclingServeClient
-
DoclingServeClient
public DoclingServeClient(String baseUrl, AuthenticationScheme authenticationScheme, String authenticationToken, String apiKeyHeader) -
DoclingServeClient
public DoclingServeClient(String baseUrl, AuthenticationScheme authenticationScheme, String authenticationToken, String apiKeyHeader, String convertEndpoint) -
DoclingServeClient
public DoclingServeClient(String baseUrl, AuthenticationScheme authenticationScheme, String authenticationToken, String apiKeyHeader, String convertEndpoint, long asyncPollInterval, long asyncTimeout) -
DoclingServeClient
public DoclingServeClient(String baseUrl, AuthenticationScheme authenticationScheme, String authenticationToken, String apiKeyHeader, String convertEndpoint, long asyncPollInterval, long asyncTimeout, int maxTotalConnections, int maxConnectionsPerRoute, int connectionTimeout, int socketTimeout, int connectionRequestTimeout, long connectionTimeToLive, int validateAfterInactivity, boolean evictIdleConnections, long maxIdleTime)
-
-
Method Details
-
convertDocument
Convert a document using the docling-serve API.- Parameters:
inputSource- File path or URL to the documentoutputFormat- Output format (md, json, html, text)- Returns:
- Converted document content
- Throws:
IOException- If the API call fails
-
convertDocumentAsync
Convert a document using the docling-serve async API and return the task ID.- Parameters:
inputSource- File path or URL to the documentoutputFormat- Output format (md, json, html, text)- Returns:
- Task ID for the async conversion
- Throws:
IOException- If the API call fails
-
checkConversionStatus
Check the status of an async conversion task.- Parameters:
taskId- The task ID returned from convertDocumentAsync- Returns:
- ConversionStatus object with current status
- Throws:
IOException- If the API call fails
-
convertDocumentAsyncAndWait
public String convertDocumentAsyncAndWait(String inputSource, String outputFormat) throws IOException Convert a document asynchronously and wait for completion by polling.- Parameters:
inputSource- File path or URL to the documentoutputFormat- Output format (md, json, html, text)- Returns:
- Converted document content
- Throws:
IOException- If the API call fails or timeout occurs
-
convertDocumentsBatch
public BatchProcessingResults convertDocumentsBatch(List<String> inputSources, String outputFormat, int batchSize, int parallelism, boolean failOnFirstError, boolean useAsync, long batchTimeout) Convert multiple documents in batch using parallel processing.- Parameters:
inputSources- List of file paths or URLs to documentsoutputFormat- Output format (md, json, html, text)batchSize- Maximum number of documents in this batchparallelism- Number of parallel threads to usefailOnFirstError- Whether to fail entire batch on first erroruseAsync- Whether to use async mode for individual conversionsbatchTimeout- Maximum time to wait for batch completion in milliseconds- Returns:
- BatchProcessingResults containing all conversion results
-
extractMetadata
public DocumentMetadata extractMetadata(String inputSource, boolean extractAll, boolean includeRawMetadata) throws IOException Extract metadata from a document using the docling-serve API.- Parameters:
inputSource- File path or URL to the documentextractAll- Whether to extract all available metadata fieldsincludeRawMetadata- Whether to include raw metadata in the response- Returns:
- DocumentMetadata object with extracted metadata
- Throws:
IOException- If the API call fails
-
close
- Throws:
IOException
-
getPoolStats
Get connection pool statistics for monitoring.- Returns:
- Connection pool statistics as a formatted string
-