The output of a task is encapsulated in an OutputResponse, which contains a list of chunks. Each chunk is a collection of one or more segments.

The grouping of segments into chunks depends on the target_chunk_length parameter. Click here to learn more about how to configure it.

Output Response

The OutputResponse struct is the main output of a task. It is defined as:

#[derive(Serialize, Deserialize, Debug, Clone, ToSchema)]
pub struct OutputResponse {
    pub chunks: Vec<Chunk>,
    pub extracted_json: Option<ExtractedJson>,
}
  • chunks: This is a vector of Chunk objects, representing the output of a task.
  • extracted_json: This is an optional field that may contain additional extracted JSON data.

Chunk Model

The Chunk model represents a collection of segments. It consists of:

#[derive(Serialize, Deserialize, Debug, Clone, ToSchema)]
pub struct Chunk {
    pub segments: Vec<Segment>,
    pub chunk_length: i32,
}
  • segments: This is a vector of Segment objects that make up the chunk.
  • chunk_length: This is an integer representing the actual length of the chunk, i.e., the number of words in the chunk. This may differ from the target_chunk_length as segments are not split into smaller segments.

Segments

This will contain an array of segments that make up the chunk.

Chunk Length

This will contain the actual length of the chunk, i.e., the number of words in the chunk. This may be different from the target_chunk_length as the segments are not split into smaller segments.