blue-assistant 4.17.1__py3-none-any.whl → 4.21.1__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.
- blue_assistant/__init__.py +1 -1
- blue_assistant/chat/context.py +33 -3
- blue_assistant/chat/functions.py +1 -1
- {blue_assistant-4.17.1.dist-info → blue_assistant-4.21.1.dist-info}/METADATA +3 -2
- {blue_assistant-4.17.1.dist-info → blue_assistant-4.21.1.dist-info}/RECORD +8 -8
- {blue_assistant-4.17.1.dist-info → blue_assistant-4.21.1.dist-info}/LICENSE +0 -0
- {blue_assistant-4.17.1.dist-info → blue_assistant-4.21.1.dist-info}/WHEEL +0 -0
- {blue_assistant-4.17.1.dist-info → blue_assistant-4.21.1.dist-info}/top_level.txt +0 -0
blue_assistant/__init__.py
CHANGED
blue_assistant/chat/context.py
CHANGED
@@ -1,5 +1,8 @@
|
|
1
|
+
from blue_objects import file, objects
|
2
|
+
from blue_options import string
|
1
3
|
from blue_objects.metadata import post_to_object, get_from_object
|
2
4
|
from blue_options.terminal.functions import hr
|
5
|
+
from openai_commands.prompt_completion.api import complete_prompt
|
3
6
|
|
4
7
|
from blue_assistant import ICON
|
5
8
|
from blue_assistant.logger import logger
|
@@ -10,7 +13,10 @@ class ChatContext:
|
|
10
13
|
self,
|
11
14
|
object_name: str,
|
12
15
|
load_history: bool = True,
|
16
|
+
verbose: bool = False,
|
13
17
|
):
|
18
|
+
self.verbose = verbose
|
19
|
+
|
14
20
|
self.ended: bool = False
|
15
21
|
|
16
22
|
self.object_name = object_name
|
@@ -28,7 +34,6 @@ class ChatContext:
|
|
28
34
|
def chat(
|
29
35
|
self,
|
30
36
|
interactive: bool = True,
|
31
|
-
verbose: bool = False,
|
32
37
|
) -> bool:
|
33
38
|
logger.info('Type in "help" for help.')
|
34
39
|
|
@@ -45,7 +50,11 @@ class ChatContext:
|
|
45
50
|
|
46
51
|
return True
|
47
52
|
|
48
|
-
def process_prompt(
|
53
|
+
def process_prompt(
|
54
|
+
self,
|
55
|
+
prompt: str,
|
56
|
+
max_tokens: int = 2000,
|
57
|
+
) -> bool:
|
49
58
|
if prompt in ["help", "?", ""]:
|
50
59
|
return self.show_help()
|
51
60
|
|
@@ -53,15 +62,36 @@ class ChatContext:
|
|
53
62
|
self.ended = True
|
54
63
|
return True
|
55
64
|
|
65
|
+
success, response, metadata = complete_prompt(
|
66
|
+
prompt=prompt,
|
67
|
+
max_tokens=max_tokens,
|
68
|
+
verbose=self.verbose,
|
69
|
+
)
|
70
|
+
if not success:
|
71
|
+
return success
|
72
|
+
logger.info(response)
|
73
|
+
|
56
74
|
logger.info(f"🪄 {prompt}")
|
57
75
|
|
76
|
+
id_ = string.pretty_date(
|
77
|
+
as_filename=True,
|
78
|
+
unique=True,
|
79
|
+
)
|
58
80
|
self.history.append(
|
59
81
|
{
|
82
|
+
"id": id_,
|
60
83
|
"prompt": prompt,
|
84
|
+
"response": response,
|
61
85
|
}
|
62
86
|
)
|
63
87
|
|
64
|
-
return
|
88
|
+
return file.save_yaml(
|
89
|
+
objects.path_of(
|
90
|
+
object_name=self.object_name,
|
91
|
+
filename=f"{id_}.yaml",
|
92
|
+
),
|
93
|
+
metadata,
|
94
|
+
)
|
65
95
|
|
66
96
|
def save(self) -> bool:
|
67
97
|
return post_to_object(
|
blue_assistant/chat/functions.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: blue_assistant
|
3
|
-
Version: 4.
|
3
|
+
Version: 4.21.1
|
4
4
|
Summary: 🌀 An AI Assistant.
|
5
5
|
Home-page: https://github.com/kamangir/blue-assistant
|
6
6
|
Author: Arash Abadpour (Kamangir)
|
@@ -15,6 +15,7 @@ License-File: LICENSE
|
|
15
15
|
Requires-Dist: blueness
|
16
16
|
Requires-Dist: blue-options
|
17
17
|
Requires-Dist: abcli
|
18
|
+
Requires-Dist: openai_commands
|
18
19
|
Requires-Dist: boto3
|
19
20
|
Requires-Dist: geojson
|
20
21
|
Requires-Dist: geopandas
|
@@ -62,4 +63,4 @@ graph LR
|
|
62
63
|
|
63
64
|
[](https://github.com/kamangir/blue-assistant/actions/workflows/pylint.yml) [](https://github.com/kamangir/blue-assistant/actions/workflows/pytest.yml) [](https://github.com/kamangir/blue-assistant/actions/workflows/bashtest.yml) [](https://pypi.org/project/blue-assistant/) [](https://pypistats.org/packages/blue-assistant)
|
64
65
|
|
65
|
-
built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🌀 [`blue_assistant-4.
|
66
|
+
built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🌀 [`blue_assistant-4.21.1`](https://github.com/kamangir/blue-assistant).
|
@@ -1,5 +1,5 @@
|
|
1
1
|
blue_assistant/README.py,sha256=q6EWCy7zojQESGDF-2xEoXS1Bl0wRJTe2jw_1QM_WYw,600
|
2
|
-
blue_assistant/__init__.py,sha256=
|
2
|
+
blue_assistant/__init__.py,sha256=1lvcHZ3f-cuu4kggGxsk0tHJqiiPFtcPSSzcpP8kG7Q,310
|
3
3
|
blue_assistant/__main__.py,sha256=URtal70XZc0--3FDTYWcLtnGOqBYjMX9gt-L1k8hDXI,361
|
4
4
|
blue_assistant/config.env,sha256=89ao50sGXYWiU-NMV_fUVXAXdTHKKfWV03BY3_p6EOE,25
|
5
5
|
blue_assistant/env.py,sha256=Luc_ws9lWcgE6u-wjgBL-1WwsL7-kBpiN6bhO5MO96M,177
|
@@ -20,14 +20,14 @@ blue_assistant/.abcli/tests/help.sh,sha256=n2FZO78a93YeKSqqZfJoqYDBMHQRWQp2l96zE
|
|
20
20
|
blue_assistant/.abcli/tests/version.sh,sha256=oR2rvYR8zi-0VDPIdPJsmsmWwYaamT8dmNTqUh3-8Gw,154
|
21
21
|
blue_assistant/chat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
22
22
|
blue_assistant/chat/__main__.py,sha256=n9fvhhcTHjg33EHvHdFnc2kf8X1yhmOJUahDFs82bW0,870
|
23
|
-
blue_assistant/chat/context.py,sha256=
|
24
|
-
blue_assistant/chat/functions.py,sha256=
|
23
|
+
blue_assistant/chat/context.py,sha256=v1ZQYnK7-eVCRiX9vZt2gTcCwzrClWwvFiMtITpcQSE,2616
|
24
|
+
blue_assistant/chat/functions.py,sha256=Al_JUUldshY191Q6rlpVPCExNH5oOFrtkh50419K_0I,714
|
25
25
|
blue_assistant/help/__init__.py,sha256=ajz1GSNU9xYVrFEDSz6Xwg7amWQ_yvW75tQa1ZvRIWc,3
|
26
26
|
blue_assistant/help/__main__.py,sha256=cVejR7OpoWPg0qLbm-PZf5TuJS27x49jzfiyCLyzEns,241
|
27
27
|
blue_assistant/help/chat.py,sha256=fkcT14htkjEt7EOpgvHuUPzj7d8jQDxdgN2ZcU0lVEg,534
|
28
28
|
blue_assistant/help/functions.py,sha256=e1S3oxVKSkLThMMyAsPotaovVFHQbiMN4yRWVZP6TB0,663
|
29
|
-
blue_assistant-4.
|
30
|
-
blue_assistant-4.
|
31
|
-
blue_assistant-4.
|
32
|
-
blue_assistant-4.
|
33
|
-
blue_assistant-4.
|
29
|
+
blue_assistant-4.21.1.dist-info/LICENSE,sha256=ogEPNDSH0_dhiv_lT3ifVIdgIzHAqNA_SemnxUfPBJk,7048
|
30
|
+
blue_assistant-4.21.1.dist-info/METADATA,sha256=x3wxmN4nVs5JwU-wuHGb42QItMl3lBm1e170Q5iy0Bw,2294
|
31
|
+
blue_assistant-4.21.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
32
|
+
blue_assistant-4.21.1.dist-info/top_level.txt,sha256=ud0BkBbdOVze13bNqHuhZj1rwCztaBtDf5ChEYzASOs,15
|
33
|
+
blue_assistant-4.21.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|