blue-assistant 4.62.1__tar.gz → 4.78.1__tar.gz
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-4.62.1/blue_assistant.egg-info → blue_assistant-4.78.1}/PKG-INFO +2 -2
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/README.md +1 -1
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/README.py +13 -10
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/__init__.py +1 -1
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/script/actions/functions.py +3 -7
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/script/actions/generate_image.py +4 -7
- blue_assistant-4.78.1/blue_assistant/script/actions/generate_text.py +93 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/script/actions/generic.py +2 -2
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/script/repository/generic/classes.py +10 -17
- {blue_assistant-4.62.1 → blue_assistant-4.78.1/blue_assistant.egg-info}/PKG-INFO +2 -2
- blue_assistant-4.62.1/blue_assistant/script/actions/generate_text.py +0 -66
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/LICENSE +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/MANIFEST.in +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/.abcli/abcli.sh +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/.abcli/actions.sh +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/.abcli/alias.sh +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/.abcli/blue_assistant.sh +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/.abcli/browse.sh +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/.abcli/script/list.sh +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/.abcli/script/run.sh +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/.abcli/script.sh +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/.abcli/tests/README.sh +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/.abcli/tests/help.sh +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/.abcli/tests/script_list.sh +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/.abcli/tests/script_run.sh +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/.abcli/tests/version.sh +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/__main__.py +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/config.env +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/env.py +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/functions.py +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/help/__init__.py +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/help/__main__.py +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/help/functions.py +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/help/script.py +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/host.py +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/logger.py +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/sample.env +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/script/__init__.py +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/script/__main__.py +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/script/actions/__init__.py +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/script/actions/wip.py +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/script/load.py +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/script/repository/__init__.py +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/script/repository/blue_amo/__init__.py +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/script/repository/blue_amo/classes.py +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/script/repository/generic/__init__.py +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/script/repository/moon_datasets/__init__.py +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/script/repository/moon_datasets/classes.py +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/urls.py +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant.egg-info/SOURCES.txt +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant.egg-info/dependency_links.txt +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant.egg-info/requires.txt +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant.egg-info/top_level.txt +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/pyproject.toml +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/requirements.txt +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/setup.cfg +0 -0
- {blue_assistant-4.62.1 → blue_assistant-4.78.1}/setup.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: blue_assistant
|
3
|
-
Version: 4.
|
3
|
+
Version: 4.78.1
|
4
4
|
Summary: 🧠 An AI Assistant.
|
5
5
|
Home-page: https://github.com/kamangir/blue-assistant
|
6
6
|
Author: Arash Abadpour (Kamangir)
|
@@ -72,4 +72,4 @@ graph LR
|
|
72
72
|
|
73
73
|
[](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)
|
74
74
|
|
75
|
-
built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🧠 [`blue_assistant-4.
|
75
|
+
built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🧠 [`blue_assistant-4.78.1`](https://github.com/kamangir/blue-assistant).
|
@@ -28,4 +28,4 @@ graph LR
|
|
28
28
|
|
29
29
|
[](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)
|
30
30
|
|
31
|
-
built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🧠 [`blue_assistant-4.
|
31
|
+
built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🧠 [`blue_assistant-4.78.1`](https://github.com/kamangir/blue-assistant).
|
@@ -17,14 +17,17 @@ items = [
|
|
17
17
|
|
18
18
|
|
19
19
|
def build():
|
20
|
-
return
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
20
|
+
return all(
|
21
|
+
README.build(
|
22
|
+
items=readme.get("items", []),
|
23
|
+
path=os.path.join(file.path(__file__), readme["path"]),
|
24
|
+
ICON=ICON,
|
25
|
+
NAME=NAME,
|
26
|
+
VERSION=VERSION,
|
27
|
+
REPO_NAME=REPO_NAME,
|
28
|
+
)
|
29
|
+
for readme in [
|
30
|
+
{"items": items, "path": ".."},
|
31
|
+
{"path": "docs/blue-amo-01.md"},
|
32
|
+
]
|
27
33
|
)
|
28
|
-
|
29
|
-
|
30
|
-
|
@@ -25,14 +25,12 @@ def get_action_class(
|
|
25
25
|
def perform_action(
|
26
26
|
script: BaseScript,
|
27
27
|
node_name: str,
|
28
|
-
) ->
|
28
|
+
) -> bool:
|
29
29
|
action_name = script.nodes[node_name].get("action", "unknown")
|
30
30
|
|
31
31
|
success, action_class = get_action_class(action_name=action_name)
|
32
32
|
if not success:
|
33
|
-
return
|
34
|
-
"error": f"{action_name}: action not found.",
|
35
|
-
}
|
33
|
+
return success
|
36
34
|
|
37
35
|
logger.info(
|
38
36
|
"{}.perform_action: {} == {} on {}".format(
|
@@ -47,6 +45,4 @@ def perform_action(
|
|
47
45
|
script=script,
|
48
46
|
)
|
49
47
|
|
50
|
-
return action_object.perform(
|
51
|
-
node_name=node_name,
|
52
|
-
)
|
48
|
+
return action_object.perform(node_name=node_name)
|
{blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/script/actions/generate_image.py
RENAMED
@@ -12,13 +12,10 @@ class GenerateImageAction(GenericAction):
|
|
12
12
|
def perform(
|
13
13
|
self,
|
14
14
|
node_name: str,
|
15
|
-
) ->
|
16
|
-
|
17
|
-
|
18
|
-
return success, generic_metadata
|
15
|
+
) -> bool:
|
16
|
+
if not super().perform(node_name=node_name):
|
17
|
+
return False
|
19
18
|
|
20
19
|
logger.info(f"🪄 generating image ...: {node_name}")
|
21
|
-
metadata = {}
|
22
20
|
|
23
|
-
|
24
|
-
return True, metadata
|
21
|
+
return True
|
@@ -0,0 +1,93 @@
|
|
1
|
+
from typing import Dict, Tuple, List
|
2
|
+
from openai import OpenAI
|
3
|
+
import pprint
|
4
|
+
|
5
|
+
from blueness import module
|
6
|
+
from blue_objects import file
|
7
|
+
from openai_commands.env import OPENAI_API_KEY
|
8
|
+
|
9
|
+
from blue_assistant import NAME
|
10
|
+
from blue_assistant.env import BLUE_ASSISTANT_DEFAULT_MODEL, BLUE_ASSISTANT_MAX_TOKEN
|
11
|
+
from blue_assistant.script.actions.generic import GenericAction
|
12
|
+
from blue_assistant.logger import logger
|
13
|
+
|
14
|
+
NAME = module.name(__file__, NAME)
|
15
|
+
|
16
|
+
|
17
|
+
class GenerateTextAction(GenericAction):
|
18
|
+
name = file.name(__file__)
|
19
|
+
|
20
|
+
def perform(
|
21
|
+
self,
|
22
|
+
node_name: str,
|
23
|
+
) -> bool:
|
24
|
+
if not OPENAI_API_KEY:
|
25
|
+
logger.error("OPENAI_API_KEY is not set.")
|
26
|
+
return False
|
27
|
+
|
28
|
+
if not super().perform(node_name=node_name):
|
29
|
+
return False
|
30
|
+
|
31
|
+
messages: List = []
|
32
|
+
node_context = self.script.get_history(node_name)
|
33
|
+
logger.info("node context: {}".format(" -> ".join(node_context)))
|
34
|
+
for successor in reversed(node_context):
|
35
|
+
messages += [
|
36
|
+
{
|
37
|
+
"role": "user",
|
38
|
+
"content": [
|
39
|
+
{
|
40
|
+
"type": "text",
|
41
|
+
"text": self.script.apply_vars(
|
42
|
+
self.script.nodes[successor]["prompt"]
|
43
|
+
),
|
44
|
+
}
|
45
|
+
],
|
46
|
+
}
|
47
|
+
]
|
48
|
+
|
49
|
+
if self.script.nodes[successor]["completed"]:
|
50
|
+
messages += [
|
51
|
+
{
|
52
|
+
"role": "assistant",
|
53
|
+
"content": [
|
54
|
+
{
|
55
|
+
"type": "text",
|
56
|
+
"text": self.script.nodes[successor]["output"],
|
57
|
+
}
|
58
|
+
],
|
59
|
+
}
|
60
|
+
]
|
61
|
+
|
62
|
+
if self.script.verbose:
|
63
|
+
logger.info(f"messages: {pprint.pformat(messages)}")
|
64
|
+
|
65
|
+
client = OpenAI(api_key=OPENAI_API_KEY)
|
66
|
+
|
67
|
+
try:
|
68
|
+
response = client.chat.completions.create(
|
69
|
+
messages=messages,
|
70
|
+
model=BLUE_ASSISTANT_DEFAULT_MODEL,
|
71
|
+
max_tokens=BLUE_ASSISTANT_MAX_TOKEN,
|
72
|
+
)
|
73
|
+
except Exception as e:
|
74
|
+
logger.error(str(e))
|
75
|
+
return False
|
76
|
+
|
77
|
+
if self.script.verbose:
|
78
|
+
logger.info("response: {}".format(response))
|
79
|
+
|
80
|
+
if not response.choices:
|
81
|
+
logger.error("no choice.")
|
82
|
+
return False
|
83
|
+
|
84
|
+
output = response.choices[0].message.content
|
85
|
+
logger.info(f"🗣️ output: {output}")
|
86
|
+
|
87
|
+
self.script.nodes[node_name]["output"] = output
|
88
|
+
|
89
|
+
var_name = self.script.nodes[node_name].get("output", "")
|
90
|
+
if var_name:
|
91
|
+
self.script.vars[var_name] = output
|
92
|
+
|
93
|
+
return True
|
@@ -22,7 +22,7 @@ class GenericAction:
|
|
22
22
|
def perform(
|
23
23
|
self,
|
24
24
|
node_name: str,
|
25
|
-
) ->
|
25
|
+
) -> bool:
|
26
26
|
logger.info(
|
27
27
|
"{}.perform({}) on {}.{} ...".format(
|
28
28
|
NAME,
|
@@ -31,4 +31,4 @@ class GenericAction:
|
|
31
31
|
node_name,
|
32
32
|
),
|
33
33
|
)
|
34
|
-
return True
|
34
|
+
return True
|
{blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/script/repository/generic/classes.py
RENAMED
@@ -25,20 +25,16 @@ class GenericScript(BaseScript):
|
|
25
25
|
if not super().run():
|
26
26
|
return False
|
27
27
|
|
28
|
-
metadata: Dict[Dict] = {"nodes": {}}
|
29
28
|
success: bool = True
|
30
|
-
while (
|
31
|
-
|
32
|
-
|
33
|
-
):
|
34
|
-
for node_name in tqdm(self.G.nodes):
|
35
|
-
if self.G.nodes[node_name]["completed"]:
|
29
|
+
while not all(self.nodes[node]["completed"] for node in self.nodes) and success:
|
30
|
+
for node_name in tqdm(self.nodes):
|
31
|
+
if self.nodes[node_name]["completed"]:
|
36
32
|
continue
|
37
33
|
|
38
34
|
pending_dependencies = [
|
39
35
|
node_name_
|
40
36
|
for node_name_ in self.G.successors(node_name)
|
41
|
-
if not self.
|
37
|
+
if not self.nodes[node_name_]["completed"]
|
42
38
|
]
|
43
39
|
if pending_dependencies:
|
44
40
|
logger.info(
|
@@ -50,22 +46,19 @@ class GenericScript(BaseScript):
|
|
50
46
|
)
|
51
47
|
continue
|
52
48
|
|
53
|
-
|
49
|
+
if not perform_action(
|
54
50
|
script=self,
|
55
51
|
node_name=node_name,
|
56
|
-
)
|
57
|
-
|
58
|
-
metadata["nodes"][node_name] = {
|
59
|
-
"success": success,
|
60
|
-
"output": output,
|
61
|
-
}
|
62
|
-
if not success:
|
52
|
+
):
|
53
|
+
success = False
|
63
54
|
break
|
64
55
|
|
56
|
+
self.nodes[node_name]["completed"] = True
|
57
|
+
|
65
58
|
if not post_to_object(
|
66
59
|
self.object_name,
|
67
60
|
"output",
|
68
|
-
metadata,
|
61
|
+
self.metadata,
|
69
62
|
):
|
70
63
|
return False
|
71
64
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: blue_assistant
|
3
|
-
Version: 4.
|
3
|
+
Version: 4.78.1
|
4
4
|
Summary: 🧠 An AI Assistant.
|
5
5
|
Home-page: https://github.com/kamangir/blue-assistant
|
6
6
|
Author: Arash Abadpour (Kamangir)
|
@@ -72,4 +72,4 @@ graph LR
|
|
72
72
|
|
73
73
|
[](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)
|
74
74
|
|
75
|
-
built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🧠 [`blue_assistant-4.
|
75
|
+
built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🧠 [`blue_assistant-4.78.1`](https://github.com/kamangir/blue-assistant).
|
@@ -1,66 +0,0 @@
|
|
1
|
-
from typing import Dict, Tuple
|
2
|
-
from openai import OpenAI
|
3
|
-
|
4
|
-
from blueness import module
|
5
|
-
from blue_objects import file
|
6
|
-
from openai_commands.env import OPENAI_API_KEY
|
7
|
-
|
8
|
-
from blue_assistant import NAME
|
9
|
-
from blue_assistant.env import BLUE_ASSISTANT_DEFAULT_MODEL, BLUE_ASSISTANT_MAX_TOKEN
|
10
|
-
from blue_assistant.script.actions.generic import GenericAction
|
11
|
-
from blue_assistant.logger import logger
|
12
|
-
|
13
|
-
NAME = module.name(__file__, NAME)
|
14
|
-
|
15
|
-
|
16
|
-
class GenerateTextAction(GenericAction):
|
17
|
-
name = file.name(__file__)
|
18
|
-
|
19
|
-
def perform(
|
20
|
-
self,
|
21
|
-
node_name: str,
|
22
|
-
) -> Tuple[bool, Dict]:
|
23
|
-
metadata = {}
|
24
|
-
|
25
|
-
if not OPENAI_API_KEY:
|
26
|
-
logger.error("OPENAI_API_KEY is not set.")
|
27
|
-
return False, {}
|
28
|
-
|
29
|
-
success, generic_metadata = super().perform(node_name=node_name)
|
30
|
-
if not success:
|
31
|
-
return success, generic_metadata
|
32
|
-
|
33
|
-
client = OpenAI(api_key=OPENAI_API_KEY)
|
34
|
-
|
35
|
-
try:
|
36
|
-
response = client.chat.completions.create(
|
37
|
-
messages=[
|
38
|
-
{
|
39
|
-
"role": "user",
|
40
|
-
"content": [
|
41
|
-
{
|
42
|
-
"type": "text",
|
43
|
-
"text": self.script.nodes[node_name]["prompt"],
|
44
|
-
}
|
45
|
-
],
|
46
|
-
}
|
47
|
-
],
|
48
|
-
model=BLUE_ASSISTANT_DEFAULT_MODEL,
|
49
|
-
max_tokens=BLUE_ASSISTANT_MAX_TOKEN,
|
50
|
-
)
|
51
|
-
except Exception as e:
|
52
|
-
logger.error(str(e))
|
53
|
-
return False, {"error": str(e)}
|
54
|
-
|
55
|
-
if self.script.verbose:
|
56
|
-
logger.info("response: {}".format(response))
|
57
|
-
|
58
|
-
if not response.choices:
|
59
|
-
logger.error("no choice.")
|
60
|
-
return False, {}
|
61
|
-
|
62
|
-
metadata["reply"] = response.choices[0].message.content
|
63
|
-
logger.info("🗣️ reply: {}".format(metadata["reply"]))
|
64
|
-
|
65
|
-
metadata.update(generic_metadata)
|
66
|
-
return True, metadata
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/script/repository/__init__.py
RENAMED
File without changes
|
File without changes
|
{blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/script/repository/blue_amo/classes.py
RENAMED
File without changes
|
{blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant/script/repository/generic/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{blue_assistant-4.62.1 → blue_assistant-4.78.1}/blue_assistant.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|