Mono repo with packages for text completion tasks
Project description
sinapsis-chatbots
A comprehensive monorepo for building and deploying AI-driven chatbots with support for multiple large language models
🐍 Installation • 📦 Packages • 🌐 Webapps 📙 Documentation • 🔍 License
The sinapsis-chatbots module is a powerful toolkit designed to simplify the development of AI-driven chatbots and Retrieval-Augmented Generation (RAG) systems. It provides ready-to-use templates and utilities for configuring and running large language model (LLM) applications, enabling developers to integrate a wide range of LLM models with ease for natural, intelligent interactions.
[!IMPORTANT] We now include support for Llama4 models!
To use them, install the dependency (if you have not installed sinapsis-llama-cpp[all])
uv pip install sinapsis-llama-cpp[llama-four] --extra-index-url https://pypi.sinapsis.tech
You need a HuggingFace token. See the official instructions and set it using
export HF_TOKEN=<token-provided-by-hf>
and test it through the cli or the webapp by changing the AGENT_CONFIG_PATH
[!NOTE] Llama 4 requires large GPUs to run the models. Nonetheless, running on smaller consumer-grade GPUs is possible, although a single inference may take hours
🐍 Installation
This mono repo includes packages for AI-driven chatbots using various LLM frameworks through:
sinapsis-anthropicsinapsis-chatbots-basesinapsis-llama-cppsinapsis-llama-indexsinapsis-mem0sinapsis-vllm
Install using your preferred package manager. We strongly recommend using uv. To install uv, refer to the official documentation.
Install with uv:
uv pip install sinapsis-llama-cpp --extra-index-url https://pypi.sinapsis.tech
Or with raw pip:
pip install sinapsis-llama-cpp --extra-index-url https://pypi.sinapsis.tech
Replace sinapsis-llama-cpp with the name of the package you intend to install.
[!IMPORTANT] Templates in each package may require extra dependencies. For development, we recommend installing the package with all the optional dependencies:
With uv:
uv pip install sinapsis-llama-cpp[all] --extra-index-url https://pypi.sinapsis.tech
Or with raw pip:
pip install sinapsis-llama-cpp[all] --extra-index-url https://pypi.sinapsis.tech
Be sure to substitute sinapsis-llama-cpp with the appropriate package name.
[!TIP] You can also install all the packages within this project:
uv pip install sinapsis-chatbots[all] --extra-index-url https://pypi.sinapsis.tech
📦 Packages
This repository is structured into modular packages, each facilitating the integration of AI-driven chatbots with various LLM frameworks. These packages provide flexible and easy-to-use templates for building and deploying chatbot solutions. Below is an overview of the available packages:
Sinapsis Anthropic
This package offers a suite of templates and utilities for building text-to-text and image-to-text conversational chatbots using Anthropic's Claude models.
-
AnthropicTextGeneration: Template for text and code generation with Claude models using the Anthropic API.
-
AnthropicMultiModal: Template for multimodal chat processing using Anthropic's Claude models.
For specific instructions and further details, see the README.md.
Sinapsis Chatbots Base
This package provides core functionality for LLM chat completion tasks.
- QueryContextualizeFromFile: Template that adds a certain context to the query searching for keywords in the Documents added in the generic_data field of the DataContainer
For specific instructions and further details, see the README.md.
Sinapsis llama-cpp
This package offers a suite of templates and utilities for running LLMs using llama-cpp.
-
LLama4MultiModal: Template for multi modal chat processing using the LLama 4 model.
-
LLaMATextCompletion: Configures and initializes a chat completion model, supporting LLaMA, Mistral, and other compatible models. Supports structured outputs via
response_format. -
StreamingLLaMATextCompletion: Streaming version of LLaMATextCompletion for real-time response generation.
-
LLama4TextToText: Template for text-to-text chat processing using the LLama 4 model.
For specific instructions and further details, see the README.md.
Sinapsis llama-index
Package with support for various llama-index modules for text completion. This includes making calls to llms, processing and generating embeddings and Nodes, etc.
-
CodeEmbeddingNodeGenerator: Template to generate nodes for a code base.
-
EmbeddingNodeGenerator: Template for generating text embeddings using the HuggingFace model.
-
LLaMAIndexInsertNodes: Template for inserting embeddings (nodes) into a PostgreSQL vector database using the LlamaIndex
PGVectorStoreto store vectorized data. -
LLaMAIndexNodeRetriever: Template for retrieving nodes from a database using embeddings.
-
LLaMAIndexRAGTextCompletion: Template for configuring and initializing a LLaMA-based Retrieval-Augmented Generation (RAG) system.
For specific instructions and further details, see the README.md.
Sinapsis Mem0
This package provides persistent memory functionality for Sinapsis agents using Mem0, supporting both managed (Mem0 platform) and self-hosted backends.
- Mem0Add: Ingests and stores prompts, responses, and facts into memory.
- Mem0Get: Retrieves individual or grouped memory records.
- Mem0Search: Fetches relevant memories and injects them into the current prompt.
- Mem0Delete: Removes stored memories selectively or in bulk.
- Mem0Reset: Fully clears memory within a defined scope.
For specific instructions and further details, see the README.md.
Sinapsis vLLM
This package offers a suite of templates for running LLMs using vLLM, a high-throughput and memory-efficient inference engine for serving large language models.
-
vLLMTextCompletion: Template for text completion using vLLM with support for structured outputs.
-
vLLMBatchTextCompletion: Template for batched text completion using vLLM's continuous batching engine. Processes multiple conversations in a single batch for improved throughput.
-
vLLMStreamingTextCompletion: Streaming version of vLLMTextCompletion for real-time response generation.
-
vLLMMultiModal: Template for multimodal (text + image) completion using vLLM. Supports vision-language models like Qwen-VL.
For specific instructions and further details, see the README.md.
🌐 Webapps
The webapps included in this project showcase the modularity of the templates, in this case for AI-driven chatbots.
[!IMPORTANT] To run the app you first need to clone this repository:
git clone git@github.com:Sinapsis-ai/sinapsis-chatbots.git
cd sinapsis-chatbots
[!NOTE] If you'd like to enable external app sharing in Gradio,
export GRADIO_SHARE_APP=True
[!IMPORTANT] You can change the model name and the number of gpu_layers used by the model in case you have an Out of Memory (OOM) error.
[!IMPORTANT] Anthropic requires an API key to interact with the API. To get started, visit the official website to create an account. If you already have an account, go to the API keys page to generate a token.
[!IMPORTANT] Set your API key env var using
export ANTHROPIC_API_KEY='your-api-key'
[!NOTE] Agent configuration can be changed through the
AGENT_CONFIG_PATHenv var. You can check the available configurations in each package configs folder.
🐳 Docker
IMPORTANT: This Docker image depends on the sinapsis-nvidia:base image. For detailed instructions, please refer to the Sinapsis README.
- Build the sinapsis-chatbots image:
docker compose -f docker/compose.yaml build
- Start the app container
- For Anthropic text-to-text chatbot:
docker compose -f docker/compose_apps.yaml up sinapsis-claude-chatbot -d
- For llama-cpp text-to-text chatbot:
docker compose -f docker/compose_apps.yaml up sinapsis-simple-chatbot -d
- For llama-index RAG chatbot:
docker compose -f docker/compose_apps.yaml up sinapsis-rag-chatbot -d
- Check the logs
- For Anthropic text-to-text chatbot:
docker logs -f sinapsis-claude-chatbot
- For llama-cpp text-to-text chatbot:
docker logs -f sinapsis-simple-chatbot
- For llama-index RAG chatbot:
docker logs -f sinapsis-rag-chatbot
- The logs will display the URL to access the webapp, e.g.,::
Running on local URL: http://127.0.0.1:7860
NOTE: The url may be different, check the output of logs.
- To stop the app:
docker compose -f docker/compose_apps.yaml down
To use a different chatbot configuration (e.g. OpenAI-based chat), update the AGENT_CONFIG_PATH environmental variable to point to the desired YAML file.
For example, to use OpenAI chat:
environment:
AGENT_CONFIG_PATH: webapps/configs/llama_cpp_simple_chatbot/openai_simple_chat.yaml
OPENAI_API_KEY: your_api_key
💻 UV
To run the webapp using the uv package manager, follow these steps:
- Export the environment variable to install the python bindings for llama-cpp:
export CMAKE_ARGS="-DGGML_CUDA=on"
export FORCE_CMAKE="1"
- Export CUDACXX:
export CUDACXX=$(command -v nvcc)
- Sync the virtual environment:
uv sync --frozen
- Install the wheel:
uv pip install sinapsis-chatbots[all] --extra-index-url https://pypi.sinapsis.tech
- Run the webapp:
- For Anthropic text-to-text chatbot:
export ANTHROPIC_API_KEY=your_api_key
uv run webapps/claude_chatbot.py
- For llama-cpp text-to-text chatbot:
uv run webapps/llama_cpp_simple_chatbot.py
- For OpenAI text-to-text chatbot:
export AGENT_CONFIG_PATH=webapps/configs/llama_cpp_simple_chatbot/openai_simple_chat.yaml
export OPENAI_API_KEY=your_api_key
uv run webapps/llama_cpp_simple_chatbot.py
- For llama-index RAG chatbot:
uv run webapps/llama_index_rag_chatbot.py
- The terminal will display the URL to access the webapp, e.g.:
Running on local URL: http://127.0.0.1:7860
NOTE: The URL may vary; check the terminal output for the correct address.
📙 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_chatbots-0.7.2.tar.gz.
File metadata
- Download URL: sinapsis_chatbots-0.7.2.tar.gz
- Upload date:
- Size: 95.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92fd1ff7ee0f454252719a3bfbf9760b71e2199c6440c96f1039dc4dea2780c4
|
|
| MD5 |
f0378c458f844f15a496d69787b643d4
|
|
| BLAKE2b-256 |
0586aa8efc5c2627128c8c5c11f01e9350067b4dcdd2591f9aaf0c0802ef4cd0
|
File details
Details for the file sinapsis_chatbots-0.7.2-py3-none-any.whl.
File metadata
- Download URL: sinapsis_chatbots-0.7.2-py3-none-any.whl
- Upload date:
- Size: 131.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34e1261b69d9c61e14e9fd53a7aefc1975c013de5ea0dd091171a55062de90a1
|
|
| MD5 |
7d184510c58d33a63c32a209f0faa85f
|
|
| BLAKE2b-256 |
57f68981871d09eea868fa6a07628bf8726d5c796299127db70dc0c0328a982c
|