blue-assistant 4.104.1__py3-none-any.whl → 4.137.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.
Files changed (29) hide show
  1. blue_assistant/README.py +22 -7
  2. blue_assistant/__init__.py +1 -1
  3. blue_assistant/script/actions/__init__.py +13 -11
  4. blue_assistant/script/actions/generate_image.py +42 -48
  5. blue_assistant/script/actions/generate_text.py +52 -64
  6. blue_assistant/script/actions/generic.py +9 -21
  7. blue_assistant/script/actions/skip.py +15 -0
  8. blue_assistant/script/repository/__init__.py +4 -2
  9. blue_assistant/script/repository/base/__init__.py +0 -0
  10. blue_assistant/script/repository/base/classes.py +137 -0
  11. blue_assistant/script/repository/blue_amo/actions/__init__.py +13 -0
  12. blue_assistant/script/repository/blue_amo/actions/{slice_into_frames.py → slicing_into_frames.py} +5 -3
  13. blue_assistant/script/repository/blue_amo/actions/{stitch_the_frames.py → stitching_the_frames.py} +2 -2
  14. blue_assistant/script/repository/blue_amo/classes.py +7 -18
  15. blue_assistant/script/repository/generic/classes.py +8 -18
  16. blue_assistant/script/repository/hue/__init__.py +1 -0
  17. blue_assistant/script/repository/{moon_datasets → hue}/classes.py +1 -1
  18. blue_assistant/script/repository/orbital_data_explorer/__init__.py +3 -0
  19. blue_assistant/script/repository/orbital_data_explorer/actions/__init__.py +11 -0
  20. blue_assistant/script/repository/orbital_data_explorer/actions/researching_the_questions.py +18 -0
  21. blue_assistant/script/repository/orbital_data_explorer/classes.py +25 -0
  22. {blue_assistant-4.104.1.dist-info → blue_assistant-4.137.1.dist-info}/METADATA +7 -3
  23. {blue_assistant-4.104.1.dist-info → blue_assistant-4.137.1.dist-info}/RECORD +26 -21
  24. blue_assistant/script/actions/functions.py +0 -22
  25. blue_assistant/script/actions/wip.py +0 -7
  26. blue_assistant/script/repository/moon_datasets/__init__.py +0 -1
  27. {blue_assistant-4.104.1.dist-info → blue_assistant-4.137.1.dist-info}/LICENSE +0 -0
  28. {blue_assistant-4.104.1.dist-info → blue_assistant-4.137.1.dist-info}/WHEEL +0 -0
  29. {blue_assistant-4.104.1.dist-info → blue_assistant-4.137.1.dist-info}/top_level.txt +0 -0
blue_assistant/README.py CHANGED
@@ -6,13 +6,27 @@ from blue_assistant import NAME, VERSION, ICON, REPO_NAME
6
6
 
7
7
 
8
8
  items = [
9
- "{}[`{}`](#) [![image]({})](#) {}".format(
10
- ICON,
11
- f"feature {index}",
12
- "https://github.com/kamangir/assets/raw/main/blue-assistant/marquee.png?raw=true",
13
- f"description of feature {index} ...",
9
+ "[`{}`]({}) [![image]({})]({}) {}".format(
10
+ item["title"],
11
+ item["url"],
12
+ item["marquee"],
13
+ item["url"],
14
+ item["description"],
14
15
  )
15
- for index in range(1, 4)
16
+ for item in [
17
+ {
18
+ "title": "orbital-data-explorer",
19
+ "url": "./blue_assistant/script/repository/orbital_data_explorer/README.md",
20
+ "marquee": "https://github.com/kamangir/assets/raw/main/blue-plugin/marquee.png?raw=true",
21
+ "description": "Access to the [Orbital Data Explorer](https://ode.rsl.wustl.edu/), through AI.",
22
+ },
23
+ {
24
+ "title": "blue-amo",
25
+ "url": "./blue_assistant/script/repository/blue_amo/README.md",
26
+ "marquee": "https://github.com/kamangir/assets/raw/main/blue-amo-2025-02-03-nswnx6/stitching_the_frames-2.png?raw=true",
27
+ "description": "A story developed and visualized, by AI.",
28
+ },
29
+ ]
16
30
  ]
17
31
 
18
32
 
@@ -28,6 +42,7 @@ def build():
28
42
  )
29
43
  for readme in [
30
44
  {"items": items, "path": ".."},
31
- {"path": "docs/blue-amo.md"},
45
+ {"path": "script/repository/blue_amo"},
46
+ {"path": "script/repository/orbital_data_explorer"},
32
47
  ]
33
48
  )
@@ -4,7 +4,7 @@ ICON = "🧠"
4
4
 
5
5
  DESCRIPTION = f"{ICON} An AI Assistant."
6
6
 
7
- VERSION = "4.104.1"
7
+ VERSION = "4.137.1"
8
8
 
9
9
  REPO_NAME = "blue-assistant"
10
10
 
@@ -1,14 +1,16 @@
1
- from typing import List
1
+ from typing import Dict, Callable, Tuple
2
2
 
3
- from blue_assistant.script.actions.generic import GenericAction
4
- from blue_assistant.script.actions.generate_image import GenerateImageAction
5
- from blue_assistant.script.actions.generate_text import GenerateTextAction
6
- from blue_assistant.script.actions.wip import WorkInProgressAction
3
+ from blue_assistant.script.repository.base.classes import BaseScript
4
+ from blue_assistant.script.actions.generic import generic_action
5
+ from blue_assistant.script.actions.generate_image import generate_image
6
+ from blue_assistant.script.actions.generate_text import generate_text
7
+ from blue_assistant.script.actions.skip import skip_action
7
8
  from blue_assistant.logger import logger
