docling-java icon indicating copy to clipboard operation
docling-java copied to clipboard

Enhance ConvertDocumentRequest hierarchy

Open edeandrea opened this issue 3 months ago • 0 comments

Looking at the ChunkDocumentRequest vs BatchConvertDocumentRequest vs ConvertDocumentRequest object hierarchies - they all have very similar structures. They all have

  @JsonProperty("sources")
  @JsonSetter(nulls = Nulls.AS_EMPTY)
  @lombok.Singular
  private List<Source> sources;

  /**
   * Specification for the type of output target.
   *
   * @param target the output target specification, or null if not specified
   * @return the output target specification, or null if not specified
   */
  @JsonProperty("target")
  @Nullable
  private Target target;

There are places, like in LangChain4j's DoclingDocumentParser where I want to be able to call either the convert or the chunk endpoint depending on what the request looks like.

I'm thinking of introducing a layer called DocumentRequest, move the sources and target properties up to that, and then have ChunkDocumentRequest, BatchDocumentRequest, and ConvertDocumentRequest extends from it.

Thoughts @ThomasVitale ?

edeandrea avatar Aug 12 '26 20:08 edeandrea