sinapsis-chatbots-base 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- __init__.py +0 -0
- sinapsis_chatbots_base/__init__.py +0 -0
- sinapsis_chatbots_base/helpers/__init__.py +0 -0
- sinapsis_chatbots_base/helpers/llm_keys.py +24 -0
- sinapsis_chatbots_base/helpers/postprocess_text.py +33 -0
- sinapsis_chatbots_base/templates/__init__.py +20 -0
- sinapsis_chatbots_base/templates/llm_text_completion_base.py +275 -0
- sinapsis_chatbots_base/templates/query_contextualize.py +103 -0
- sinapsis_chatbots_base/templates/query_contextualize_from_file.py +88 -0
- sinapsis_chatbots_base-0.1.0.dist-info/METADATA +169 -0
- sinapsis_chatbots_base-0.1.0.dist-info/RECORD +14 -0
- sinapsis_chatbots_base-0.1.0.dist-info/WHEEL +5 -0
- sinapsis_chatbots_base-0.1.0.dist-info/licenses/LICENSE +661 -0
- sinapsis_chatbots_base-0.1.0.dist-info/top_level.txt +2 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sinapsis-chatbots-base
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Package with base functionality for llm text creation
|
|
5
|
+
Project-URL: Homepage, https://sinapsis.tech
|
|
6
|
+
Project-URL: Documentation, https://docs.sinapsis.tech/docs
|
|
7
|
+
Project-URL: Tutorials, https://docs.sinapsis.tech/tutorials
|
|
8
|
+
Project-URL: Repository, https://github.com/Sinapsis-AI/sinapsis-chatbots.git
|
|
9
|
+
Requires-Python: >=3.10.12
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: sinapsis>=0.2.0
|
|
13
|
+
Provides-Extra: chatbot
|
|
14
|
+
Requires-Dist: sinapsis-huggingface-transformers>=0.1.0; extra == "chatbot"
|
|
15
|
+
Provides-Extra: all
|
|
16
|
+
Requires-Dist: sinapsis-chatbots-base[chatbot]; extra == "all"
|
|
17
|
+
Dynamic: license-file
|
|
18
|
+
|
|
19
|
+
<h1 align="center">
|
|
20
|
+
<br>
|
|
21
|
+
<a href="https://sinapsis.tech/">
|
|
22
|
+
<img
|
|
23
|
+
src="https://github.com/Sinapsis-AI/brand-resources/blob/main/sinapsis_logo/4x/logo.png?raw=true"
|
|
24
|
+
alt="" width="300">
|
|
25
|
+
</a>
|
|
26
|
+
<br>
|
|
27
|
+
sinapsis-chatbots-base
|
|
28
|
+
<br>
|
|
29
|
+
</h1>
|
|
30
|
+
|
|
31
|
+
<h4 align="center">Package with base support for chat completion tasks </h4>
|
|
32
|
+
|
|
33
|
+
<p align="center">
|
|
34
|
+
<a href="#installation">🐍 Installation</a> •
|
|
35
|
+
<a href="#features">🚀 Features</a> •
|
|
36
|
+
<a href="#example">📚 Usage example</a> •
|
|
37
|
+
<a href="#documentation">📙 Documentation</a> •
|
|
38
|
+
<a href="#license">🔍 License</a>
|
|
39
|
+
</p>
|
|
40
|
+
|
|
41
|
+
The `sinapsis-chatbots-base` module provides core functionality for llm chat completion tasks
|
|
42
|
+
<h2 id="installation">🐍 Installation</h2>
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
Install using your package manager of choice. We encourage the use of <code>uv</code>
|
|
46
|
+
|
|
47
|
+
Example with <code>uv</code>:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
uv pip install sinapsis-chatbots-base --extra-index-url https://pypi.sinapsis.tech
|
|
51
|
+
```
|
|
52
|
+
or with raw <code>pip</code>:
|
|
53
|
+
```bash
|
|
54
|
+
pip install sinapsis-chatbots-base --extra-index-url https://pypi.sinapsis.tech
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
> [!IMPORTANT]
|
|
58
|
+
> Templates may require extra dependencies. For development, we recommend installing the package with all the optional dependencies:
|
|
59
|
+
>
|
|
60
|
+
|
|
61
|
+
with <code>uv</code>:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
uv pip install sinapsis-chatbots-base[all] --extra-index-url https://pypi.sinapsis.tech
|
|
65
|
+
```
|
|
66
|
+
or with raw <code>pip</code>:
|
|
67
|
+
```bash
|
|
68
|
+
pip install sinapsis-chatbots-base[all] --extra-index-url https://pypi.sinapsis.tech
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
<h2 id="features">🚀 Features</h2>
|
|
73
|
+
* LLMTextCompletionBase: Base class for all templates intended to perform chat (text) completion tasks
|
|
74
|
+
<details>
|
|
75
|
+
<summary id="configuration"><strong><span style="font-size: 1.25em;">🌍 General Attributes</span></strong></summary>
|
|
76
|
+
|
|
77
|
+
These attributes apply to `LLMTextCompletionBase``:
|
|
78
|
+
- `llm_model_name`(Required): Name of the LLM to use.
|
|
79
|
+
- `n_ctx`(Required): Maximum context size.
|
|
80
|
+
- `role`: Role in the conversation (`system`, `user`, or `assistant`, default: `assistant`)
|
|
81
|
+
- `system_prompt` (Optional): Defines the personality of the LLM (e.g., you are a python expert)
|
|
82
|
+
- `prompt`: Custom instructions to guide the LLM response (default: empty).
|
|
83
|
+
- `chat_format`: Chat message format (`llama-2`, `chatml`, etc., default: `chatml`).
|
|
84
|
+
- `context_max_len`: Maximum conversation context length (default: 6).
|
|
85
|
+
- `pattern`: Regex pattern to match delimiters (default: handles `<|...|>` and `</...>`).
|
|
86
|
+
- `keep_before`: Determines which part of the matched text to return (default: `True`)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
</details>
|
|
90
|
+
* QueryContextualizeFromFile: Template that adds a certain context to the query searching for keywords in the Documents
|
|
91
|
+
added in the generic_data field of the DataContainer
|
|
92
|
+
|
|
93
|
+
> [!TIP]
|
|
94
|
+
> Use CLI command ``` sinapsis info --all-template-names``` to show a list with all the available Template names installed with Sinapsis Data Tools.
|
|
95
|
+
|
|
96
|
+
> [!TIP]
|
|
97
|
+
> Use CLI command ```sinapsis info --example-template-config TEMPLATE_NAME``` to produce an example Agent config for the Template specified in ***TEMPLATE_NAME***.
|
|
98
|
+
|
|
99
|
+
For example, for ***QueryContextualizeFromFile*** use ```sinapsis info --example-template-config QueryContextualizeFromFile``` to produce the following example config:
|
|
100
|
+
|
|
101
|
+
```yaml
|
|
102
|
+
agent:
|
|
103
|
+
name: query_contextualize_template
|
|
104
|
+
templates:
|
|
105
|
+
- template_name: InputTemplate
|
|
106
|
+
class_name: InputTemplate
|
|
107
|
+
attributes: {}
|
|
108
|
+
- template_name: QueryContextualizeFromFile
|
|
109
|
+
class_name: QueryContextualizeFromFile
|
|
110
|
+
template_input: InputTemplate
|
|
111
|
+
attributes:
|
|
112
|
+
keywords: '`replace_me:list[str]`'
|
|
113
|
+
generic_keys: '`replace_me:list[str]`'
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
<h2 id="example">📚 Usage example</h2>
|
|
118
|
+
The following agent passes a text message through a TextPacket and checks if there is context with the chosen keyword
|
|
119
|
+
<details id='usage'><summary><strong><span style="font-size: 1.0em;"> Config</span></strong></summary>
|
|
120
|
+
|
|
121
|
+
```yaml
|
|
122
|
+
agent:
|
|
123
|
+
name: chat_completion
|
|
124
|
+
description: Agent with a chatbot that makes a call to the LLM model using a context uploaded from a file
|
|
125
|
+
|
|
126
|
+
templates:
|
|
127
|
+
- template_name: InputTemplate
|
|
128
|
+
class_name: InputTemplate
|
|
129
|
+
attributes: { }
|
|
130
|
+
- template_name: PyPDFLoaderWrapper
|
|
131
|
+
class_name: PyPDFLoaderWrapper
|
|
132
|
+
template_input: InputTemplate
|
|
133
|
+
attributes:
|
|
134
|
+
add_document_as_text_packet: false
|
|
135
|
+
pypdfloader_init:
|
|
136
|
+
file_path: '/path/to/a/file.pdf'
|
|
137
|
+
|
|
138
|
+
- template_name: TextInput
|
|
139
|
+
class_name: TextInput
|
|
140
|
+
template_input: PyPDFLoaderWrapper
|
|
141
|
+
attributes:
|
|
142
|
+
text: what is AI?
|
|
143
|
+
- template_name: QueryContextualizeFromFile
|
|
144
|
+
class_name: QueryContextualizeFromFile
|
|
145
|
+
template_input: TextInput
|
|
146
|
+
attributes:
|
|
147
|
+
keywords: 'Artificial Intelligence'
|
|
148
|
+
generic_keys: 'PyPDFLoaderWrapper
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
<h2 id="documentation">📙 Documentation</h2>
|
|
154
|
+
|
|
155
|
+
Documentation for this and other sinapsis packages is available on the [sinapsis website](https://docs.sinapsis.tech/docs)
|
|
156
|
+
|
|
157
|
+
Tutorials for different projects within sinapsis are available at [sinapsis tutorials page](https://docs.sinapsis.tech/tutorials)
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
<h2 id="license">🔍 License</h2>
|
|
161
|
+
|
|
162
|
+
This project is licensed under the AGPLv3 license, which encourages open collaboration and sharing. For more details, please refer to the [LICENSE](LICENSE) file.
|
|
163
|
+
|
|
164
|
+
For commercial use, please refer to our [official Sinapsis website](https://sinapsis.tech) for information on obtaining a commercial license.
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
sinapsis_chatbots_base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
sinapsis_chatbots_base/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
sinapsis_chatbots_base/helpers/llm_keys.py,sha256=PsEShlU8DEomaOyuPNNkkJqEhZ0mGc4yHSHFumL_2Ko,862
|
|
5
|
+
sinapsis_chatbots_base/helpers/postprocess_text.py,sha256=m5ph3SapaNa3VlbHwaaGlkmebHIAv-o0ybPDAN8O62Y,1226
|
|
6
|
+
sinapsis_chatbots_base/templates/__init__.py,sha256=AIKS0g3ORCedWhPi_ikjOmRhV9sS3XyJLTkNimqw8Oc,612
|
|
7
|
+
sinapsis_chatbots_base/templates/llm_text_completion_base.py,sha256=nM0tgVq-j_jVIi83T2jiJhFzoM_uTJ_Ky4vot2LpLwE,10295
|
|
8
|
+
sinapsis_chatbots_base/templates/query_contextualize.py,sha256=HHokTeAe_C1WyrzVZtZEgekbrjzcJj7MZ7bfMZBP_7w,3901
|
|
9
|
+
sinapsis_chatbots_base/templates/query_contextualize_from_file.py,sha256=7i_nLEZjosO__V9BHSiecVMGjsSBIqOQmm8rYkkpGD8,3740
|
|
10
|
+
sinapsis_chatbots_base-0.1.0.dist-info/licenses/LICENSE,sha256=6fUgoQx5VO5qzq-krozOaZaGkURxvcZsqdwV0789B-s,34525
|
|
11
|
+
sinapsis_chatbots_base-0.1.0.dist-info/METADATA,sha256=RrPWNyiq2OPMr-seil2qbGqhmJYfjXtrW8K6yV55Dcc,5921
|
|
12
|
+
sinapsis_chatbots_base-0.1.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
|
13
|
+
sinapsis_chatbots_base-0.1.0.dist-info/top_level.txt,sha256=7mfK9_muel5MLqD_r0IYD8yVNCVSva580rcjtWRzt0Q,32
|
|
14
|
+
sinapsis_chatbots_base-0.1.0.dist-info/RECORD,,
|