Skip to main content


Sinapsis
Sinapsis Langchain Splitters

Split and aggregate document text using LangChain strategies.

Overview

sinapsis_langchain_splitters — Package that provides support for Langchain splitters module.

Chunk boundaries affect retrieval quality, search cost and model context usage. Exposing splitters as Templates makes chunking configurable and testable separately from the vector store or language model.

Where it fits

Select regex or language-aware splitting to match the content. Optional spacy or konlpy packages are not needed for every text-splitting strategy.

Installation

Requires Python 3.13 or later, as declared in this package’s manifest. Install the base distribution using your preferred package manager:

uv pip install sinapsis_langchain_splitters
# or
pip install sinapsis_langchain_splitters

Optional features and dependencies

The base installation includes the dependencies required by the package. The following extras are declared in this package’s pyproject.toml; install only those needed by your workflow. They are standard Python optional dependencies, not separate execution profiles.

Extra Adds / when to select it
spacy Spacy support. Dependencies: spacy
konlpy Konlpy support. Dependencies: konlpy
all Bundle declared by this package; its manifest includes konlpy, spacy.

For example:

uv pip install "sinapsis_langchain_splitters[spacy]"

The manifest also defines development-only dependency groups: dev (ruff, pre-commit). These support source development and testing and are not runtime extras.

Text splitting and dynamic wrappers

This package wraps splitters from langchain-text-splitters as dynamic Sinapsis Templates. Instead of maintaining a fixed implementation of each splitter, LangChainTextSplitterBase creates Template classes from the splitter constructors exposed by the installed library. This allows supported options to follow compatible upstream releases without duplicating every constructor signature in Sinapsis. New splitters still depend on the installed langchain-text-splitters version and the package's discovery filters.

The wrapper accepts text from a TextPacket or LangChain Document data carried under a configured generic_key. It outputs smaller chunks with source/context metadata for downstream embedding, search, classification and retrieval. Chunk boundaries affect retrieval quality: smaller chunks improve localisation but may lose context; larger chunks retain context at the cost of more input tokens and less precise matches.

Available approaches

  • RecursiveCharacterTextSplitterWrapper — recursive splitting over configurable separators. Appropriate for paragraphs and prose where maintaining natural boundaries matters.
  • RegexTurnSplitter — split a conversation or transcript on a regular expression matching turn boundaries.
  • PatternAggregatorSplitter — collect and aggregate matching text patterns for workflows that need grouped segments.
  • Other compatible dynamic splitter wrappers — generated from the installed LangChain splitter constructors.

Example: split long text into contextual chunks

Create my_text_splitter_agent.yaml:

agent:
  name: my_text_splitter_agent

templates:
  - template_name: Input
    class_name: InputTemplate
    attributes: {}

  - template_name: Text
    class_name: TextInput
    template_input: Input
    attributes:
      text: "A long document can contain multiple sections. Splitters keep retrieval chunks manageable."

  - template_name: Split
    class_name: RecursiveCharacterTextSplitterWrapper
    template_input: Text
    attributes:
      add_document_as_text_packet: true
      generic_key: null
      recursivecharactertextsplitter_init:
        chunk_size: 500
        chunk_overlap: 50
        separators: ["\n\n", "\n", " ", ""]
uv pip install sinapsis-data-readers
sinx jobs run my_text_splitter_agent.yaml

The TextInput Template comes from sinapsis-data-readers; install that package alongside this one for the example. For real documents, replace the text input with a document reader. Inspect sinx templates example-config RecursiveCharacterTextSplitterWrapper for the exact dynamically generated fields in your installed environment.

Template discovery and examples

The package exposes Template implementations including RegexTurnSplitter, PatternAggregatorSplitter.

Inspect the installed environment for the exact classes and validated attributes, then generate a starter configuration:

sinx templates show-all
sinx templates example-config RegexTurnSplitter

These commands inspect the installed Template set; some base classes are internal and cannot be instantiated as an Agent node.

Documentation

License

Sinapsis open-source components are available under your choice of the MIT License or the Apache License 2.0, unless otherwise noted.

Metadata

Release files for sinapsis_langchain_splitters 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sinapsis_langchain_splitters 1.0.0
File Size Uploaded Provenance Actions
sinapsis_langchain_splitters-1.0.0.tar.gz 194.8 kB Without provenance Details for sinapsis_langchain_splitters-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sinapsis_langchain_splitters 1.0.0
File Interpreter ABI Platform Actions
sinapsis_langchain_splitters-1.0.0-py3-none-any.whl Python 3 none any Details for sinapsis_langchain_splitters-1.0.0-py3-none-any.whl

Total release size: 209.7 kB

Release files / sinapsis_langchain_splitters-1.0.0.tar.gz

Download URL sinapsis_langchain_splitters-1.0.0.tar.gz
Size 194.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4447514834e80440ec946c395cbabc1ac6dd4985120ad279bd9107ee461a1331
BLAKE2b-256 checksum
How to use checksums
6b1be479907b40f44d1e72e3fcff8a748474ded8ee01d5abbc60f3b175a99940
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.17

Release files / sinapsis_langchain_splitters-1.0.0-py3-none-any.whl

Download URL sinapsis_langchain_splitters-1.0.0-py3-none-any.whl
Size 14.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
933930abd0e1ff2be07d2aac5a07f1150d11c86f6da0aa5e3a76d627d82f674d
BLAKE2b-256 checksum
How to use checksums
e435cbfcebb9a42e0a1998b14346c8e42046825ba147c38b006682e89ce53800
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.17

Security for sinapsis_langchain_splitters 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page