Skip to main content
For the complete documentation index for agents and LLMs, see llms.txt.

TextSplitter

Split a text string into a list of strings.

Work in Progress

We're working on adding pipeline examples and most common component connections.

Key Features

  • Accepts a text string as input and splits it into a list of strings.

Configuration

  1. Drag the TextSplitter component onto the canvas from the Component Library.
  2. Click on the component to open the configuration panel.
  3. On the General tab, no configuration is required.

Connections

TextSplitter accepts a sentence string as input. Connect it to any component that outputs a string.

It outputs a list of strings as output. Connect it to any downstream component that accepts a list of strings.

Source Code

To check this component's source code, open text_splitter.py in the Haystack repository.

Usage Examples

Basic Configuration

  TextSplitter:
type: testing.sample_components.text_splitter.TextSplitter
init_parameters: {}
components:
TextSplitter:
type: testing.sample_components.text_splitter.TextSplitter
init_parameters:

Parameters

Inputs

ParameterTypeDefaultDescription
sentencestrThe text string to split.

Outputs

ParameterTypeDefaultDescription
outputList[str]The list of string segments.

Init Parameters

These are the parameters you can configure in Pipeline Builder:

ParameterTypeDefaultDescription

Run Method Parameters

These are the parameters you can configure for the component's run() method. This means you can pass these parameters at query time through the API, in Playground, or when running a job. For details, see Modify Pipeline Parameters at Query Time.

ParameterTypeDefaultDescription
sentencestrThe text string to split.