sopel-ai 1.3.3__py3-none-any.whl → 1.3.5__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 +12 -4
- {sopel_ai-1.3.3.dist-info → sopel_ai-1.3.5.dist-info}/METADATA +3 -3
- sopel_ai-1.3.5.dist-info/RECORD +11 -0
- {sopel_ai-1.3.3.dist-info → sopel_ai-1.3.5.dist-info}/WHEEL +1 -1
- sopel_ai-1.3.3.dist-info/RECORD +0 -11
- {sopel_ai-1.3.3.dist-info → sopel_ai-1.3.5.dist-info}/LICENSE.txt +0 -0
- {sopel_ai-1.3.3.dist-info → sopel_ai-1.3.5.dist-info}/entry_points.txt +0 -0
- {sopel_ai-1.3.3.dist-info → sopel_ai-1.3.5.dist-info}/top_level.txt +0 -0
sopel_ai/core.py
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
from perplexipy import PERPLEXITY_API_URL
|
4
4
|
from perplexipy import PERPLEXITY_DEFAULT_MODEL
|
5
5
|
from perplexipy import PerplexityClient
|
6
|
+
from perplexipy import __VERSION__ as __P_VERSION__
|
6
7
|
from sopel_ai import __VERSION__
|
7
8
|
from sopel_ai.errors import SopelAIError
|
8
9
|
from tinydb import Query
|
@@ -14,7 +15,9 @@ from tinydb import TinyDB
|
|
14
15
|
# +++ constants +++
|
15
16
|
|
16
17
|
DEFAULT_API_KEY = 'pplx-3a45enterthekeyhere'
|
17
|
-
|
18
|
+
# TODO: Fix this:
|
19
|
+
# DEFAULT_LLM = PERPLEXITY_DEFAULT_MODEL.replace('reasoning-', '')
|
20
|
+
DEFAULT_LLM = 'sonar-pro'
|
18
21
|
DEFAULT_LLM_PROVIDER = 'PerplexityAI'
|
19
22
|
DEFAULT_LLM_SERVICE = PERPLEXITY_API_URL
|
20
23
|
DEFAULT_LOG_LEVEL = 'info'
|
@@ -63,8 +66,10 @@ def _checkClientInstance(key: str) -> None:
|
|
63
66
|
global _client
|
64
67
|
|
65
68
|
if not _client:
|
69
|
+
# TODO: fix the default in PerplexiPy at some point.
|
70
|
+
model = PERPLEXITY_DEFAULT_MODEL.replace('-reasoning', '')
|
66
71
|
_client = PerplexityClient(key = key, endpoint = PERPLEXITY_API_URL)
|
67
|
-
_client.model =
|
72
|
+
_client.model = model
|
68
73
|
|
69
74
|
|
70
75
|
def runQuery(query: str, nick: str = None, fileNameDB: str = None, responseLength: int = MAX_RESPONSE_LENGTH, key: str = None) -> str:
|
@@ -160,7 +165,7 @@ def versionInfo(key: str = None) -> str:
|
|
160
165
|
raise SopelAIError('key argument cannot be empty - set the LLM service API key')
|
161
166
|
|
162
167
|
_checkClientInstance(key)
|
163
|
-
return 'sopel_ai v%s using %s' % (__VERSION__, '.'.join([_client.__class__.__module__, _client.__class__.__name__]))
|
168
|
+
return 'sopel_ai v%s using %s version %s' % (__VERSION__, '.'.join([_client.__class__.__module__, _client.__class__.__name__]), __P_VERSION__)
|
164
169
|
|
165
170
|
|
166
171
|
def setModelForUser(modelID: int, nick: str, fileNameDB: str, key = None) -> str:
|
@@ -245,8 +250,11 @@ def getModelForUser(nick: str, fileNameDB: str, key = None) -> str:
|
|
245
250
|
Preference = Query()
|
246
251
|
preference = _database.search(Preference.nick == nick)
|
247
252
|
if preference:
|
248
|
-
model = preference[0]['model']
|
249
253
|
client = PerplexityClient(key = key, endpoint = PERPLEXITY_API_URL)
|
254
|
+
model = preference[0]['model']
|
255
|
+
# TODO: Implement unit test for this case.
|
256
|
+
if model not in client.models.keys():
|
257
|
+
model = tuple(client.models.keys())[0]
|
250
258
|
client.model = model
|
251
259
|
_clientCache[nick] = client
|
252
260
|
return model
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: sopel-ai
|
3
|
-
Version: 1.3.
|
3
|
+
Version: 1.3.5
|
4
4
|
Summary: Sopel AI - an LLM enhanced chat bot plug-in
|
5
5
|
Author-email: The SopelAI team <sopel_ai@cime.net>
|
6
6
|
License: BSD-3-Clause
|
@@ -20,11 +20,11 @@ Classifier: Topic :: Utilities
|
|
20
20
|
Requires-Python: >=3.9
|
21
21
|
Description-Content-Type: text/markdown
|
22
22
|
License-File: LICENSE.txt
|
23
|
-
Requires-Dist: perplexipy (==1.
|
23
|
+
Requires-Dist: perplexipy (==1.2.0)
|
24
24
|
Requires-Dist: sopel (>=7.1)
|
25
25
|
Requires-Dist: tinydb
|
26
26
|
|
27
|
-
% sopel_ai(1) Version 1.3.
|
27
|
+
% sopel_ai(1) Version 1.3.5 chatbot plugin
|
28
28
|
|
29
29
|
Name
|
30
30
|
====
|
@@ -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=VjugYiKMi_cnirQ_Bj0CWZ3DGMpzDutXU3PspNbcZW4,7685
|
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.5.dist-info/LICENSE.txt,sha256=I8aHapysmbM9F3y-rUfp011GQoosNO5L8pzl7IKgPnE,1531
|
7
|
+
sopel_ai-1.3.5.dist-info/METADATA,sha256=xlTVp_OV_pm_LST_oE6OgB9CaaEwROvBfgJjUEgKLaI,6210
|
8
|
+
sopel_ai-1.3.5.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
9
|
+
sopel_ai-1.3.5.dist-info/entry_points.txt,sha256=7Juxcn6L4j6F83TjkviiTwiyXLM4gZxAAXFQDR2G_m4,43
|
10
|
+
sopel_ai-1.3.5.dist-info/top_level.txt,sha256=kpNMzNEGbhCXkyn7oc3uQPmrX1J6qLxn59IcZBpwSYg,9
|
11
|
+
sopel_ai-1.3.5.dist-info/RECORD,,
|
sopel_ai-1.3.3.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=x34P4We66tgo5Q229qvlBvY7VuC2ziq9vXkUULVs06M,7277
|
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.3.dist-info/LICENSE.txt,sha256=I8aHapysmbM9F3y-rUfp011GQoosNO5L8pzl7IKgPnE,1531
|
7
|
-
sopel_ai-1.3.3.dist-info/METADATA,sha256=Zkcx8RKiIEprrHnk4OQAVHNqqbUeUPT_6BFEmyVaXus,6210
|
8
|
-
sopel_ai-1.3.3.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
|
9
|
-
sopel_ai-1.3.3.dist-info/entry_points.txt,sha256=7Juxcn6L4j6F83TjkviiTwiyXLM4gZxAAXFQDR2G_m4,43
|
10
|
-
sopel_ai-1.3.3.dist-info/top_level.txt,sha256=kpNMzNEGbhCXkyn7oc3uQPmrX1J6qLxn59IcZBpwSYg,9
|
11
|
-
sopel_ai-1.3.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|