Skip to content

Enhance ConvertDocumentRequest hierarchy #632

Description

@edeandrea

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 ?

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions