Metadata-Version: 2.4
Name: sinapsis-chatbots-base
Version: 0.2.1
Summary: Sinapsis templates for shared chatbot foundations.
Author-email: SinapsisAI <dev@sinapsis.tech>
Project-URL: Homepage, https://sinapsis.tech
Project-URL: Documentation, https://docs.sinapsis.tech/docs
Project-URL: Tutorials, https://docs.sinapsis.tech/tutorials
Project-URL: Repository, https://github.com/Sinapsis-AI/sinapsis-chatbots.git
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: sinapsis>=0.2.10
Provides-Extra: torch
Requires-Dist: torch>=2.6.0; extra == "torch"
Provides-Extra: endpoint
Requires-Dist: openai>=1.109.1; extra == "endpoint"
Provides-Extra: all
Requires-Dist: sinapsis-chatbots-base[torch]; extra == "all"
Requires-Dist: sinapsis-chatbots-base[endpoint]; extra == "all"
Dynamic: license-file

<h1 align="center">
<br>
<a href="https://sinapsis.tech/">
  <img
    src="https://github.com/Sinapsis-AI/brand-resources/blob/main/sinapsis_logo/4x/logo.png?raw=true"
    alt="" width="300">
</a>
<br>
Sinapsis Chatbots Base
<br>
</h1>

<h4 align="center">Sinapsis templates for chatbot inputs, contextualization, and endpoint-backed completions.</h4>

<p align="center">
<a href="#installation">🐍 Installation</a> •
<a href="#features">🚀 Features</a> •
<a href="#example">📚 Usage example</a> •
<a href="#documentation">📙 Documentation</a> •
<a href="#license">🔍 License</a>
</p>

The `sinapsis-chatbots-base` package provides the shared chatbot foundation. It includes the base abstractions for LLM templates together with the core templates for building `LLMConversationPacket` inputs, adding document context from preloaded data, and sending chat requests to OpenAI-compatible HTTP endpoints.

<h2 id="installation">🐍 Installation</h2>

Install using your preferred package manager. We strongly recommend using <code>uv</code>.

Install the base package:

```bash
uv pip install sinapsis-chatbots-base --extra-index-url https://pypi.sinapsis.tech
```

Or with raw <code>pip</code>:

```bash
pip install sinapsis-chatbots-base --extra-index-url https://pypi.sinapsis.tech
```

> [!IMPORTANT]
> `EndpointLLMCompletion` requires the optional `endpoint` extra:
>
> ```bash
> uv pip install sinapsis-chatbots-base[endpoint] --extra-index-url https://pypi.sinapsis.tech
> ```
>
> `all` installs every optional dependency exposed by the package:
>
> ```bash
> uv pip install sinapsis-chatbots-base[all] --extra-index-url https://pypi.sinapsis.tech
> ```

<h2 id="features">🚀 Features</h2>

<h3>Templates Supported</h3>

- **LLMConversationInput**: Creates an `LLMConversationPacket` from a prompt, system prompt, and packet metadata.
- **QueryContextualizeFromFile**: Builds packet contexts from files or documents already loaded into the container.
- **EndpointLLMCompletion**: Sends chat requests to OpenAI-compatible endpoints such as OpenAI, Ollama, llama.cpp server, vLLM server, or compatible hosted APIs.
- **EndpointLLMStreamingCompletion**: Streams chat-completion chunks from OpenAI-compatible endpoints and emits partial packet updates.
- **EndpointLLMMultiModal**: Sends text + image user turns to OpenAI-compatible multimodal endpoints.

> [!TIP]
> Use CLI command ``` sinapsis info --all-template-names``` to show a list with all the available Template names installed with Sinapsis Chatbots Base.

<h2 id="example">📚 Usage example</h2>

The following agent builds an `LLMConversationPacket` and sends it to an OpenAI-compatible endpoint.

<details id='usage'><summary><strong><span style="font-size: 1.0em;"> Config</span></strong></summary>

```yaml
agent:
  name: openai_api_agent

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

  - template_name: LLMConversationInput
    class_name: LLMConversationInput
    template_input: InputTemplate
    attributes:
      prompt: Give three short tips for staying organized during a busy week.
      system_prompt: You are a helpful assistant.

  - template_name: EndpointLLMCompletion
    class_name: EndpointLLMCompletion
    template_input: LLMConversationInput
    attributes:
      init_args:
        base_url: "https://api.openai.com/v1"
        llm_model_name: "gpt-4o-mini"
      completion_args:
        max_tokens: 2048
```

</details>

<h2 id="documentation">📙 Documentation</h2>

Documentation for this and other sinapsis packages is available on the [sinapsis website](https://docs.sinapsis.tech/docs)

Tutorials for different projects within sinapsis are available at [sinapsis tutorials page](https://docs.sinapsis.tech/tutorials)

<h2 id="license">🔍 License</h2>

This project is licensed under the AGPLv3 license, which encourages open collaboration and sharing. For more details, please refer to the [LICENSE](LICENSE) file.

For commercial use, please refer to our [official Sinapsis website](https://sinapsis.tech) for information on obtaining a commercial license.
