ComfyUI > Nodes > ComfyUI-Documents > Chunk Router

ComfyUI Node: Chunk Router

Class Name

ChunkRouter

Category
document_processing
Author
Indra's Mirror (Account age: 37days)
Extension
ComfyUI-Documents
Latest Updated
2024-07-11
Github Stars
0.02K

How to Install ComfyUI-Documents

Install this extension via the ComfyUI Manager by searching for ComfyUI-Documents
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI-Documents in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • High-speed GPU machines
  • 200+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 50+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Chunk Router Description

Efficiently extract and route specific text/data chunks for focused processing in document workflows.

Chunk Router:

The ChunkRouter node is designed to facilitate the selection and routing of specific chunks of text or data from a larger set of chunks. This node is particularly useful in document processing workflows where you need to isolate and work with specific segments of text or data. By allowing you to specify an index, the ChunkRouter node can efficiently extract the desired chunk, making it easier to manage and manipulate large documents or datasets. This functionality is essential for tasks that require focused processing on particular sections of a document, such as text analysis, data extraction, or content generation.

Chunk Router Input Parameters:

chunks

This parameter represents the collection of text or data chunks from which a specific chunk will be selected. It is a required input and must be provided as a string. The chunks parameter is crucial because it defines the pool of data from which the node will extract the desired segment.

indices

This parameter is an integer that represents the indices of the chunks. It is a required input and must be provided as an integer. The indices parameter helps in identifying the position of each chunk within the collection, ensuring that the correct chunk is selected based on the specified index.

selected_index

This parameter is an integer that specifies the index of the chunk to be selected from the collection. It has a default value of 0 and can range from a minimum of 0 to a maximum of 1000. The selected_index parameter is essential for pinpointing the exact chunk you want to extract, allowing for precise control over the data selection process.

Chunk Router Output Parameters:

selected_chunk

This output parameter is a string that contains the chunk of text or data selected based on the specified index. The selected_chunk is the result of the node's operation and represents the specific segment of the original collection that you wanted to isolate. This output is crucial for subsequent processing steps that require focused attention on a particular chunk of data.

Chunk Router Usage Tips:

  • Ensure that the selected_index parameter is within the valid range of the chunks collection to avoid errors.
  • Use the ChunkRouter node in conjunction with nodes like TextChunker to first divide a large document into manageable chunks before selecting specific segments for further processing.
  • When working with large datasets, verify the indices to ensure that the correct chunk is being selected, especially if the dataset is dynamically generated or modified.

Chunk Router Common Errors and Solutions:

Selected index <selected_index> is out of range. Available chunks: <number_of_chunks>

  • Explanation: This error occurs when the selected_index parameter is set to a value that is outside the range of the available chunks.
  • Solution: Ensure that the selected_index is within the valid range, which is from 0 to the number of available chunks minus one. Adjust the selected_index parameter accordingly to match the range of your chunks collection.

Chunk Router Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI-Documents
RunComfy

© Copyright 2024 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals.