blue-assistant 4.121.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.
blue_assistant/README.py CHANGED
@@ -14,12 +14,18 @@ items = [
14
14
  item["description"],
15
15
  )
16
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
+ },
17
23
  {
18
24
  "title": "blue-amo",
19
25
  "url": "./blue_assistant/script/repository/blue_amo/README.md",
20
26
  "marquee": "https://github.com/kamangir/assets/raw/main/blue-amo-2025-02-03-nswnx6/stitching_the_frames-2.png?raw=true",
21
- "description": "story-telling with AI",
22
- }
27
+ "description": "A story developed and visualized, by AI.",
28
+ },
23
29
  ]
24
30
  ]
25
31
 
@@ -36,6 +42,7 @@ def build():
36
42
  )
37
43
  for readme in [
38
44
  {"items": items, "path": ".."},
39
- {"path": "script/repository/blue_amo/README.md"},
45
+ {"path": "script/repository/blue_amo"},
46
+ {"path": "script/repository/orbital_data_explorer"},
40
47
  ]
41
48
  )
@@ -4,7 +4,7 @@ ICON = "🧠"
4
4
 
5
5
  DESCRIPTION = f"{ICON} An AI Assistant."
6
6
 
7
- VERSION = "4.121.1"
7
+ VERSION = "4.137.1"
8
8
 
9
9
  REPO_NAME = "blue-assistant"
10
10
 
@@ -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 @@
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.121.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
@@ -67,13 +71,9 @@ graph LR
67
71
  classDef folder fill:#999,stroke:#333,stroke-width:2px;
68
72
  ```
69
73
 
70
- | |
71
- | --- |
72
- | [`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) story-telling with AI |
73
-
74
74
  ---
75
75
 
76
76
 
77
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)
78
78
 
79
- built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🧠 [`blue_assistant-4.121.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=Z_T2b3tcugn2-oCcb0uqEBbva1ydY_kZ7u-ipH5Nt3g,1060
2
- blue_assistant/__init__.py,sha256=gBWYfpEKu8JsBKhR0TdNZ2DsfpC8fPQJx3oltGBoSk8,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
@@ -33,7 +33,9 @@ blue_assistant/script/actions/generate_image.py,sha256=1OtDAXcFijTXUwZqfpw0375pC
33
33
  blue_assistant/script/actions/generate_text.py,sha256=xenvUISPKoq3rkzrBZIlRhQh7s7PTkchTTMdcyybe24,2394
34
34
  blue_assistant/script/actions/generic.py,sha256=ET1RaKcUABM8HdIv8JecSpUFasYqmwHacL-5LjF-8NM,355
35
35
  blue_assistant/script/actions/skip.py,sha256=G9gbGBbOLiCqcsmEUobdoxkB6wohFYmyi1arQGorZSg,352
36
- blue_assistant/script/repository/__init__.py,sha256=WFkbe-6yyljpmeVpXgLhOPt-YRc7BwkRNzPO-7Wz0Dg,573
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
37
39
  blue_assistant/script/repository/blue_amo/__init__.py,sha256=WjL9GIlN-DBnbUMJ8O_FxTp0rcVGlsIS3H9YtXEefTk,76
38
40
  blue_assistant/script/repository/blue_amo/classes.py,sha256=vWQ_qMdJ2LmpEjDGFnSxOMZPd34yj-DX4UUTnx5aMtY,2082
39
41
  blue_assistant/script/repository/blue_amo/actions/__init__.py,sha256=je2S21KvYB3QkbABs71parwUh8MCh2mdlNZfLx_QuDg,430
@@ -41,10 +43,14 @@ blue_assistant/script/repository/blue_amo/actions/slicing_into_frames.py,sha256=
41
43
  blue_assistant/script/repository/blue_amo/actions/stitching_the_frames.py,sha256=mbXriat6deEAmuo5Y1ValySnUXDENR7TZS_3nVPlQ6M,3622
42
44
  blue_assistant/script/repository/generic/__init__.py,sha256=kLffGsQMQAFJTw6IZBE5eBxvshP1x9wwHHR4hsDJblo,75
43
45
  blue_assistant/script/repository/generic/classes.py,sha256=XuUhtBdY85ZGdMR9IcZ7nScJmQ2IDhJBbhyMv3amDHc,2265
44
- blue_assistant/script/repository/moon_datasets/__init__.py,sha256=aCtmP2avh3yKAJ668S3GsLR9vbBOm5zt9FSFCqy_tAs,86
45
- blue_assistant/script/repository/moon_datasets/classes.py,sha256=68zThDhjF9gGRnsw8EKNLGOMBFbCSljt0jGovuOzCAc,197
46
- blue_assistant-4.121.1.dist-info/LICENSE,sha256=ogEPNDSH0_dhiv_lT3ifVIdgIzHAqNA_SemnxUfPBJk,7048
47
- blue_assistant-4.121.1.dist-info/METADATA,sha256=WEP68rkZElk6gmoZ7G27BUdyM3KjBo_n1pdHFWDv91A,3032
48
- blue_assistant-4.121.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
49
- blue_assistant-4.121.1.dist-info/top_level.txt,sha256=ud0BkBbdOVze13bNqHuhZj1rwCztaBtDf5ChEYzASOs,15
50
- blue_assistant-4.121.1.dist-info/RECORD,,
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 +0,0 @@
1
- from blue_assistant.script.repository.moon_datasets.classes import MiningOnMoonScript