8
9
 
9
- list_of_actions: List[GenericAction] = [
10
- GenericAction,
11
- GenerateImageAction,
12
- GenerateTextAction,
13
- WorkInProgressAction,
14
- ]
10
+
11
+ dict_of_actions: Dict[str, Callable[[BaseScript, str], bool]] = {
12
+ "generic_action": generic_action,
13
+ "generate_image": generate_image,
14
+ "generate_text": generate_text,
15
+ "skip": skip_action,
16
+ }
@@ -1,58 +1,52 @@
1
- from blue_objects import file, objects
1
+ from blueness import module
2
+ from blue_objects import objects
2
3
  from openai_commands.image_generation.api import OpenAIImageGenerator
3
4
 
5
+ from blue_assistant import NAME
4
6
  from blue_assistant.env import (
5
7
  BLUE_ASSISTANT_IMAGE_DEFAULT_MODEL,
6
8
  BLUE_ASSISTANT_IMAGE_DEFAULT_SIZE,
7
9
  BLUE_ASSISTANT_IMAGE_DEFAULT_QUALITY,
8
10
  )
9
- from blue_assistant.script.actions.generic import GenericAction
10
11
  from blue_assistant.script.repository.base.classes import BaseScript
11
12
  from blue_assistant.logger import logger
12
13
 
13
-
14
- class GenerateImageAction(GenericAction):
15
- name = file.name(__file__)
16
-
17
- def __init__(
18
- self,
19
- script: BaseScript,
20
- ):
21
- super().__init__(script=script)
22
-
23
- self.generator = OpenAIImageGenerator(
24
- model=BLUE_ASSISTANT_IMAGE_DEFAULT_MODEL,
25
- verbose=self.script.verbose,
26
- )
27
-
28
- # https://platform.openai.com/docs/guides/images
29
- def perform(
30
- self,
31
- node_name: str,
32
- ) -> bool:
33
- if not super().perform(node_name=node_name):
34
- return False
35
-
36
- filename = f"{node_name}.png"
37
-
38
- success = self.generator.generate(
39
- prompt=self.script.nodes[node_name]["prompt"],
40
- filename=objects.path_of(
41
- filename=filename,
42
- object_name=self.script.object_name,
43
- create=True,
44
- ),
45
- quality=(
46
- BLUE_ASSISTANT_IMAGE_DEFAULT_QUALITY if self.script.test_mode else "hd"
47
- ),
48
- size=(
49
- BLUE_ASSISTANT_IMAGE_DEFAULT_SIZE
50
- if self.script.test_mode
51
- else "1792x1024"
52
- ),
53
- )[0]
54
-
55
- if success:
56
- self.script.nodes[node_name]["filename"] = filename
57
-
58
- return success
14
+ NAME = module.name(__file__, NAME)
15
+
16
+
17
+ # https://platform.openai.com/docs/guides/images
18
+ def generate_image(
19
+ script: BaseScript,
20
+ node_name: str,
21
+ ) -> bool:
22
+ logger.info(f"{NAME}: {script} @ {node_name} ...")
23
+
24
+ generator = OpenAIImageGenerator(
25
+ model=BLUE_ASSISTANT_IMAGE_DEFAULT_MODEL,
26
+ verbose=script.verbose,
27
+ )
28
+
29
+ filename = f"{node_name}.png"
30
+
31
+ success = generator.generate(
32
+ prompt=script.nodes[node_name]["prompt"],
33
+ filename=objects.path_of(
34
+ filename=filename,
35
+ object_name=script.object_name,
36
+ create=True,
37
+ ),
38
+ quality=(BLUE_ASSISTANT_IMAGE_DEFAULT_QUALITY if script.test_mode else "hd"),
39
+ size=(BLUE_ASSISTANT_IMAGE_DEFAULT_SIZE if script.test_mode else "1792x1024"),
40
+ sign_with_prompt=False,
41
+ footer=[
42
+ script.nodes[node_name].get(
43
+ "summary_prompt",
44
+ script.nodes[node_name]["prompt"],
45
+ )
46
+ ],
47
+ )[0]
48
+
49
+ if success:
50
+ script.nodes[node_name]["filename"] = filename
51
+
52
+ return success
@@ -1,97 +1,85 @@
1
- from typing import Dict, Tuple, List
1
+ from typing import List
2
2
  from openai import OpenAI
3
3
  import pprint
4
4
 
5
5
  from blueness import module
6
- from blue_objects import file
7
6
  from openai_commands.env import OPENAI_API_KEY
8
7
 
9
8
  from blue_assistant import NAME
9
+ from blue_assistant.script.repository.base.classes import BaseScript
10
10
  from blue_assistant.env import (
11
11
  BLUE_ASSISTANT_TEXT_DEFAULT_MODEL,
12
12
  BLUE_ASSISTANT_TEXT_MAX_TOKEN,
13
13
  )
14
- from blue_assistant.script.actions.generic import GenericAction
15
14
  from blue_assistant.logger import logger
16
15
 
17
16
  NAME = module.name(__file__, NAME)
18
17
 
19
18
 
