-
Notifications
You must be signed in to change notification settings - Fork 271
Add langchain_text_splitters #1947
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
bgruening
merged 24 commits into
bgruening:master
from
IvoLeist:add-langchain_text_splitters
Sep 3, 2026
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
71524aa
Add langchain_text_splitters
IvoLeist a50e821
Address first langchain_text_splitters code reviews
IvoLeist d9c7977
langchain_text_splitters: fix output correctness issues found in review
arash77 b46322d
Merge pull request #2 from arash77/langchain-text-splitters-review-fixes
IvoLeist e1dd4a7
New TextSplitter POC
IvoLeist d80e5c7
Add test cases for NLTK and spaCy splitters - Tests 11, 12 and 14 are…
IvoLeist 9b7191f
langchain_text_splitters: fix the failing sentence splitter tests
arash77 9aee392
Merge pull request #4 from arash77/langchain-text-splitters-sentence-…
IvoLeist 6b3338c
langchain_text_splitters: separate the chunk diagnostics and harden t…
arash77 f97dd61
Merge pull request #3 from arash77/langchain-text-splitters-round-2
IvoLeist 47dba87
langchain_text_splitters: add nltk_data as requirement
IvoLeist 2516433
langchain_text_splitters:
IvoLeist 1c5464e
langchain_text_splitters: fix whitespace handling in the sentence spl…
arash77 850231d
Merge pull request #5 from arash77/langchain-text-splitters-whitespac…
IvoLeist 0c7213d
- allow strip_whitespace for the NLTK splitter
IvoLeist 4331ee4
langchain_text_splitters: stop before Galaxy's dataset limit and fix …
arash77 09ebe0d
Merge pull request #6 from arash77/langchain-text-splitters-round-3
IvoLeist 7d4ccfa
langchain_text_splitters: cover both branches of altered_text_cause
arash77 55b76de
Merge pull request #7 from arash77/langchain-text-splitters-tests
IvoLeist f9a43c0
langchain_text_splitters: readd disclaimer that we are not using lan…
IvoLeist c00d207
fix: correct typo in langchain text splitter helptextt
IvoLeist 4a7f94c
Remove trailing whitespace in help text + add empty new line in .shed…
IvoLeist a598a18
Remove trailing whitespace
IvoLeist 6cdb142
Merge branch 'master' into add-langchain_text_splitters
IvoLeist File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| name: langchain_text_splitters | ||
| owner: bgruening | ||
| description: Split text into chunks using LangChain text splitters. | ||
| long_description: | | ||
| Split plain-text-like datasets into chunks for LLM and RAG workflows using | ||
| langchain-text-splitters. The tool currently supports recursive character, character, | ||
| sentence-based splitting with NLTK or spaCy, and tiktoken-based token splitting, | ||
| and reports per-chunk lengths and start offsets as both readable text and | ||
| structured JSON. | ||
| type: unrestricted | ||
| categories: | ||
| - Natural Language Processing | ||
| remote_repository_url: https://github.com/bgruening/galaxytools/tree/master/tools/langchain_text_splitters | ||
| homepage_url: https://github.com/langchain-ai/langchain/tree/master/libs/text-splitters | ||
| auto_tool_repositories: | ||
| name_template: "{{ tool_id }}" | ||
| description_template: "Wrapper for: {{ tool_name }}" |
1,629 changes: 1,629 additions & 0 deletions
1,629
tools/langchain_text_splitters/langchain_text_splitters.xml
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,153 @@ | ||
| <macros> | ||
| <token name="@TOOL_VERSION@">1.1.2</token> | ||
| <token name="@VERSION_SUFFIX@">0</token> | ||
| <token name="@PROFILE@">25.1</token> | ||
| <!-- Expects $tiktoken_options to be set to the section holding the tokenizer settings. --> | ||
| <token name="@TIKTOKEN_ARGS@"><![CDATA[ | ||
| #if str($tiktoken_options.tokenizer.tokenizer_selection_method) == "model" | ||
| --model-name '$tiktoken_options.tokenizer.model_name' | ||
| #else | ||
| --encoding-name '$tiktoken_options.tokenizer.encoding_name' | ||
| #end if | ||
| --allowed-special '$tiktoken_options.allowed_special' | ||
| ]]></token> | ||
| <xml name="requirements"> | ||
| <requirements> | ||
| <requirement type="package" version="@TOOL_VERSION@">langchain-text-splitters</requirement> | ||
| <requirement type="package" version="0.13.0">tiktoken</requirement> | ||
| <requirement type="package" version="3.10.1">nltk</requirement> | ||
| <requirement type="package" version="2026.07.01">nltk_data</requirement> | ||
| <requirement type="package" version="3.8.14">spacy</requirement> | ||
| <requirement type="package" version="3.8.0">spacy-model-en_core_web_sm</requirement> | ||
| <!-- python-gil required for nltk --> | ||
| <requirement type="package" version="3.12.13">python-gil</requirement> | ||
| </requirements> | ||
| </xml> | ||
| <xml name="creators"> | ||
| <creator> | ||
| <person givenName="Ivo Christopher" familyName="Leist" email="leist@informatik.uni-freiburg.de" identifier="https://orcid.org/0000-0002-9772-443X"/> | ||
| <person givenName="Arash" familyName="Kadkhodaei" url="http://github.com/arash77" identifier="https://orcid.org/0009-0006-2228-8123"/> | ||
| <organization name="AI4SOCIAL+" url="https://cordis.europa.eu/project/id/101292886"/> | ||
| </creator> | ||
| </xml> | ||
| <xml name="strip_whitespace" token_checked="true"> | ||
| <param name="strip_whitespace" type="boolean" checked="@CHECKED@" truevalue="--strip-whitespace" falsevalue="" label="Strip whitespace around chunks" help="Remove leading and trailing whitespace from each generated chunk. Whitespace within chunks is preserved."/> | ||
| </xml> | ||
| <xml name="separator_definition"> | ||
| <conditional name="separator_definition"> | ||
| <param name="sep_opt" type="select" label="Separator"> | ||
| <option value="paragraph_break" selected="true">Paragraph break (\n\n)</option> | ||
| <option value="line_break">Line break (\n)</option> | ||
| <option value="tab">Tab (\t)</option> | ||
| <option value="space">Space</option> | ||
| <option value="ascii_full_stop">ASCII full stop (.)</option> | ||
| <option value="ascii_comma">ASCII comma (,)</option> | ||
| <option value="ascii_semicolon">ASCII semicolon (;)</option> | ||
| <option value="zero_width_space">Zero-width space</option> | ||
| <option value="fullwidth_comma">Fullwidth comma</option> | ||
| <option value="ideographic_comma">Ideographic comma</option> | ||
| <option value="fullwidth_full_stop">Fullwidth full stop</option> | ||
| <option value="ideographic_full_stop">Ideographic full stop</option> | ||
| <option value="custom">Custom separator</option> | ||
| </param> | ||
| <when value="paragraph_break"/> | ||
| <when value="line_break"/> | ||
| <when value="tab"/> | ||
| <when value="space"/> | ||
| <when value="ascii_full_stop"/> | ||
| <when value="ascii_comma"/> | ||
| <when value="ascii_semicolon"/> | ||
| <when value="zero_width_space"/> | ||
| <when value="fullwidth_comma"/> | ||
| <when value="ideographic_comma"/> | ||
| <when value="fullwidth_full_stop"/> | ||
| <when value="ideographic_full_stop"/> | ||
| <when value="custom"> | ||
| <param name="value" type="text" label="Custom separator" help="Enter a custom separator or separator sequence with its respective escape e.g. \n, \t, or \u3002"> | ||
| <!-- Characters that are neither listed here nor mapped by Galaxy are silently replaced | ||
| by an X, which would split the text at the wrong places. The validator below rejects | ||
| them instead, so that the user is pointed at the escape syntax. --> | ||
| <sanitizer> | ||
| <valid initial="default"> | ||
| <add value="\"/> | ||
| <add value="#"/> | ||
| <add value="|"/> | ||
| <add value=";"/> | ||
| <add value="~"/> | ||
| <add value="%"/> | ||
| <add value="&"/> | ||
| <add value="$"/> | ||
| <add value="@"/> | ||
| <add value="<"/> | ||
| <add value=">"/> | ||
| <add value="""/> | ||
| <add value="["/> | ||
| <add value="]"/> | ||
| <add value="{"/> | ||
| <add value="}"/> | ||
| </valid> | ||
| </sanitizer> | ||
| <validator type="empty_field" message="Enter a custom separator."/> | ||
| <validator type="regex" message="This separator contains a character that Galaxy cannot pass on unchanged, for example a letter outside the ASCII range or an apostrophe. Write such a character as an escape instead, for example \u3002 for the ideographic full stop.">^[A-Za-z0-9 \-=_.()/+*^,:?!\\#|;~%&$@<>"\[\]{}]+\Z</validator> | ||
| </param> | ||
| </when> | ||
| </conditional> | ||
| </xml> | ||
| <xml name="tiktoken_options"> | ||
| <section name="tiktoken_options" title="Tokenization options" help="tiktoken is used to determine the number of tokens in a chunk. The OpenAI encoding and model name can be specified to ensure the token count is accurate for the downstream LLM workflow."> | ||
| <conditional name="tokenizer"> | ||
| <param name="tokenizer_selection_method" type="select" label="Select tokenizer by" help="Choose an encoding directly or select a model whose associated encoding should be determined by tiktoken."> | ||
| <option value="encoding" selected="true">Encoding name</option> | ||
| <option value="model">Model name</option> | ||
| </param> | ||
| <when value="encoding"> | ||
| <param name="encoding_name" type="select" label="Encoding"> | ||
| <option value="o200k_harmony">o200k_harmony</option> | ||
| <option value="o200k_base">o200k_base</option> | ||
| <option value="cl100k_base">cl100k_base</option> | ||
| <option value="p50k_edit">p50k_edit</option> | ||
| <option value="p50k_base">p50k_base</option> | ||
| <option value="r50k_base">r50k_base</option> | ||
| <option value="gpt2" selected="true">gpt2</option> | ||
| </param> | ||
| </when> | ||
| <when value="model"> | ||
| <param name="model_name" type="select" label="Model"> | ||
| <option value="o4-mini">o4-mini (reasoning)</option> | ||
| <option value="o3">o3 (reasoning)</option> | ||
| <option value="o1">o1 (reasoning)</option> | ||
| <option value="gpt-5" selected="true">gpt-5 (chat)</option> | ||
| <option value="gpt-4.1">gpt-4.1 (chat)</option> | ||
| <option value="gpt-4o">gpt-4o (chat)</option> | ||
| <option value="gpt-4">gpt-4 (chat)</option> | ||
| <option value="gpt-3.5-turbo">gpt-3.5-turbo (chat)</option> | ||
| <option value="gpt-3.5">gpt-3.5 (chat)</option> | ||
| <option value="gpt-35-turbo">gpt-35-turbo (chat)</option> | ||
| <option value="davinci-002">davinci-002 (base)</option> | ||
| <option value="babbage-002">babbage-002 (base)</option> | ||
| <option value="text-embedding-ada-002">text-embedding-ada-002 (embedding)</option> | ||
| <option value="text-embedding-3-small">text-embedding-3-small (embedding)</option> | ||
| <option value="text-embedding-3-large">text-embedding-3-large (embedding)</option> | ||
| </param> | ||
| </when> | ||
| </conditional> | ||
| <param name="allowed_special" type="select" label="Special token handling"> | ||
| <option value="none" selected="true">Reject special token strings</option> | ||
| <option value="all">Allow all special token strings</option> | ||
| </param> | ||
| </section> | ||
| </xml> | ||
| <xml name="chunk_params" token_size_label="Target chunk size" token_size_help="Desired chunk size, might be exceeded when the text between two separators is already larger than the target." token_overlap_label="Chunk overlap" token_overlap_help="Especially useful for retrieval-augmented generation (RAG) workflows, where overlapping text can help preserve context across chunk boundaries."> | ||
| <param name="chunk_size" type="integer" value="4000" min="1" label="@SIZE_LABEL@" help="@SIZE_HELP@"/> | ||
| <param name="chunk_overlap" type="integer" value="0" min="0" label="@OVERLAP_LABEL@" help="@OVERLAP_HELP@"/> | ||
| </xml> | ||
| <!-- Macros for testing --> | ||
| <xml name="assert_chunks_tsv" token_min_lines="2"> | ||
| <output name="chunks_tsv"> | ||
| <assert_contents> | ||
| <has_n_columns n="3"/> | ||
| <has_n_lines min="@MIN_LINES@"/> | ||
| </assert_contents> | ||
| </output> | ||
| </xml> | ||
| </macros> | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.