Package ai.docling.serve.api
Interface DoclingServeApi.DoclingApiBuilder<T extends DoclingServeApi,B extends DoclingServeApi.DoclingApiBuilder<T,B>>
- Type Parameters:
T- the type of theDoclingServeApiimplementation being built.B- the type of the concrete builder implementation.
- Enclosing interface:
- DoclingServeApi
public static interface DoclingServeApi.DoclingApiBuilder<T extends DoclingServeApi,B extends DoclingServeApi.DoclingApiBuilder<T,B>>
A builder interface for constructing implementations of
DoclingServeApi. This interface
supports a fluent API for setting configuration properties before building an instance.-
Method Summary
Modifier and TypeMethodDescriptionSets the API key for authenticating requests made by the client being built.asyncPollInterval(Duration asyncPollInterval) Sets the polling interval for async operations.asyncTimeout(Duration asyncTimeout) Sets the timeout for async operations.build()Builds and returns an instance of the specified type, representing the completed configuration of the builder.default BEnables logging of requests for the API client being built.logRequests(boolean logRequests) Configures whether logging of API requests is enabled or not.default BEnables logging of responses for the API client being built.logResponses(boolean logResponses) Configures whether logging of API responses is enabled or not.default BConfigures the API client to format JSON requests and responses in a "pretty" format.prettyPrint(boolean prettyPrint) Configures whether the API client should format JSON requests and responses in a "pretty" format.
-
Method Details
-
apiKey
Sets the API key for authenticating requests made by the client being built. The provided API key will be used as a credential to authorize and authenticate API requests. This method updates the configuration of the builder with the specified API key and ensures that the API client includes it in its requests as required for secure access to the API.- Parameters:
apiKey- the API key to be used for authenticating API requests- Returns:
thisbuilder instance for fluent API usage
-
logRequests
Enables logging of requests for the API client being built. This can be useful for debugging or monitoring the behavior of requests made to the API.This method influences the logging behavior of requests initiated by the client without specifying further configuration details.
- Returns:
thisbuilder instance for fluent API usage.
-
logRequests
Configures whether logging of API requests is enabled or not. Logging can help monitor or debug request communications with the API.- Parameters:
logRequests-trueto enable request logging;falseto disable it.- Returns:
thisbuilder instance for fluent API usage.
-
logResponses
Enables logging of responses for the API client being built. This can assist in debugging or monitoring the behavior of responses received from the API.- Returns:
thisbuilder instance for fluent API usage.
-
logResponses
Configures whether logging of API responses is enabled or not. Logging can help monitor or debug the responses received from the API.- Parameters:
logResponses-trueto enable response logging;falseto disable it.- Returns:
thisbuilder instance for fluent API usage.
-
prettyPrint
Configures whether the API client should format JSON requests and responses in a "pretty" format. Pretty formatting organizes the response data to improve readability, typically by adding spacing and line breaks. This setting does not affect the functional content of the response but can assist with debugging or human-readable output for development purposes.- Parameters:
prettyPrint-trueto enable pretty-printing of JSON requests and responses;falseto use compact formatting.- Returns:
thisbuilder instance for fluent API usage.
-
prettyPrint
Configures the API client to format JSON requests and responses in a "pretty" format. Pretty formatting improves readability by including spacing and line breaks.- Returns:
thisbuilder instance for fluent API usage.
-
asyncPollInterval
Sets the polling interval for async operations.This configures how frequently the client will check the status of async conversion tasks when using
DoclingServeConvertApi.convertSourceAsync(ConvertDocumentRequest)(ConvertDocumentRequest)}.- Parameters:
asyncPollInterval- the polling interval (must not be null or negative)- Returns:
- this builder instance for method chaining
- Throws:
IllegalArgumentException- if asyncPollInterval is null or negative
-
asyncTimeout
Sets the timeout for async operations.This configures the maximum time to wait for an async conversion task to complete when using
DoclingServeConvertApi.convertSourceAsync(ConvertDocumentRequest)(ConvertDocumentRequest)}.- Parameters:
asyncTimeout- the timeout duration (must not be null or negative)- Returns:
- this builder instance for method chaining
- Throws:
IllegalArgumentException- if asyncTimeout is null or negative
-
build
T build()Builds and returns an instance of the specified type, representing the completed configuration of the builder. The returned instance is typically an implementation of the Docling API.- Returns:
- an instance of type
Trepresenting a configured Docling API client.
-