java.lang.Object
ai.docling.serve.client.DoclingServeClient
- All Implemented Interfaces:
ai.docling.serve.api.DoclingServeApi
- Direct Known Subclasses:
DoclingServeJackson2Client,DoclingServeJackson3Client
public abstract class DoclingServeClient
extends Object
implements ai.docling.serve.api.DoclingServeApi
Abstract class representing a client for interacting with the Docling API.
This class handles the foundational functionality needed to perform HTTP requests to the Docling API, with customizable base URL and HTTP client configurations. It provides abstract methods for JSON serialization and deserialization, allowing implementation-specific customization.
Concrete subclasses must implement readValue(String, Class) and
writeValueAsString(Object) for serialization and deserialization behavior.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDoclingServeClient.DoclingServeClientBuilder<C extends DoclingServeClient,B extends DoclingServeClient.DoclingServeClientBuilder<C, B>> Abstract base class for building instances ofDoclingServeClient.Nested classes/interfaces inherited from interface ai.docling.serve.api.DoclingServeApi
ai.docling.serve.api.DoclingServeApi.DoclingApiBuilder<T extends ai.docling.serve.api.DoclingServeApi,B extends ai.docling.serve.api.DoclingServeApi.DoclingApiBuilder<T, B>> -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected -
Method Summary
Modifier and TypeMethodDescriptionai.docling.serve.api.chunk.response.ChunkDocumentResponsechunkSourceWithHierarchicalChunker(ai.docling.serve.api.chunk.request.HierarchicalChunkDocumentRequest request) ai.docling.serve.api.chunk.response.ChunkDocumentResponsechunkSourceWithHybridChunker(ai.docling.serve.api.chunk.request.HybridChunkDocumentRequest request) ai.docling.serve.api.convert.response.ConvertDocumentResponseconvertSource(ai.docling.serve.api.convert.request.ConvertDocumentRequest request) protected HttpRequest.Builderprotected <T> Texecute(HttpRequest request, Class<T> expectedValueType) protected <O> OexecuteGet(String uri, Class<O> expectedReturnType) protected <I,O> O executePost(String uri, I request, Class<O> expectedReturnType) protected <T> TgetResponse(HttpResponse<String> response, Class<T> expectedReturnType) ai.docling.serve.api.health.HealthCheckResponsehealth()protected voidlogRequest(HttpRequest request) protected voidlogResponse(HttpResponse<String> response, Optional<String> responseBody) protected abstract <T> TReads and deserializes the given JSON string into an instance of the specified type.protected abstract <T> StringwriteValueAsString(T value) Serializes the given object into its JSON string representation.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ai.docling.serve.api.DoclingServeApi
toBuilder
-
Field Details
-
DEFAULT_BASE_URL
-
-
Constructor Details
-
DoclingServeClient
-
-
Method Details
-
readValue
Reads and deserializes the given JSON string into an instance of the specified type.- Type Parameters:
T- the type of the object to be deserialized- Parameters:
json- the JSON string to deserialize; must not benullvalueType- theClassof the target type; must not benull- Returns:
- an instance of
Tdeserialized from the provided JSON - Throws:
RuntimeException- if the JSON parsing fails
-
writeValueAsString
Serializes the given object into its JSON string representation.- Type Parameters:
T- the type of the object to serialize- Parameters:
value- the object to serialize; must not benull- Returns:
- the JSON string representation of the given object
- Throws:
RuntimeException- if serialization fails
-
logRequest
-
logResponse
-
execute
-
executePost
-
executeGet
-
createRequestBuilder
-
getResponse
-
health
public ai.docling.serve.api.health.HealthCheckResponse health()- Specified by:
healthin interfaceai.docling.serve.api.DoclingServeApi
-
convertSource
public ai.docling.serve.api.convert.response.ConvertDocumentResponse convertSource(ai.docling.serve.api.convert.request.ConvertDocumentRequest request) - Specified by:
convertSourcein interfaceai.docling.serve.api.DoclingServeApi
-
chunkSourceWithHierarchicalChunker
public ai.docling.serve.api.chunk.response.ChunkDocumentResponse chunkSourceWithHierarchicalChunker(ai.docling.serve.api.chunk.request.HierarchicalChunkDocumentRequest request) - Specified by:
chunkSourceWithHierarchicalChunkerin interfaceai.docling.serve.api.DoclingServeApi
-
chunkSourceWithHybridChunker
public ai.docling.serve.api.chunk.response.ChunkDocumentResponse chunkSourceWithHybridChunker(ai.docling.serve.api.chunk.request.HybridChunkDocumentRequest request) - Specified by:
chunkSourceWithHybridChunkerin interfaceai.docling.serve.api.DoclingServeApi
-