20
- class GenerateTextAction(GenericAction):
21
- name = file.name(__file__)
22
-
23
- # https://platform.openai.com/docs/guides/text-generation
24
- def perform(
25
- self,
26
- node_name: str,
27
- ) -> bool:
28
- if not OPENAI_API_KEY:
29
- logger.error("OPENAI_API_KEY is not set.")
30
- return False
31
-
32
- if not super().perform(node_name=node_name):
33
- return False
19
+ # https://platform.openai.com/docs/guides/text-generation
20
+ def generate_text(
21
+ script: BaseScript,
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
+ logger.info(f"{NAME}: {script} @ {node_name} ...")
29
+
30
+ messages: List = []
31
+ list_of_context_nodes = script.get_history(node_name)
32
+ logger.info("node context: {}".format(" <- ".join(list_of_context_nodes)))
33
+ for context_node in reversed(list_of_context_nodes):
34
+ messages += [
35
+ {
36
+ "role": "user",
37
+ "content": [
38
+ {
39
+ "type": "text",
40
+ "text": script.apply_vars(script.nodes[context_node]["prompt"]),
41
+ }
42
+ ],
43
+ }
44
+ ]
34
45
 
35
- messages: List = []
36
- list_of_context_nodes = self.script.get_history(node_name)
37
- logger.info("node context: {}".format(" <- ".join(list_of_context_nodes)))
38
- for context_node in reversed(list_of_context_nodes):
46
+ if script.nodes[context_node].get("completed", False):
39
47
  messages += [
40
48
  {
41
- "role": "user",
49
+ "role": "assistant",
42
50
  "content": [
43
51
  {
44
52
  "type": "text",
45
- "text": self.script.apply_vars(
46
- self.script.nodes[context_node]["prompt"]
47
- ),
53
+ "text": script.nodes[context_node]["output"],
48
54
  }
49
55
  ],
50
56
  }
51
57
  ]
52
58
 
53
- if self.script.nodes[context_node].get("completed", False):
54
- messages += [
55
- {
56
- "role": "assistant",
57
- "content": [
58
- {
59
- "type": "text",
60
- "text": self.script.nodes[context_node]["output"],
61
- }
62
- ],
63
- }
64
- ]
65
-
66
- if self.script.verbose:
67
- logger.info(f"messages: {pprint.pformat(messages)}")
68
-
69
- client = OpenAI(api_key=OPENAI_API_KEY)
70
-
71
- try:
72
- response = client.chat.completions.create(
73
- messages=messages,
74
- model=BLUE_ASSISTANT_TEXT_DEFAULT_MODEL,
75
- max_tokens=BLUE_ASSISTANT_TEXT_MAX_TOKEN,
76
- )
77
- except Exception as e:
78
- logger.error(str(e))
79
- return False
59
+ if script.verbose:
60
+ logger.info(f"messages: {pprint.pformat(messages)}")
80
61
 
81
- if self.script.verbose:
82
- logger.info("response: {}".format(response))
62
+ client = OpenAI(api_key=OPENAI_API_KEY)
83
63
 
84
- if not response.choices:
85
- logger.error("no choice.")
86
- return False
64
+ try:
65
+ response = client.chat.completions.create(
66
+ messages=messages,
67
+ model=BLUE_ASSISTANT_TEXT_DEFAULT_MODEL,
68
+ max_tokens=BLUE_ASSISTANT_TEXT_MAX_TOKEN,
69
+ )
70
+ except Exception as e:
71
+ logger.error(str(e))
72
+ return False
87
73
 
88
- output = response.choices[0].message.content
89
- logger.info(f"🗣️ output: {output}")
74
+ if script.verbose:
75
+ logger.info("response: {}".format(response))
90
76
 
91
- self.script.nodes[node_name]["output"] = output
77
+ if not response.choices:
78
+ logger.error("no choice.")
79
+ return False
92
80
 
93
- var_name = self.script.nodes[node_name].get("output", "")
94
- if var_name:
95
- self.script.vars[var_name] = output
81
+ output = response.choices[0].message.content
82
+ logger.info(f"🗣️ output: {output}")
83
+ script.nodes[node_name]["output"] = output
96
84
 
97
- return True
85
+ return True
@@ -1,27 +1,15 @@
1
- from blue_objects import file
1
+ from blueness import module
2
2
 
3
+ from blue_assistant import NAME
3
4
  from blue_assistant.script.repository.base.classes import BaseScript
4
5
  from blue_assistant.logger import logger
5
6
 
7
+ NAME = module.name(__file__, NAME)
6
8
 
7
- class GenericAction:
8
- name = file.name(__file__)
9
9
 
10
- def __init__(
11
- self,
12
- script: BaseScript,
13
- ):
14
- self.script = script
15
-
16
- def perform(
17
- self,
18
- node_name: str,
19
- ) -> bool:
20
- logger.info(
21
- "{}.perform on {}.{} ...".format(
22
- self.__class__.__name__,
23
- self.script.name,
24
- node_name,
25
- ),
26
- )
27
- return True
10
+ def generic_action(
11
+ script: BaseScript,
12
+ node_name: str,
13
+ ) -> bool:
14
+ logger.info(f"{NAME}: {script} @ {node_name} ...")
15
+ return True
@@ -0,0 +1,15 @@
1
+ from blueness import module
2
+
3
+ from blue_assistant import NAME
4
+ from blue_assistant.script.repository.base.classes import BaseScript
5
+ from blue_assistant.logger import logger
6
+
7
+ NAME = module.name(__file__, NAME)
8
+
9
+
10
+ def skip_action(
11
+ script: BaseScript,
12
+ node_name: str,
13
+ ) -> bool:
14
+ logger.info(f"{NAME}: {script} @ {node_name} ...")
15
+ return True
@@ -3,13 +3,15 @@ from typing import List, Type
3
3
  from blue_assistant.script.repository.generic.classes import GenericScript
4
4
  from blue_assistant.script.repository.blue_amo.classes import BlueAmoScript
5
5
  from blue_assistant.script.repository.hue.classes import HueScript
6
- from blue_assistant.script.repository.moon_datasets.classes import MiningOnMoonScript
6
+ from blue_assistant.script.repository.orbital_data_explorer.classes import (
7
+ OrbitalDataExplorerScript,
8
+ )
7
9
 
8
10
  list_of_script_classes: List[Type[GenericScript]] = [
9
11
  GenericScript,
10
12
  BlueAmoScript,
11
13
  HueScript,
12
- MiningOnMoonScript,
14
+ OrbitalDataExplorerScript,
13
15
  ]
14
16
 
15
17
  list_of_script_names: List[str] = [
File without changes
@@ -0,0 +1,137 @@
1
+ from typing import Dict, List
2
+ import os
3
+ import networkx as nx
4
+ from functools import reduce
5
+
6
+ from blueness import module
7
+ from blue_objects import file, objects
8
+ from blue_objects.metadata import post_to_object
9
+ from blueflow.workflow import dot_file
10
+
11
+ from blue_assistant import NAME
12
+ from blue_assistant.logger import logger
13
+
14
+
15
+ NAME = module.name(__file__, NAME)
16
+
17
+
18
+ class BaseScript:
19
+ name = "base"
20
+
21
+ def __init__(
22
+ self,
23
+ object_name: str,
24
+ test_mode: bool = False,
25
+ verbose: bool = False,
26
+ ):
27
+ self.object_name = object_name
28
+
29
+ self.test_mode = test_mode
30
+ if self.test_mode:
31
+ logger.info("💰 test mode is on.")
32
+
33
+ self.verbose = verbose
34
+
35
+ metadata_filename = os.path.join(
36
+ file.path(__file__),
37
+ f"../{self.name}",
38
+ "metadata.yaml",
39
+ )
40
+ self.metadata: Dict
41
+ success, self.metadata = file.load_yaml(metadata_filename)
42
+ assert success, f"cannot load {self.name}/metadata.yaml"
43
+
44
+ logger.info("loaded {} node(s)".format(len(self.nodes)))
45
+
46
+ logger.info("loaded {} variable(s)".format(len(self.vars)))
47
+ if verbose:
48
+ for var_name, var_value in self.vars.items():
49
+ logger.info("{}: {}".format(var_name, var_value))
50
+
51
+ assert self.generate_graph(), "cannot generate graph"
52
+
53
+ def apply_vars(self, text: str) -> str:
54
+ for var_name, var_value in self.vars.items():
55
+ text = text.replace(f":::{var_name}", str(var_value))
56
+
57
+ return text
58
+
59
+ def generate_graph(self) -> bool:
60
+ self.G: nx.DiGraph = nx.DiGraph()
61
+
62
+ list_of_nodes = list(self.nodes.keys())
63
+ for node in self.nodes.values():
64
+ list_of_nodes += node.get("depends-on", "").split(",")
65
+
66
+ list_of_nodes = list({node_name for node_name in list_of_nodes if node_name})
67
+ logger.info(
68
+ "{} node(s): {}".format(
69
+ len(list_of_nodes),
70
+ ", ".join(list_of_nodes),
71
+ )
72
+ )
73
+
74
+ for node_name in list_of_nodes:
75
+ self.G.add_node(node_name)
76
+
77
+ for node_name, node in self.nodes.items():
78
+ for dependency in node.get("depends-on", "").split(","):
79
+ if dependency:
80
+ self.G.add_edge(node_name, dependency)
81
+
82
+ return self.save_graph()
83
+
84
+ def get_history(
85
+ self,
86
+ node_name: str,
87
+ ) -> List[str]:
88
+ return reduce(
89
+ lambda x, y: x + y,
90
+ [self.get_history(successor) for successor in self.G.successors(node_name)],
91
+ [node_name],
92
+ )
93
+
94
+ def run(self) -> bool:
95
+ logger.info(
96
+ "{}.run: {}:{} -> {}".format(
97
+ NAME,
98
+ self.__class__.__name__,
99
+ self.name,
100
+ self.object_name,
101
+ )
102
+ )
103
+
104
+ return post_to_object(
105
+ self.object_name,
106
+ "script",
107
+ self.script,
108
+ )
109
+
110
+ def save_graph(self) -> bool:
111
+ return dot_file.save_to_file(
112
+ objects.path_of(
113
+ filename="workflow.dot",
114
+ object_name=self.object_name,
115
+ ),
116
+ self.G,
117
+ caption=" | ".join(
118
+ [
119
+ self.name,
120
+ self.object_name,
121
+ ]
122
+ ),
123
+ add_legend=False,
124
+ )
125
+
126
+ # Aliases
127
+ @property
128
+ def script(self) -> Dict:
129
+ return self.metadata.get("script", {})
130
+
131
+ @property
132
+ def nodes(self) -> Dict[str, Dict]:
133
+ return self.metadata.get("script", {}).get("nodes", {})
134
+
135
+ @property
136
+ def vars(self) -> Dict:
137
+ return self.metadata.get("script", {}).get("vars", {})
@@ -0,0 +1,13 @@
1
+ from typing import Dict, Callable
2
+
3
+ from blue_assistant.script.repository.base.classes import BaseScript
4
+ from blue_assistant.script.repository.blue_amo.actions import (
5
+ slicing_into_frames,
6
+ stitching_the_frames,
7
+ )
8
+
9
+
10
+ dict_of_actions: Dict[str, Callable[[BaseScript, str], bool]] = {
11
+ "slicing_into_frames": slicing_into_frames.slicing_into_frames,
12
+ "stitching_the_frames": stitching_the_frames.stitching_the_frames,
13
+ }
@@ -7,7 +7,7 @@ from blue_assistant.logger import logger
7
7
  NAME = module.name(__file__, NAME)
8
8
 
9
9
 
10
- def slice_into_frames(
10
+ def slicing_into_frames(
11
11
  script: BaseScript,
12
12
  node_name: str,
13
13
  ) -> bool:
@@ -25,11 +25,13 @@ def slice_into_frames(
25
25
  list_of_frame_prompts += script.vars["frame_count"] * [""]
26
26
 
27
27
  for index in range(script.vars["frame_count"]):
28
- node_name = f"generating-frame-{index+1:03d}"
28
+ node_name = f"generating_frame_{index+1:03d}"
29
+
30
+ script.nodes[node_name]["summary_prompt"] = list_of_frame_prompts[index]
29
31
 
30
32
  script.nodes[node_name]["prompt"] = (
31
33
  script.nodes[node_name]["prompt"]
32
- .replace(":::story", script.nodes["generating-the-story"]["output"])
34
+ .replace(":::story", " ".join(list_of_frame_prompts[:index]))
33
35
  .replace(":::input", list_of_frame_prompts[index])
34
36
  )
35
37
 
@@ -15,7 +15,7 @@ from blue_assistant.logger import logger
15
15
  NAME = module.name(__file__, NAME)
16
16
 
17
17
 
18
- def stitch_the_frames(
18
+ def stitching_the_frames(
19
19
  script: BaseScript,
20
20
  node_name: str,
21
21
  ) -> bool:
@@ -24,7 +24,7 @@ def stitch_the_frames(
24
24
  for filename in [
25
25
  script.nodes[node_name_].get("filename", "")
26
26
  for node_name_ in [
27
- f"generating-frame-{index+1:03d}"
27
+ f"generating_frame_{index+1:03d}"
28
28
  for index in range(script.vars["frame_count"])
29
29
  ]
30
30
  ]
@@ -5,12 +5,7 @@ from blue_objects import file, path
5
5
 
6
6
  from blue_assistant import NAME
7
7
  from blue_assistant.script.repository.generic.classes import GenericScript
8
- from blue_assistant.script.repository.blue_amo.actions.slice_into_frames import (
9
- slice_into_frames,
10
- )
11
- from blue_assistant.script.repository.blue_amo.actions.stitch_the_frames import (
12
- stitch_the_frames,
13
- )
8
+ from blue_assistant.script.repository.blue_amo.actions import dict_of_actions
14
9
  from blue_assistant.logger import logger
15
10
 
16
11
  NAME = module.name(__file__, NAME)
@@ -34,7 +29,7 @@ class BlueAmoScript(GenericScript):
34
29
  if self.test_mode:
35
30
  self.vars["frame_count"] = 1
36
31
 
37
- holder_node_name = "generating-the-frames"
32
+ holder_node_name = "generating_the_frames"
38
33
  logger.info(
39
34
  "{}: expanding {} X {}...".format(
40
35
  NAME,
@@ -47,19 +42,19 @@ class BlueAmoScript(GenericScript):
47
42
  del self.nodes[holder_node_name]
48
43
  self.G.remove_node(holder_node_name)
49
44
 
50
- reduce_node = "stitching-the-frames"
45
+ reduce_node = "stitching_the_frames"
51
46
  self.G.add_node(reduce_node)
52
47
  self.nodes[reduce_node] = {"action": "skip"}
53
48
 
54
49
  for index in range(self.vars["frame_count"]):
55
- node_name = f"generating-frame-{index+1:03d}"
50
+ node_name = f"generating_frame_{index+1:03d}"
56
51
 
57
52
  self.nodes[node_name] = copy.deepcopy(holder_node)
58
53
 
59
54
  self.G.add_node(node_name)
60
55
  self.G.add_edge(
61
56
  node_name,
62
- "slicing-into-frames",
57
+ "slicing_into_frames",
63
58
  )
64
59
  self.G.add_edge(
65
60
  reduce_node,
@@ -75,14 +70,8 @@ class BlueAmoScript(GenericScript):
75
70
  if not super().perform_action(node_name=node_name):
76
71
  return False
77
72
 
78
- if node_name == "slicing-into-frames":
79
- return slice_into_frames(
80
- script=self,
81
- node_name=node_name,
82
- )
83
-
84
- if node_name == "stitching-the-frames":
85
- return stitch_the_frames(
73
+ if node_name in dict_of_actions:
74
+ return dict_of_actions[node_name](
86
75
  script=self,
87
76
  node_name=node_name,
88
77
  )
@@ -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 get_action_class
12
+ from blue_assistant.script.actions import dict_of_actions
13
13
  from blue_assistant.logger import logger
14
14
 
15
15
 
@@ -24,25 +24,15 @@ class GenericScript(BaseScript):
24
24
  node_name: str,
25
25
  ) -> bool:
26
26
  action_name = self.nodes[node_name].get("action", "unknown")
27
- if action_name == "skip":
28
- return True
29
-
30
- success, action_class = get_action_class(action_name=action_name)
31
- if not success:
32
- return success
33
-
34
- logger.info(
35
- "{}.perform_action: {} == {} on {}".format(
36
- NAME,
37
- action_name,
38
- action_class.__name__,
39
- node_name,
40
- )
41
- )
42
27
 
43
- action_object = action_class(script=self)
28
+ if action_name not in dict_of_actions:
29
+ logger.error(f"{action_name}: action not found.")
30
+ return False
44
31
 
45
- return action_object.perform(node_name=node_name)
32
+ return dict_of_actions[action_name](
33
+ script=self,
34
+ node_name=node_name,
35
+ )
46
36
 
47
37
  def run(
48
38
  self,
@@ -0,0 +1 @@
1
+ from blue_assistant.script.repository.blue_amo.classes import BlueAmoScript
@@ -3,5 +3,5 @@ from blue_objects import file, path
3
3
  from blue_assistant.script.repository.generic.classes import GenericScript
4
4
 
5
5
 
6
- class MiningOnMoonScript(GenericScript):
6
+ class HueScript(GenericScript):
7
7
  name = path.name(file.path(__file__))
@@ -0,0 +1,3 @@
1
+ from blue_assistant.script.repository.orbital_data_explorer.classes import (
2
+ OrbitalDataExplorerScript,
3
+ )
@@ -0,0 +1,11 @@
1
+ from typing import Dict, Callable
2
+
3
+ from blue_assistant.script.repository.base.classes import BaseScript
4
+ from blue_assistant.script.repository.orbital_data_explorer.actions import (
5
+ researching_the_questions,
6
+ )
7
+
8
+
9
+ dict_of_actions: Dict[str, Callable[[BaseScript, str], bool]] = {
10
+ "researching_the_questions": researching_the_questions.researching_the_questions,
11
+ }
@@ -0,0 +1,18 @@
1
+ from blueness import module
2
+
3
+ from blue_assistant import NAME
4
+ from blue_assistant.script.repository.base.classes import BaseScript
5
+ from blue_assistant.logger import logger
6
+
7
+ NAME = module.name(__file__, NAME)
8
+
9
+
10
+ def researching_the_questions(
11
+ script: BaseScript,
12
+ node_name: str,
13
+ ) -> bool:
14
+ logger.info(f"{NAME}: ...")
15
+
16
+ logger.info("🪄")
17
+
18
+ return True
@@ -0,0 +1,25 @@
1
+ from blue_objects import file, path
2
+
3
+ from blue_assistant.script.repository.generic.classes import GenericScript
4
+ from blue_assistant.script.repository.orbital_data_explorer.actions import (
5
+ dict_of_actions,
6
+ )
7
+
8
+
9
+ class OrbitalDataExplorerScript(GenericScript):
10
+ name = path.name(file.path(__file__))
11
+
12
+ def perform_action(
13
+ self,
14
+ node_name: str,
15
+ ) -> bool:
16
+ if not super().perform_action(node_name=node_name):
17
+ return False
18
+
19
+ if node_name in dict_of_actions:
20
+ return dict_of_actions[node_name](
21
+ script=self,
22
+ node_name=node_name,
23
+ )
24
+
25
+ return True
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: blue_assistant
3
- Version: 4.104.1
3
+ Version: 4.137.1
4
4
  Summary: 🧠 An AI Assistant.
5
5
  Home-page: https://github.com/kamangir/blue-assistant
6
6
  Author: Arash Abadpour (Kamangir)
@@ -44,7 +44,11 @@ Dynamic: summary
44
44
 
45
45
  # 🧠 blue-assistant
46
46
 
47
- 🧠 `@assistant` is an AI assistant.
47
+ 🧠 `@assistant` runs AI scripts; DAGs that combine deterministic and AI operations, such as below,
48
+
49
+ | | |
50
+ | --- | --- |
51
+ | [`orbital-data-explorer`](https://raw.githubusercontent.com/kamangir/blue-assistant/main/blue_assistant/script/repository/orbital_data_explorer/README.md) [![image](https://github.com/kamangir/assets/raw/main/blue-plugin/marquee.png?raw=true)](https://raw.githubusercontent.com/kamangir/blue-assistant/main/blue_assistant/script/repository/orbital_data_explorer/README.md) Access to the [Orbital Data Explorer](https://ode.rsl.wustl.edu/), through AI. | [`blue-amo`](https://raw.githubusercontent.com/kamangir/blue-assistant/main/blue_assistant/script/repository/blue_amo/README.md) [![image](https://github.com/kamangir/assets/raw/main/blue-amo-2025-02-03-nswnx6/stitching_the_frames-2.png?raw=true)](https://raw.githubusercontent.com/kamangir/blue-assistant/main/blue_assistant/script/repository/blue_amo/README.md) A story developed and visualized, by AI. |
48
52
 
49
53
  ```bash
50
54
  pip install blue-assistant
@@ -72,4 +76,4 @@ graph LR
72
76
 
73
77
  [![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
78
 
75
- built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🧠 [`blue_assistant-4.104.1`](https://github.com/kamangir/blue-assistant).
79
+ built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🧠 [`blue_assistant-4.137.1`](https://github.com/kamangir/blue-assistant).
@@ -1,5 +1,5 @@
1
- blue_assistant/README.py,sha256=wuyPT8Y6xkoyPN96Iptozup2PFRkB3v_rVEW4oeiQck,792
2
- blue_assistant/__init__.py,sha256=0n0ztAso_mLbL04NjlhSjpR_nS_yWQBrI43iM6zHUaE,311
1
+ blue_assistant/README.py,sha256=aB7xoxE3SpI_QbXzJRqh9R-QSWFJSfX3JG-ZY5nfDD4,1503
2
+ blue_assistant/__init__.py,sha256=ah6uFi0CCkvh6f_cyoIYiWwK5fRvvR3d7-ne585JBlw,311
3
3
  blue_assistant/__main__.py,sha256=URtal70XZc0--3FDTYWcLtnGOqBYjMX9gt-L1k8hDXI,361
4
4
  blue_assistant/config.env,sha256=gjGYkDkmzpwgy7_J-i9RclTKZsKtaAibn7mavD9l4u8,210
5
5
  blue_assistant/env.py,sha256=h2goHjsspOLjZ44yFHqHLB7wPl_GCodg3D6yfSE5FfM,732
@@ -28,24 +28,29 @@ blue_assistant/help/script.py,sha256=tofv49tIBqoH8ed9hDCFHqzWaXmyyPofvqElk2n976w
28
28
  blue_assistant/script/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
29
  blue_assistant/script/__main__.py,sha256=eOSOo5yYTPMwIXZ0GkuWkmOcsDWrZtHvClyJizXSk2w,1657
30
30
  blue_assistant/script/load.py,sha256=JsDY9T3HTM9vXngvKsA0Mt_erxAnRR_jI62-JhrOBMU,831
31
- blue_assistant/script/actions/__init__.py,sha256=8Sp6avoJGDXVORvx5mvkxTNaxjz_KevKN4Wb8qLZHsQ,487
32
- blue_assistant/script/actions/functions.py,sha256=nazOu20plxxxUIcr1YCpNiWn4zmcGCCWcojWxLnZtl8,669
33
- blue_assistant/script/actions/generate_image.py,sha256=wvj3V10gWe_rcxh5xIT3JZ2I-Uwgh_Rl_E73JLsenUc,1695
34
- blue_assistant/script/actions/generate_text.py,sha256=EeE57DAbAj3n7VDUzFn1kT8LJCwHIQvg-Ds8unxicEQ,2971
35
- blue_assistant/script/actions/generic.py,sha256=9VCnJ9u1eT3H63Ihg6SRpKrWNw5MPa6MLP16QYl6HaE,577
36
- blue_assistant/script/actions/wip.py,sha256=K4kJE4bn3u6o-QWTESPydO_eD54zOwZbU9WLAO94z1Q,171
37
- blue_assistant/script/repository/__init__.py,sha256=WFkbe-6yyljpmeVpXgLhOPt-YRc7BwkRNzPO-7Wz0Dg,573
31
+ blue_assistant/script/actions/__init__.py,sha256=W0PisTP1H0RRqivzwiaXlN-kvE3m1xlJtn5WGZ-PFtg,625
32
+ blue_assistant/script/actions/generate_image.py,sha256=1OtDAXcFijTXUwZqfpw0375pCTQ3ooFvD2dYJxwFJSg,1513
33
+ blue_assistant/script/actions/generate_text.py,sha256=xenvUISPKoq3rkzrBZIlRhQh7s7PTkchTTMdcyybe24,2394
34
+ blue_assistant/script/actions/generic.py,sha256=ET1RaKcUABM8HdIv8JecSpUFasYqmwHacL-5LjF-8NM,355
35
+ blue_assistant/script/actions/skip.py,sha256=G9gbGBbOLiCqcsmEUobdoxkB6wohFYmyi1arQGorZSg,352
36
+ blue_assistant/script/repository/__init__.py,sha256=zVI3cubRqM9H6WgF0EUP9idILVLCumPFmJgKPM7iVlM,604
37
+ blue_assistant/script/repository/base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
+ blue_assistant/script/repository/base/classes.py,sha256=xYF-6W0TV_AfZHvRcB9lK-O5-Z45uPu6ETOIzxXWwvw,3717
38
39
  blue_assistant/script/repository/blue_amo/__init__.py,sha256=WjL9GIlN-DBnbUMJ8O_FxTp0rcVGlsIS3H9YtXEefTk,76
39
- blue_assistant/script/repository/blue_amo/classes.py,sha256=SK3kNk14cZ8M7-aU3tQtbrTQLcw-ev_KtNR8J0U7QZY,2382
40
- blue_assistant/script/repository/blue_amo/actions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
- blue_assistant/script/repository/blue_amo/actions/slice_into_frames.py,sha256=nhlF1MEa-MvCxP3EQ-J7CzcZ8-NqV6fux_r-O_D2cc0,1124
42
- blue_assistant/script/repository/blue_amo/actions/stitch_the_frames.py,sha256=jGn6SwLdJA98vG7aspI8J3f0_361XVsHm-7T9vTB2tc,3619
40
+ blue_assistant/script/repository/blue_amo/classes.py,sha256=vWQ_qMdJ2LmpEjDGFnSxOMZPd34yj-DX4UUTnx5aMtY,2082
41
+ blue_assistant/script/repository/blue_amo/actions/__init__.py,sha256=je2S21KvYB3QkbABs71parwUh8MCh2mdlNZfLx_QuDg,430
42
+ blue_assistant/script/repository/blue_amo/actions/slicing_into_frames.py,sha256=79SI7_69FKKLeX_jHlfXnUWGtG4Sj7sBJOfeFwK8I9U,1201
43
+ blue_assistant/script/repository/blue_amo/actions/stitching_the_frames.py,sha256=mbXriat6deEAmuo5Y1ValySnUXDENR7TZS_3nVPlQ6M,3622
43
44
  blue_assistant/script/repository/generic/__init__.py,sha256=kLffGsQMQAFJTw6IZBE5eBxvshP1x9wwHHR4hsDJblo,75
44
- blue_assistant/script/repository/generic/classes.py,sha256=7XIbzwMFFLr79NcVHi53uRPznw2wkQIF8UQ1-KAdNAY,2540
45
- blue_assistant/script/repository/moon_datasets/__init__.py,sha256=aCtmP2avh3yKAJ668S3GsLR9vbBOm5zt9FSFCqy_tAs,86
46
- blue_assistant/script/repository/moon_datasets/classes.py,sha256=68zThDhjF9gGRnsw8EKNLGOMBFbCSljt0jGovuOzCAc,197
47
- blue_assistant-4.104.1.dist-info/LICENSE,sha256=ogEPNDSH0_dhiv_lT3ifVIdgIzHAqNA_SemnxUfPBJk,7048
48
- blue_assistant-4.104.1.dist-info/METADATA,sha256=h7zZuR9WIKGKNZ1m4WZA2zxrSLUV4HkcezeCLm9ZNms,2627
49
- blue_assistant-4.104.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
50
- blue_assistant-4.104.1.dist-info/top_level.txt,sha256=ud0BkBbdOVze13bNqHuhZj1rwCztaBtDf5ChEYzASOs,15
51
- blue_assistant-4.104.1.dist-info/RECORD,,
45
+ blue_assistant/script/repository/generic/classes.py,sha256=XuUhtBdY85ZGdMR9IcZ7nScJmQ2IDhJBbhyMv3amDHc,2265
46
+ blue_assistant/script/repository/hue/__init__.py,sha256=WjL9GIlN-DBnbUMJ8O_FxTp0rcVGlsIS3H9YtXEefTk,76
47
+ blue_assistant/script/repository/hue/classes.py,sha256=YhifmcuylnZuI0_BjBPmwrSbsO-BOHDHNJ0pSLIExiE,188
48
+ blue_assistant/script/repository/orbital_data_explorer/__init__.py,sha256=yy5FtCeHlr9dRfqxw4QYWr7_yRjnQpwVyuAY2vLrh4Q,110
49
+ blue_assistant/script/repository/orbital_data_explorer/classes.py,sha256=i4cVCR6ge8FhipPs-H1HZ_5xcok4mzxrqwRr_hLz_UI,657
50
+ blue_assistant/script/repository/orbital_data_explorer/actions/__init__.py,sha256=RcrFUAwnvhuwNh3gC65w9G26vd_cIa7LV1lFvGFcigk,370
51
+ blue_assistant/script/repository/orbital_data_explorer/actions/researching_the_questions.py,sha256=Wb8sU9UmdRRhHUhNj7_VQ74_Bio20xGajzeGz4HJqZQ,369
52
+ blue_assistant-4.137.1.dist-info/LICENSE,sha256=ogEPNDSH0_dhiv_lT3ifVIdgIzHAqNA_SemnxUfPBJk,7048
53
+ blue_assistant-4.137.1.dist-info/METADATA,sha256=Yi8WBxMoH0hJxHnRo5RuWMuDHd4X5004aASCU6LaoBA,3578
54
+ blue_assistant-4.137.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
55
+ blue_assistant-4.137.1.dist-info/top_level.txt,sha256=ud0BkBbdOVze13bNqHuhZj1rwCztaBtDf5ChEYzASOs,15
56
+ blue_assistant-4.137.1.dist-info/RECORD,,
@@ -1,22 +0,0 @@
1
- from typing import List, Dict, Tuple, Type
2
-
3
- from blueness import module
4
- from blue_assistant.script.actions.generic import GenericAction
5
- from blue_assistant.script.repository.base.classes import BaseScript
6
- from blue_assistant.script.actions import list_of_actions
7
-
8
- from blue_assistant import NAME
9
- from blue_assistant.logger import logger
10
-
11
- NAME = module.name(__file__, NAME)
12
-
13
-
14
- def get_action_class(
15
- action_name: str,
16
- ) -> Tuple[bool, Type[GenericAction]]:
17
- for action_class in list_of_actions:
18
- if action_class.name == action_name:
19
- return True, action_class
20
-
21
- logger.error(f"{action_name}: action not found.")
22
- return False, GenericAction
@@ -1,7 +0,0 @@
1
- from blue_objects import file
2
-
3
- from blue_assistant.script.actions.generic import GenericAction
4
-
5
-
6
- class WorkInProgressAction(GenericAction):
7
- name = file.name(__file__)
@@ -1 +0,0 @@
1
- from blue_assistant.script.repository.moon_datasets.classes import MiningOnMoonScript