Add your description here
Project description
Sinapsis Langchain Splitters
Templates for easy integration of LangChain text splitters with Sinapsis.
🐍 Installation • 🚀 Features • 📚 Usage example • 📙 Documentation • 🔍 License
The sinapsis-langchain-splitters module adds support for all the text splitters supported by LangChain
🐍 Installation
Install using your package manager of choice. We encourage the use ofuv
Example with uv:
uv pip install sinapsis-langchain-splitters --extra-index-url https://pypi.sinapsis.tech
or with raw pip:
pip install sinapsis-langchain-splitters --extra-index-url https://pypi.sinapsis.tech
[!IMPORTANT] The langchain readers templates may require extra dependencies. For development, we recommend installing the package with all the optional dependencies:
uv pip install sinapsis-langchain-readers[all] --extra-index-url https://pypi.sinapsis.tech
[!IMPORTANT] Some langchain templates require additional system dependencies. Please refer to the official LangChain Document Loaders documentation for additional requirements.
🚀 Features
Templates Supported
The Sinapsis Langchain module provides wrapper templates for Langchain's community data loaders, making them seamlessly usable within Sinapsis.
[!NOTE] Each loader template supports one attribute:
add_document_as_text_packet(bool, default:False): Whether to add the loaded document as a text packet. Other attributes can be dynamically assigned through the class initialization dictionary (class init attributes).
[!TIP] Use CLI command
sinapsis info --all-template-namesto show a list with all the available Template names installed with Sinapsis Langchain.
[!TIP] Use CLI command
sinapsis info --example-template-config TEMPLATE_NAMEto produce an example Agent config for the Template specified in TEMPLATE_NAME.
For example, for WikipediaLoaderWrapper use sinapsis info --example-template-config WikipediaLoaderWrapper to produce the following example config:
agent:
name: my_test_agent
description: Agent to split text using the RecursiveCharacterTextSplitter class from LangChain
templates:
- template_name: InputTemplate
class_name: InputTemplate
attributes: {}
- template_name: RecursiveCharacterTextSplitterWrapper
class_name: RecursiveCharacterTextSplitterWrapper
template_input: InputTemplate
attributes:
add_document_as_text_packet: false
generic_key: WikipediaLoaderWrapper
recursivecharactertextsplitter_init:
separators: [" "]
keep_separator: true
is_separator_regex: false
A complete list of available document loader classes in LangChain can be found at: LangChain Text Splitters
📚 Usage example
The following example demonstrates how to use the RecursiveCharacterTextSplitterWrapper template to chunk the Documents from a WikipediaLoaderWrapper template.
configuration
agent:
name: my_test_agent
description: "Wikipedia loader example"
templates:
- template_name: InputTemplate
class_name: InputTemplate
attributes: {}
- template_name: WikipediaLoaderWrapper
class_name: WikipediaLoaderWrapper
template_input: InputTemplate
attributes:
add_document_as_text_packet: false
wikipedialoader_init:
query: GenAI
lang: en
load_max_docs: 1
load_all_available_meta: false
doc_content_chars_max: 4000
- template_name: InputTemplate
class_name: WikipediaLoaderWrapper
attributes: {}
- template_name: RecursiveCharacterTextSplitterWrapper
class_name: RecursiveCharacterTextSplitterWrapper
template_input: InputTemplate
attributes:
add_document_as_text_packet: false
generic_key: WikipediaLoaderWrapper
recursivecharactertextsplitter_init:
separators: null
keep_separator: true
is_separator_regex: false
To run, simply use:
sinapsis run name_of_the_config.yml
📙 Documentation
Documentation for this and other sinapsis packages is available on the sinapsis website
Tutorials for different projects within sinapsis are available at sinapsis tutorials page
🔍 License
This project is licensed under the AGPLv3 license, which encourages open collaboration and sharing. For more details, please refer to the LICENSE file.
For commercial use, please refer to our official Sinapsis website for information on obtaining a commercial license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sinapsis_langchain_splitters-0.1.4.tar.gz.
File metadata
- Download URL: sinapsis_langchain_splitters-0.1.4.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d445f82682f3a215fa75e72ce6d7fb491688f7b53645a0b2de5c36d63b22a15d
|
|
| MD5 |
3fcb98594b6aa4e638d0a240f59c4afd
|
|
| BLAKE2b-256 |
8e8eb78594271bcd2a6ac5c94fb0bd02c9b5f1686c728deffc9a5635ccf6fc8b
|
File details
Details for the file sinapsis_langchain_splitters-0.1.4-py3-none-any.whl.
File metadata
- Download URL: sinapsis_langchain_splitters-0.1.4-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
55b35a9587b74929f7931f33c92908fe920e1e3aabe4d7e5849f9060d6bb5382
|
|
| MD5 |
1bb6f542dc53ae1c65a2d4782a54d7fd
|
|
| BLAKE2b-256 |
91ea83770be8e77fa3d37de27263c0b277e5bb2c9271a07ee79911addd262d2f
|