Package with base functionality for llm text creation
Project description
sinapsis-chatbots-base
Package with base support for chat completion tasks
🐍 Installation • 🚀 Features • 📚 Usage example • 📙 Documentation • 🔍 License
The sinapsis-chatbots-base module provides core functionality for llm chat completion tasks
🐍 Installation
Install using your package manager of choice. We encourage the use of uv
Example with uv:
uv pip install sinapsis-chatbots-base --extra-index-url https://pypi.sinapsis.tech
or with raw pip:
pip install sinapsis-chatbots-base --extra-index-url https://pypi.sinapsis.tech
[!IMPORTANT] Templates may require extra dependencies. For development, we recommend installing the package with all the optional dependencies:
with uv:
uv pip install sinapsis-chatbots-base[all] --extra-index-url https://pypi.sinapsis.tech
or with raw pip:
pip install sinapsis-chatbots-base[all] --extra-index-url https://pypi.sinapsis.tech
🚀 Features
* LLMTextCompletionBase: Base class for all templates intended to perform chat (text) completion tasks🌍 General Attributes
These attributes apply to `LLMTextCompletionBase``:
llm_model_name(Required): Name of the LLM to use.n_ctx(Required): Maximum context size.role: Role in the conversation (system,user, orassistant, default:assistant)system_prompt(Optional): Defines the personality of the LLM (e.g., you are a python expert)prompt: Custom instructions to guide the LLM response (default: empty).chat_format: Chat message format (llama-2,chatml, etc., default:chatml).context_max_len: Maximum conversation context length (default: 6).pattern: Regex pattern to match delimiters (default: handles<|...|>and</...>).keep_before: Determines which part of the matched text to return (default:True)
[!TIP] Use CLI command
sinapsis info --all-template-namesto show a list with all the available Template names installed with Sinapsis Data Tools.
[!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 QueryContextualizeFromFile use sinapsis info --example-template-config QueryContextualizeFromFile to produce the following example config:
agent:
name: query_contextualize_template
templates:
- template_name: InputTemplate
class_name: InputTemplate
attributes: {}
- template_name: QueryContextualizeFromFile
class_name: QueryContextualizeFromFile
template_input: InputTemplate
attributes:
keywords: '`replace_me:list[str]`'
generic_keys: '`replace_me:list[str]`'
📚 Usage example
The following agent passes a text message through a TextPacket and checks if there is context with the chosen keywordConfig
agent:
name: chat_completion
description: Agent with a chatbot that makes a call to the LLM model using a context uploaded from a file
templates:
- template_name: InputTemplate
class_name: InputTemplate
attributes: { }
- template_name: PyPDFLoaderWrapper
class_name: PyPDFLoaderWrapper
template_input: InputTemplate
attributes:
add_document_as_text_packet: false
pypdfloader_init:
file_path: '/path/to/a/file.pdf'
- template_name: TextInput
class_name: TextInput
template_input: PyPDFLoaderWrapper
attributes:
text: what is AI?
- template_name: QueryContextualizeFromFile
class_name: QueryContextualizeFromFile
template_input: TextInput
attributes:
keywords: 'Artificial Intelligence'
generic_keys: 'PyPDFLoaderWrapper
📙 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_base-0.1.4.tar.gz.
File metadata
- Download URL: sinapsis_chatbots_base-0.1.4.tar.gz
- Upload date:
- Size: 23.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
efaa04258b2a713439e59c7e3fb7dfcbc4d4f6f193cb3e2f3db813aaee684122
|
|
| MD5 |
371bedcd7e5a9a878292463ef7c78a4c
|
|
| BLAKE2b-256 |
ecf5d6da77140582c9f60d480fac8b683d86e67bafaf3edf32ff8d92c66cf61b
|
File details
Details for the file sinapsis_chatbots_base-0.1.4-py3-none-any.whl.
File metadata
- Download URL: sinapsis_chatbots_base-0.1.4-py3-none-any.whl
- Upload date:
- Size: 24.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50345f59e2b6733e3c1ced61d9130f4fe733008daa857fa9902e9099694078a9
|
|
| MD5 |
35edbbd500ae24ab0ce03fd7f4f5dc49
|
|
| BLAKE2b-256 |
9476da2071d14cdf42789455cb81b4e88b058539be7aa8a92f7ff211115a2da3
|