blue-assistant 4.66.1__py3-none-any.whl → 4.87.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.
@@ -4,7 +4,7 @@ ICON = "🧠"
4
4
 
5
5
  DESCRIPTION = f"{ICON} An AI Assistant."
6
6
 
7
- VERSION = "4.66.1"
7
+ VERSION = "4.87.1"
8
8
 
9
9
  REPO_NAME = "blue-assistant"
10
10
 
@@ -28,7 +28,7 @@ parser.add_argument(
28
28
  parser.add_argument(
29
29
  "--verbose",
30
30
  type=int,
31
- default=1,
31
+ default=0,
32
32
  help="0 | 1",
33
33
  )
34
34
  parser.add_argument(
@@ -20,29 +20,3 @@ def get_action_class(
20
20
 
21
21
  logger.error(f"{action_name}: action not found.")
22
22
  return False, GenericAction
23
-
24
-
25
- def perform_action(
26
- script: BaseScript,
27
- node_name: str,
28
- ) -> bool:
29
- action_name = script.nodes[node_name].get("action", "unknown")
30
-
31
- success, action_class = get_action_class(action_name=action_name)
32
- if not success:
33
- return success
34
-
35
- logger.info(
36
- "{}.perform_action: {} == {} on {}".format(
37
- NAME,
38
- action_name,
39
- action_class.__name__,
40
- node_name,
41
- )
42
- )
43
-
44
- action_object = action_class(
45
- script=script,
46
- )
47
-
48
- return action_object.perform(node_name=node_name)
@@ -29,9 +29,9 @@ class GenerateTextAction(GenericAction):
29
29
  return False
30
30
 
31
31
  messages: List = []
32
- node_history = self.script.get_history(node_name)
33
- logger.info("node history: {}".format(node_history))
34
- for successor in reversed(node_history):
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
35
  messages += [
36
36
  {
37
37
  "role": "user",
@@ -46,7 +46,7 @@ class GenerateTextAction(GenericAction):
46
46
  }
47
47
  ]
48
48
 
49
- if self.script.G.nodes[successor]["completed"]:
49
+ if self.script.nodes[successor]["completed"]:
50
50
  messages += [
51
51
  {
52
52
  "role": "assistant",
@@ -84,7 +84,7 @@ class GenerateTextAction(GenericAction):
84
84
  output = response.choices[0].message.content
85
85
  logger.info(f"🗣️ output: {output}")
86
86
 
87
- self.script.G.nodes[node_name]["output"] = output
87
+ self.script.nodes[node_name]["output"] = output
88
88
 
89
89
  var_name = self.script.nodes[node_name].get("output", "")
90
90
  if var_name:
@@ -1,5 +1,5 @@
1
1
  from blue_objects import file, path
2
-
2
+ import copy
3
3
 
4
4
  from blue_assistant.script.repository.generic.classes import GenericScript
5
5
  from blue_assistant.logger import logger
@@ -7,3 +7,32 @@ from blue_assistant.logger import logger
7
7
 
8
8
  class BlueAmoScript(GenericScript):
9
9
  name = path.name(file.path(__file__))
10
+
11
+ def __init__(
12
+ self,
13
+ object_name: str,
14
+ verbose: bool = False,
15
+ ):
16
+ super().__init__(
17
+ object_name=object_name,
18
+ verbose=verbose,
19
+ )
20
+
21
+ holder_node_name = "generating-the-frames"
22
+
23
+ holder_node = self.nodes[holder_node_name]
24
+ del self.nodes[holder_node_name]
25
+ self.G.remove_node(holder_node_name)
26
+
27
+ for index in range(self.vars["frame_count"]):
28
+ node_name = f"generating-frame-{index+1:03d}"
29
+
30
+ self.nodes[node_name] = copy.deepcopy(holder_node)
31
+
32
+ self.G.add_node(node_name)
33
+ self.G.add_edge(
34
+ node_name,
35
+ "slicing-into-frames",
36
+ )
37
+
38
+ assert self.save_graph()
@@ -9,7 +9,7 @@ from blue_objects.metadata import post_to_object
9
9
 
10
10
  from blue_assistant import NAME
11
11
  from blue_assistant.script.repository.base.classes import BaseScript
12
- from blue_assistant.script.actions.functions import perform_action
12
+ from blue_assistant.script.actions.functions import get_action_class
13
13
  from blue_assistant.logger import logger
14
14
 
15
15
 
@@ -19,26 +19,45 @@ NAME = module.name(__file__, NAME)
19
19
  class GenericScript(BaseScript):
20
20
  name = path.name(file.path(__file__))
21
21
 
22
+ def perform_action(
23
+ self,
24
+ node_name: str,
25
+ ) -> bool:
26
+ action_name = self.nodes[node_name].get("action", "unknown")
27
+
28
+ success, action_class = get_action_class(action_name=action_name)
29
+ if not success:
30
+ return success
31
+
32
+ logger.info(
33
+ "{}.perform_action: {} == {} on {}".format(
34
+ NAME,
35
+ action_name,
36
+ action_class.__name__,
37
+ node_name,
38
+ )
39
+ )
40
+
41
+ action_object = action_class(script=self)
42
+
43
+ return action_object.perform(node_name=node_name)
44
+
22
45
  def run(
23
46
  self,
24
47
  ) -> bool:
25
48
  if not super().run():
26
49
  return False
27
50
 
28
- metadata: Dict[Dict] = {"nodes": {}}
29
51
  success: bool = True
30
- while (
31
- not all(self.G.nodes[node]["completed"] for node in self.G.nodes)
32
- and success
33
- ):
34
- for node_name in tqdm(self.G.nodes):
35
- if self.G.nodes[node_name]["completed"]:
52
+ while not all(self.nodes[node]["completed"] for node in self.nodes) and success:
53
+ for node_name in tqdm(self.nodes):
54
+ if self.nodes[node_name]["completed"]:
36
55
  continue
37
56
 
38
57
  pending_dependencies = [
39
58
  node_name_
40
59
  for node_name_ in self.G.successors(node_name)
41
- if not self.G.nodes[node_name_]["completed"]
60
+ if not self.nodes[node_name_]["completed"]
42
61
  ]
43
62
  if pending_dependencies:
44
63
  logger.info(
@@ -50,19 +69,16 @@ class GenericScript(BaseScript):
50
69
  )
51
70
  continue
52
71
 
53
- if not perform_action(
54
- script=self,
55
- node_name=node_name,
56
- ):
72
+ if not self.perform_action(node_name=node_name):
57
73
  success = False
58
74
  break
59
75
 
60
- self.G.nodes[node_name]["completed"] = True
76
+ self.nodes[node_name]["completed"] = True
61
77
 
62
78
  if not post_to_object(
63
79
  self.object_name,
64
80
  "output",
65
- metadata,
81
+ self.metadata,
66
82
  ):
67
83
  return False
68
84
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: blue_assistant
3
- Version: 4.66.1
3
+ Version: 4.87.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
  [![pylint](https://github.com/kamangir/blue-assistant/actions/workflows/pylint.yml/badge.svg)](https://github.com/kamangir/blue-assistant/actions/workflows/pylint.yml) [![pytest](https://github.com/kamangir/blue-assistant/actions/workflows/pytest.yml/badge.svg)](https://github.com/kamangir/blue-assistant/actions/workflows/pytest.yml) [![bashtest](https://github.com/kamangir/blue-assistant/actions/workflows/bashtest.yml/badge.svg)](https://github.com/kamangir/blue-assistant/actions/workflows/bashtest.yml) [![PyPI version](https://img.shields.io/pypi/v/blue-assistant.svg)](https://pypi.org/project/blue-assistant/) [![PyPI - Downloads](https://img.shields.io/pypi/dd/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.66.1`](https://github.com/kamangir/blue-assistant).
75
+ built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🧠 [`blue_assistant-4.87.1`](https://github.com/kamangir/blue-assistant).
@@ -1,5 +1,5 @@
1
1
  blue_assistant/README.py,sha256=Nzr3v-VSa8CISkqkLHd8ILyY_WiJ7x2igYPH-lYpzEY,795
2
- blue_assistant/__init__.py,sha256=0v_LdK6vN-oGFPitqPD_ntVE3VlcyYyrddqz4xbjDnM,310
2
+ blue_assistant/__init__.py,sha256=bHmdRdS7buZRGyYFPR7olkJj3ivLxtWFzxIOMAGY3ZY,310
3
3
  blue_assistant/__main__.py,sha256=URtal70XZc0--3FDTYWcLtnGOqBYjMX9gt-L1k8hDXI,361
4
4
  blue_assistant/config.env,sha256=JV9zx17FflIPmV1hK-yuM0GlrUjkGuaQ_EzPFPTkoXM,66
5
5
  blue_assistant/env.py,sha256=rgIlKVsALrRD1sYJV3SkFfzIvWNavix2HN0sSy2cCi4,391
@@ -26,23 +26,23 @@ blue_assistant/help/__main__.py,sha256=cVejR7OpoWPg0qLbm-PZf5TuJS27x49jzfiyCLyzE
26
26
  blue_assistant/help/functions.py,sha256=9WsmXGMN-R7sqlkGLK0nY90Peg8Gah4rIu75QbLhImo,689
27
27
  blue_assistant/help/script.py,sha256=wvS_5FWu9LAsaDDq7UoxXEadRwGseYqwu2P-9dNc5Bo,1077
28
28
  blue_assistant/script/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
- blue_assistant/script/__main__.py,sha256=D5APoSVe-l5H0Nrgyq5do4cSbmRyYmflq1x_Dd5d1fM,1529
29
+ blue_assistant/script/__main__.py,sha256=immGrRfasPHdPDxZJweu0coi_V0jg8_2zfqTnRxNfaU,1529
30
30
  blue_assistant/script/load.py,sha256=Bd5L9HBL0Yh1MLGAyGrQX3XQLH-UiOWLsHJvzCmNs3g,773
31
31
  blue_assistant/script/actions/__init__.py,sha256=8Sp6avoJGDXVORvx5mvkxTNaxjz_KevKN4Wb8qLZHsQ,487
32
- blue_assistant/script/actions/functions.py,sha256=0fiihOWbFiwZEXV6t9oxJaxJ5E5X-k3weqGTOKTu3sA,1233
32
+ blue_assistant/script/actions/functions.py,sha256=nazOu20plxxxUIcr1YCpNiWn4zmcGCCWcojWxLnZtl8,669
33
33
  blue_assistant/script/actions/generate_image.py,sha256=bGDdP9XfBtFFFNL4d7DA7_FJvsFKadPOgwVAXkFgyjE,477
34
- blue_assistant/script/actions/generate_text.py,sha256=rKDjY_keN_E_vdboQ_SqG2APyUanpAKRDVGCxzghO3k,2817
34
+ blue_assistant/script/actions/generate_text.py,sha256=-RShuIAYvRVLtOsuAW9XRrxeaU9NPUYGYWrYUyJo_tc,2826
35
35
  blue_assistant/script/actions/generic.py,sha256=dIjqocIEpLEb1BI76kHivVpDUG5QpeZHLA2onsYn1SU,731
36
36
  blue_assistant/script/actions/wip.py,sha256=K4kJE4bn3u6o-QWTESPydO_eD54zOwZbU9WLAO94z1Q,171
37
37
  blue_assistant/script/repository/__init__.py,sha256=WFkbe-6yyljpmeVpXgLhOPt-YRc7BwkRNzPO-7Wz0Dg,573
38
38
  blue_assistant/script/repository/blue_amo/__init__.py,sha256=WjL9GIlN-DBnbUMJ8O_FxTp0rcVGlsIS3H9YtXEefTk,76
39
- blue_assistant/script/repository/blue_amo/classes.py,sha256=RY1gjZVPX8xu7nfeiZoTL8RTpu73RsoaNv4ZoGv9NNs,234
39
+ blue_assistant/script/repository/blue_amo/classes.py,sha256=LlbdXlQfV3WRqooirmgSENa5NKjfllfCvi0JWlhR3SA,994
40
40
  blue_assistant/script/repository/generic/__init__.py,sha256=kLffGsQMQAFJTw6IZBE5eBxvshP1x9wwHHR4hsDJblo,75
41
- blue_assistant/script/repository/generic/classes.py,sha256=X6h-cWFleUQF9flyq6ClYSdi5ysGOTsy156w8jT1wvY,1964
41
+ blue_assistant/script/repository/generic/classes.py,sha256=3E5OrRSvI98y51zfVFYZV8bnoaPXyu3bU_IruIX6G34,2413
42
42
  blue_assistant/script/repository/moon_datasets/__init__.py,sha256=aCtmP2avh3yKAJ668S3GsLR9vbBOm5zt9FSFCqy_tAs,86
43
43
  blue_assistant/script/repository/moon_datasets/classes.py,sha256=68zThDhjF9gGRnsw8EKNLGOMBFbCSljt0jGovuOzCAc,197
44
- blue_assistant-4.66.1.dist-info/LICENSE,sha256=ogEPNDSH0_dhiv_lT3ifVIdgIzHAqNA_SemnxUfPBJk,7048
45
- blue_assistant-4.66.1.dist-info/METADATA,sha256=o9HM9_F9s8xZ0lhJhtngCE2qqdbASHaRGOMzhuFw4XE,2625
46
- blue_assistant-4.66.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
47
- blue_assistant-4.66.1.dist-info/top_level.txt,sha256=ud0BkBbdOVze13bNqHuhZj1rwCztaBtDf5ChEYzASOs,15
48
- blue_assistant-4.66.1.dist-info/RECORD,,
44
+ blue_assistant-4.87.1.dist-info/LICENSE,sha256=ogEPNDSH0_dhiv_lT3ifVIdgIzHAqNA_SemnxUfPBJk,7048
45
+ blue_assistant-4.87.1.dist-info/METADATA,sha256=iEwfKly_X4g_d-UOeGVnY4yQcaFuJ_YfIbqmRW5ZCeo,2625
46
+ blue_assistant-4.87.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
47
+ blue_assistant-4.87.1.dist-info/top_level.txt,sha256=ud0BkBbdOVze13bNqHuhZj1rwCztaBtDf5ChEYzASOs,15
48
+ blue_assistant-4.87.1.dist-info/RECORD,,