Skip to main content

Sinapsis module that adds support for the Langchain library

Project description



Sinapsis Langchain

Templates for seamless integration of LangChain frameword.

🐍 Installation🚀 Packages📚 Usage example📙 Documentation 🔍 License

The sinapsis-langchain module adds support for the Langchain framework, in particular, Langchain community data loaders and text splitters.

We add support for the following packages:

* sinapsis-langchain-readers

* sinapsis-langchain-splitters

🐍 Installation

Install using your package manager of choice. We encourage the use of uv

Example with uv:

  uv pip install sinapsis-langchain-readers --extra-index-url https://pypi.sinapsis.tech

or with raw pip:

  pip install sinapsis-langchain-readers --extra-index-url https://pypi.sinapsis.tech

[!NOTE] Change the name of the package accordingly

[!IMPORTANT] The langchain 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.

[!NOTE] Change the name of the package accordingly

[!TIP] you can also install the full mono repo

  uv pip install sinapsis-langchain[all] --extra-index-url https://pypi.sinapsis.tech

🚀 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-names to show a list with all the available Template names installed with Sinapsis Langchain.

[!TIP] Use CLI command sinapsis info --example-template-config TEMPLATE_NAME to 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: agent to load Wikipedia documents using WikipediaLoaderWrapper template
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: the query for wikipedia
        lang: en
        load_max_docs: 5000
        load_all_available_meta: False
        doc_content_chars_max: 4000,

A complete list of available document loader classes in LangChain can be found at: LangChain Community Document Loaders

🚫 Excluded Loaders

Some base classes or loaders that required additional configuration have been excluded and support for this will be included in future releases.

  • Blob
  • BlobLoader
  • OracleTextSplitter
  • OracleDocLoader
  • TrelloLoaderExecute
  • TwitterTweetLoader
  • TrelloLoader
  • GoogleApiYoutubeLoader
  • GoogleApiClient
  • DiscordChatLoader
  • AssemblyAIAudioTranscriptLoader
  • ArcGISLoader

For all other supported loaders, refer to the LangChain API reference linked above.

📚 Usage example

The following example demonstrates how to use the WikipediaLoaderWrapper template for loading documents from Wikipedia within Sinapsis. Below is the full YAML configuration, followed by a breakdown of each component.

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

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sinapsis_langchain-0.2.2.tar.gz (44.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sinapsis_langchain-0.2.2-py3-none-any.whl (33.4 kB view details)

Uploaded Python 3

File details

Details for the file sinapsis_langchain-0.2.2.tar.gz.

File metadata

  • Download URL: sinapsis_langchain-0.2.2.tar.gz
  • Upload date:
  • Size: 44.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.16

File hashes

Hashes for sinapsis_langchain-0.2.2.tar.gz
Algorithm Hash digest
SHA256 c571adedbbd2e6d48607b9f3d0b1ea9f5d0e61849f962180f6a0100766f1ba9d
MD5 96cb9ac5f61657d2e68e48fa06407d25
BLAKE2b-256 b9147f7743436c5c62e4307359386152a11a63d7e6e8c715130ac6dd88a79bf0

See more details on using hashes here.

File details

Details for the file sinapsis_langchain-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for sinapsis_langchain-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 63152057fb50f1137581d18c16a0297e438a3b06f76d671aa55f2ea057dcf081
MD5 31e65efe413f99daca288ddf959540f0
BLAKE2b-256 fa5b14bea2fd74181fe05e086be6fd8f5d31ba3e69e02c91b00c4dc21fc2bfed

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page