sopel-ai 1.1.0__py3-none-any.whl → 1.3.4__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- sopel_ai/core.py +8 -4
- {sopel_ai-1.1.0.dist-info → sopel_ai-1.3.4.dist-info}/METADATA +50 -3
- sopel_ai-1.3.4.dist-info/RECORD +11 -0
- sopel_ai-1.1.0.dist-info/RECORD +0 -11
- {sopel_ai-1.1.0.dist-info → sopel_ai-1.3.4.dist-info}/LICENSE.txt +0 -0
- {sopel_ai-1.1.0.dist-info → sopel_ai-1.3.4.dist-info}/WHEEL +0 -0
- {sopel_ai-1.1.0.dist-info → sopel_ai-1.3.4.dist-info}/entry_points.txt +0 -0
- {sopel_ai-1.1.0.dist-info → sopel_ai-1.3.4.dist-info}/top_level.txt +0 -0
sopel_ai/core.py
CHANGED
@@ -54,6 +54,7 @@ def _checkDB(fileName: str) -> TinyDB:
|
|
54
54
|
|
55
55
|
if not _database:
|
56
56
|
_database = TinyDB(fileName)
|
57
|
+
_database.table('_default', cache_size = 0)
|
57
58
|
|
58
59
|
return _database
|
59
60
|
|
@@ -201,10 +202,10 @@ def setModelForUser(modelID: int, nick: str, fileNameDB: str, key = None) -> str
|
|
201
202
|
if modelID not in range(len(models)):
|
202
203
|
raise SopelAIError('modelID outside of available models index range')
|
203
204
|
|
204
|
-
|
205
|
+
query = Query()
|
205
206
|
|
206
|
-
if _database.search(
|
207
|
-
_database.update({ 'model': models[modelID], },
|
207
|
+
if _database.search(query.nick == nick):
|
208
|
+
_database.update({ 'model': models[modelID], }, query.nick == nick)
|
208
209
|
else:
|
209
210
|
_database.insert({ 'nick': nick, 'model': models[modelID], })
|
210
211
|
|
@@ -244,8 +245,11 @@ def getModelForUser(nick: str, fileNameDB: str, key = None) -> str:
|
|
244
245
|
Preference = Query()
|
245
246
|
preference = _database.search(Preference.nick == nick)
|
246
247
|
if preference:
|
247
|
-
model = preference[0]['model']
|
248
248
|
client = PerplexityClient(key = key, endpoint = PERPLEXITY_API_URL)
|
249
|
+
model = preference[0]['model']
|
250
|
+
# TODO: Implement unit test for this case.
|
251
|
+
if model not in client.models.keys():
|
252
|
+
model = tuple(client.models.keys())[0]
|
249
253
|
client.model = model
|
250
254
|
_clientCache[nick] = client
|
251
255
|
return model
|
@@ -1,8 +1,9 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: sopel-ai
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.3.4
|
4
4
|
Summary: Sopel AI - an LLM enhanced chat bot plug-in
|
5
5
|
Author-email: The SopelAI team <sopel_ai@cime.net>
|
6
|
+
License: BSD-3-Clause
|
6
7
|
Project-URL: Homepage, https://github.com/pr3d4t0r/sopel_ai
|
7
8
|
Project-URL: Bug Tracker, https://github.com/pr3d4t0r/sopel_ai/issues
|
8
9
|
Keywords: ai,bot,irc,llm,plugin,sopel
|
@@ -19,11 +20,11 @@ Classifier: Topic :: Utilities
|
|
19
20
|
Requires-Python: >=3.9
|
20
21
|
Description-Content-Type: text/markdown
|
21
22
|
License-File: LICENSE.txt
|
22
|
-
Requires-Dist: perplexipy
|
23
|
+
Requires-Dist: perplexipy (==1.1.4)
|
23
24
|
Requires-Dist: sopel (>=7.1)
|
24
25
|
Requires-Dist: tinydb
|
25
26
|
|
26
|
-
% sopel_ai(1) Version 1.
|
27
|
+
% sopel_ai(1) Version 1.3.4 chatbot plugin
|
27
28
|
|
28
29
|
Name
|
29
30
|
====
|
@@ -151,6 +152,52 @@ llm_key = pplx-3a45enteryourkeykere
|
|
151
152
|
```
|
152
153
|
|
153
154
|
|
155
|
+
Docker
|
156
|
+
======
|
157
|
+
Sopel AI is dockerized and available from Docker Hub as pr3d4t0r/sopel_ai. The
|
158
|
+
version tag is the same as the latest version number for Sopel AI.
|
159
|
+
|
160
|
+
The examples in this section assume execution from the local file system. Adapt
|
161
|
+
as needed to run in a Kubernets cluster or other deployment method.
|
162
|
+
|
163
|
+
|
164
|
+
### First time
|
165
|
+
|
166
|
+
The Sopel + AI configuration file must be created:
|
167
|
+
|
168
|
+
```bash
|
169
|
+
docker run -ti -v ${HOME}/sopel_ai_data:/home/sopel_ai \
|
170
|
+
pr3d4t0r/sopel_ai:latest \
|
171
|
+
sopel configure
|
172
|
+
```
|
173
|
+
|
174
|
+
The API key and other relevant configuration data must be provided at this time.
|
175
|
+
`$HOME/sopel_ai_data` is volume mapped to the container's `/home/sopel_ai/.sopel
|
176
|
+
directory. Ensure that your host has write permissions in the shared volume.
|
177
|
+
|
178
|
+
The `pr3d4t0r/sopel_ai:latest` image is used if no version is specified. The
|
179
|
+
image update policy is left to the sysops and is not automatic.
|
180
|
+
|
181
|
+
Once `$HOME/sopel_ai_data` exists it's possible to copy the contents of a
|
182
|
+
different `~/.sopel` directory to it and use is as the configuration and Sopel
|
183
|
+
AI database store.
|
184
|
+
|
185
|
+
|
186
|
+
### Starting Sopel AI
|
187
|
+
|
188
|
+
A Docker Compose file is provided as an example of how to start the service,
|
189
|
+
<a href='./dockerized/docker-compose.yaml' target='_blank'>docker-file.yaml</a>. With this Docker Compose
|
190
|
+
file in the current directory, start the service with:
|
191
|
+
|
192
|
+
```bash
|
193
|
+
docker-compose up [-d] sopel_ai
|
194
|
+
|
195
|
+
```
|
196
|
+
|
197
|
+
The `-d` parameter daemonizes the service. Without it, the service will start
|
198
|
+
and display its output in the current console.
|
199
|
+
|
200
|
+
|
154
201
|
License
|
155
202
|
=======
|
156
203
|
The **Sopel AI** Sopel plugin, package, documentation, and examples are licensed
|
@@ -0,0 +1,11 @@
|
|
1
|
+
sopel_ai/__init__.py,sha256=UXSuXZj_p860rLAiewSe5nbKg-qbIEcXq6jkqYmaMnI,2531
|
2
|
+
sopel_ai/config.py,sha256=y0vbvfeDjjfLUOvTJ3W56mAGVpJxeizrXJbCaFW4ZXk,867
|
3
|
+
sopel_ai/core.py,sha256=m5XutY1Rm7z-nh1_qPOAcrnfP20BekMH6jveXoSX3NQ,7425
|
4
|
+
sopel_ai/errors.py,sha256=XMVgFk4Rw64Z0UO3ZInp-N6LP0GRG8NFIuXKnhu5rLo,192
|
5
|
+
sopel_ai/plugin.py,sha256=51mYp6B_mUtgS6mL-IMhK8Qiz_Rw_qAwmTLdML-qQ2o,6800
|
6
|
+
sopel_ai-1.3.4.dist-info/LICENSE.txt,sha256=I8aHapysmbM9F3y-rUfp011GQoosNO5L8pzl7IKgPnE,1531
|
7
|
+
sopel_ai-1.3.4.dist-info/METADATA,sha256=yUU8251bdLtOwpudjsUOZLdjAZ9DeSrsdmXVVXLVx98,6210
|
8
|
+
sopel_ai-1.3.4.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
9
|
+
sopel_ai-1.3.4.dist-info/entry_points.txt,sha256=7Juxcn6L4j6F83TjkviiTwiyXLM4gZxAAXFQDR2G_m4,43
|
10
|
+
sopel_ai-1.3.4.dist-info/top_level.txt,sha256=kpNMzNEGbhCXkyn7oc3uQPmrX1J6qLxn59IcZBpwSYg,9
|
11
|
+
sopel_ai-1.3.4.dist-info/RECORD,,
|
sopel_ai-1.1.0.dist-info/RECORD
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
sopel_ai/__init__.py,sha256=UXSuXZj_p860rLAiewSe5nbKg-qbIEcXq6jkqYmaMnI,2531
|
2
|
-
sopel_ai/config.py,sha256=y0vbvfeDjjfLUOvTJ3W56mAGVpJxeizrXJbCaFW4ZXk,867
|
3
|
-
sopel_ai/core.py,sha256=r5lnH8lcXenc2Ln3Qha2hoAggWUP5ZyZniZrdl9IIsQ,7240
|
4
|
-
sopel_ai/errors.py,sha256=XMVgFk4Rw64Z0UO3ZInp-N6LP0GRG8NFIuXKnhu5rLo,192
|
5
|
-
sopel_ai/plugin.py,sha256=51mYp6B_mUtgS6mL-IMhK8Qiz_Rw_qAwmTLdML-qQ2o,6800
|
6
|
-
sopel_ai-1.1.0.dist-info/LICENSE.txt,sha256=I8aHapysmbM9F3y-rUfp011GQoosNO5L8pzl7IKgPnE,1531
|
7
|
-
sopel_ai-1.1.0.dist-info/METADATA,sha256=niUEpHboA7k6c-LzYeoRyEvwVFSOps_2LWBbQzlUEJY,4681
|
8
|
-
sopel_ai-1.1.0.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
9
|
-
sopel_ai-1.1.0.dist-info/entry_points.txt,sha256=7Juxcn6L4j6F83TjkviiTwiyXLM4gZxAAXFQDR2G_m4,43
|
10
|
-
sopel_ai-1.1.0.dist-info/top_level.txt,sha256=kpNMzNEGbhCXkyn7oc3uQPmrX1J6qLxn59IcZBpwSYg,9
|
11
|
-
sopel_ai-1.1.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|