blue-assistant 4.243.1__py3-none-any.whl → 4.268.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
@@ -1,14 +1,28 @@
1
1
  import os
2
2
 
3
+ from blue_options.help.functions import get_help
3
4
  from blue_objects import file, README
4
5
 
5
6
  from blue_assistant import NAME, VERSION, ICON, REPO_NAME
7
+ from blue_assistant.help.functions import help_functions
6
8
 
7
9
 
8
10
  items = README.Items(
9
11
  [
10
12
  {
11
- "name": "hue",
13
+ "name": "orbital-data-explorer",
14
+ "url": "./blue_assistant/script/repository/orbital_data_explorer",
15
+ "marquee": "https://github.com/kamangir/assets/blob/main/blue-assistant/orbital-data-explorer.png?raw=true",
16
+ "description": "Access to the [Orbital Data Explorer](https://ode.rsl.wustl.edu/). 🔥",
17
+ },
18
+ {
19
+ "name": "🌀 blue script",
20
+ "marquee": "https://github.com/kamangir/assets/raw/main/blue-plugin/marquee.png?raw=true",
21
+ "description": "A minimal AI DAG interface.",
22
+ "url": "./blue_assistant/script/",
23
+ },
24
+ {
25
+ "name": "@hue",
12
26
  "url": "./blue_assistant/script/repository/hue",
13
27
  "marquee": "https://github.com/kamangir/assets/raw/main/blue-assistant/20250314_143702.jpg?raw=true",
14
28
  "description": '"send a color command to the Hue LED lights in my apartment."',
@@ -17,13 +31,7 @@ items = README.Items(
17
31
  "name": "blue-amo",
18
32
  "url": "./blue_assistant/script/repository/blue_amo/README.md",
19
33
  "marquee": "https://github.com/kamangir/assets/raw/main/blue-amo-2025-02-03-nswnx6/stitching_the_frames-2.png?raw=true",
20
- "description": "A story developed and visualized, by AI.",
21
- },
22
- {
23
- "name": "orbital-data-explorer",
24
- "url": "./blue_assistant/script/repository/orbital_data_explorer",
25
- "marquee": "https://github.com/kamangir/assets/blob/main/blue-assistant/orbital-data-explorer.png?raw=true",
26
- "description": "Access to the [Orbital Data Explorer](https://ode.rsl.wustl.edu/), through AI. ⏸️",
34
+ "description": "Story development and visualization.",
27
35
  },
28
36
  ]
29
37
  )
@@ -39,6 +47,11 @@ def build():
39
47
  NAME=NAME,
40
48
  VERSION=VERSION,
41
49
  REPO_NAME=REPO_NAME,
50
+ help_function=lambda tokens: get_help(
51
+ tokens,
52
+ help_functions,
53
+ mono=True,
54
+ ),
42
55
  )
43
56
  for readme in [
44
57
  {
@@ -54,6 +67,7 @@ def build():
54
67
  {"path": "script/repository/hue/docs/round-1.md"},
55
68
  {"path": "script/repository/hue/docs"},
56
69
  #
70
+ {"path": "script/"},
57
71
  {"path": "web/"},
58
72
  ]
59
73
  )
@@ -4,7 +4,7 @@ ICON = "🧠"
4
4
 
5
5
  DESCRIPTION = f"{ICON} An AI Assistant."
6
6
 
7
- VERSION = "4.243.1"
7
+ VERSION = "4.268.1"
8
8
 
9
9
  REPO_NAME = "blue-assistant"
10
10
 
@@ -1,14 +1,15 @@
1
- from typing import Dict, Callable, Tuple
1
+ from typing import Dict, Callable
2
2
 
3
3
  from blue_assistant.script.repository.base.classes import BaseScript
4
4
  from blue_assistant.script.actions.generic import generic_action
5
5
  from blue_assistant.script.actions.generate_image import generate_image
6
6
  from blue_assistant.script.actions.generate_text import generate_text
7
- from blue_assistant.logger import logger
7
+ from blue_assistant.script.actions.web_crawl import web_crawl
8
8
 
9
9
 
10
10
  dict_of_actions: Dict[str, Callable[[BaseScript, str], bool]] = {
11
11
  "generic": generic_action,
12
12
  "generate_image": generate_image,
13
13
  "generate_text": generate_text,
14
+ "web_crawl": web_crawl,
14
15
  }
@@ -2,6 +2,7 @@ from typing import Dict
2
2
  from blueness import module
3
3
  from tqdm import tqdm
4
4
 
5
+ from blue_options.logger import log_list
5
6
  from openai_commands.text_generation import api
6
7
 
7
8
  from blue_assistant import NAME
@@ -13,14 +14,31 @@ from blue_assistant.logger import logger
13
14
  NAME = module.name(__file__, NAME)
14
15
 
15
16
 
16
- def researching_the_questions(
17
+ def web_crawl(
17
18
  script: BaseScript,
18
19
  node_name: str,
19
20
  ) -> bool:
20
- logger.info(f"{NAME}: ...")
21
+ logger.info(f"{NAME}: {script} @ {node_name} ...")
22
+
23
+ seed_url_var_name = script.nodes[node_name].get("seed_urls", "")
24
+ if not isinstance(seed_url_var_name, str):
25
+ logger.error(f"{node_name}: seed_urls must be a string.")
26
+ return False
27
+ # to allow both :::<var-name> and <var-name> - for convenience :)
28
+ if seed_url_var_name.startswith(":::"):
29
+ seed_url_var_name = seed_url_var_name[3:].strip()
30
+ if not seed_url_var_name:
31
+ logger.error(f"{node_name}: seed_urls not found.")
32
+ return False
33
+ if seed_url_var_name not in script.vars:
34
+ logger.error(f"{node_name}: {seed_url_var_name}: seed_urls not found in vars.")
35
+ return False
36
+
37
+ seed_urls = script.vars[seed_url_var_name]
38
+ log_list(logger, seed_urls, "seed url(s)")
21
39
 
22
40
  visited_urls = crawl_list_of_urls(
23
- seed_urls=script.vars["seed_urls"],
41
+ seed_urls=seed_urls,
24
42
  object_name=script.object_name,
25
43
  max_iterations=script.nodes[node_name]["max_iterations"],
26
44
  )
@@ -27,8 +27,6 @@ class BaseScript:
27
27
  self.object_name = object_name
28
28
 
29
29
  self.test_mode = test_mode
30
- if self.test_mode:
31
- logger.info("💰 test mode is on.")
32
30
 
33
31
  self.verbose = verbose
34
32
 
@@ -41,14 +39,70 @@ class BaseScript:
41
39
  success, self.metadata = file.load_yaml(metadata_filename)
42
40
  assert success, f"cannot load {self.name}/metadata.yaml"
43
41
 
44
- logger.info("loaded {} node(s)".format(len(self.nodes)))
42
+ self.metadata.setdefault("script", {})
43
+ assert isinstance(
44
+ self.script,
45
+ dict,
46
+ ), "script: expected dict, received {}.".format(
47
+ self.script.__class__.__name__,
48
+ )
49
+
50
+ self.script.setdefault("nodes", {})
51
+ assert isinstance(
52
+ self.nodes,
53
+ dict,
54
+ ), "nodes: expected dict, received {}.".format(
55
+ self.nodes.__class__.__name__,
56
+ )
57
+
58
+ self.script.setdefault("vars", {})
59
+ assert isinstance(
60
+ self.vars,
61
+ dict,
62
+ ), "vars: expected dict, received {}.".format(
63
+ self.vars.__class__.__name__,
64
+ )
65
+
66
+ if self.test_mode:
67
+ logger.info("🧪 test mode is on.")
68
+
69
+ for node_name, node in self.nodes.items():
70
+ if "test_mode" in self.script:
71
+ updates = self.script["test_mode"]
72
+ logger.info(f"🧪 vars.update({updates})")
73
+ self.vars.update(updates)
74
+
75
+ if "test_mode" in node:
76
+ updates = node["test_mode"]
77
+ logger.info(f"🧪 {node_name}.update({updates})")
78
+ node.update(updates)
45
79
 
46
- logger.info("loaded {} variable(s)".format(len(self.vars)))
80
+ logger.info(
81
+ "loaded {} node(s): {}".format(
82
+ len(self.nodes),
83
+ ", ".join(self.nodes.keys()),
84
+ )
85
+ )
86
+
87
+ logger.info(
88
+ "loaded {} var(s){}".format(
89
+ len(self.vars),
90
+ "" if verbose else ": {}".format(", ".join(self.vars.keys())),
91
+ )
92
+ )
47
93
  if verbose:
48
94
  for var_name, var_value in self.vars.items():
49
95
  logger.info("{}: {}".format(var_name, var_value))
50
96
 
51
- assert self.generate_graph(), "cannot generate graph"
97
+ assert self.generate_graph(), "cannot generate graph."
98
+
99
+ def __str__(self) -> str:
100
+ return "{}[{} var(s), {} node(s) -> {}]".format(
101
+ self.__class__.__name__,
102
+ len(self.vars),
103
+ len(self.nodes),
104
+ self.object_name,
105
+ )
52
106
 
53
107
  def apply_vars(self, text: str) -> str:
54
108
  for var_name, var_value in self.vars.items():
@@ -126,12 +180,12 @@ class BaseScript:
126
180
  # Aliases
127
181
  @property
128
182
  def script(self) -> Dict:
129
- return self.metadata.get("script", {})
183
+ return self.metadata["script"]
130
184
 
131
185
  @property
132
186
  def nodes(self) -> Dict[str, Dict]:
133
- return self.metadata.get("script", {}).get("nodes", {})
187
+ return self.metadata["script"]["nodes"]
134
188
 
135
189
  @property
136
190
  def vars(self) -> Dict:
137
- return self.metadata.get("script", {}).get("vars", {})
191
+ return self.metadata["script"]["vars"]
@@ -1,40 +1,7 @@
1
1
  from blue_objects import file, path
2
2
 
3
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
4
 
8
5
 
9
6
  class OrbitalDataExplorerScript(GenericScript):
10
7
  name = path.name(file.path(__file__))
11
-
12
- def __init__(
13
- self,
14
- object_name: str,
15
- test_mode: bool = False,
16
- verbose: bool = False,
17
- ):
18
- super().__init__(
19
- object_name=object_name,
20
- test_mode=test_mode,
21
- verbose=verbose,
22
- )
23
-
24
- if self.test_mode:
25
- self.nodes["researching_the_questions"]["max_iterations"] = 3
26
-
27
- def perform_action(
28
- self,
29
- node_name: str,
30
- ) -> bool:
31
- if not super().perform_action(node_name=node_name):
32
- return False
33
-
34
- if node_name in dict_of_actions:
35
- return dict_of_actions[node_name](
36
- script=self,
37
- node_name=node_name,
38
- )
39
-
40
- return True
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: blue_assistant
3
- Version: 4.243.1
3
+ Version: 4.268.1
4
4
  Summary: 🧠 An AI Assistant.
5
5
  Home-page: https://github.com/kamangir/blue-assistant
6
6
  Author: Arash Abadpour (Kamangir)
@@ -112,8 +112,8 @@ graph LR
112
112
 
113
113
  | | |
114
114
  | --- | --- |
115
- | [`hue`](https://raw.githubusercontent.com/kamangir/blue-assistant/main/blue_assistant/script/repository/hue) [![image](https://github.com/kamangir/assets/raw/main/blue-assistant/20250314_143702.jpg?raw=true)](https://raw.githubusercontent.com/kamangir/blue-assistant/main/blue_assistant/script/repository/hue) "send a color command to the Hue LED lights in my apartment." | [`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. |
116
- | [`orbital-data-explorer`](https://raw.githubusercontent.com/kamangir/blue-assistant/main/blue_assistant/script/repository/orbital_data_explorer) [![image](https://github.com/kamangir/assets/blob/main/blue-assistant/orbital-data-explorer.png?raw=true)](https://raw.githubusercontent.com/kamangir/blue-assistant/main/blue_assistant/script/repository/orbital_data_explorer) Access to the [Orbital Data Explorer](https://ode.rsl.wustl.edu/), through AI. ⏸️ | |
115
+ | [`orbital-data-explorer`](https://raw.githubusercontent.com/kamangir/blue-assistant/main/blue_assistant/script/repository/orbital_data_explorer) [![image](https://github.com/kamangir/assets/blob/main/blue-assistant/orbital-data-explorer.png?raw=true)](https://raw.githubusercontent.com/kamangir/blue-assistant/main/blue_assistant/script/repository/orbital_data_explorer) Access to the [Orbital Data Explorer](https://ode.rsl.wustl.edu/). 🔥 | [`🌀 blue script`](https://raw.githubusercontent.com/kamangir/blue-assistant/main/blue_assistant/script/) [![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/) A minimal AI DAG interface. |
116
+ | [`@hue`](https://raw.githubusercontent.com/kamangir/blue-assistant/main/blue_assistant/script/repository/hue) [![image](https://github.com/kamangir/assets/raw/main/blue-assistant/20250314_143702.jpg?raw=true)](https://raw.githubusercontent.com/kamangir/blue-assistant/main/blue_assistant/script/repository/hue) "send a color command to the Hue LED lights in my apartment." | [`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 development and visualization. |
117
117
 
118
118
  ---
119
119
 
@@ -124,4 +124,4 @@ Also home to [`@web`](https://raw.githubusercontent.com/kamangir/blue-assistant/
124
124
 
125
125
  [![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)
126
126
 
127
- built by 🌀 [`blue_options-4.236.1`](https://github.com/kamangir/awesome-bash-cli), based on 🧠 [`blue_assistant-4.243.1`](https://github.com/kamangir/blue-assistant).
127
+ built by 🌀 [`blue_options-4.236.1`](https://github.com/kamangir/awesome-bash-cli), based on 🧠 [`blue_assistant-4.268.1`](https://github.com/kamangir/blue-assistant).
@@ -1,5 +1,5 @@
1
- blue_assistant/README.py,sha256=HIBukmtee6QW_oX-10mLX-0QrJoKECnEj79AXbqbDOs,2046
2
- blue_assistant/__init__.py,sha256=-mT913AX8fMIeCH6D0yVQhxEdzJMpO0SnmIcr1fH_iw,311
1
+ blue_assistant/README.py,sha256=EJORj3I5pucJplI86lrFaZBN5C9IYNgKoG_V7h27NHw,2586
2
+ blue_assistant/__init__.py,sha256=5VPcpYS8pA9i9Mzr1cjbFQudWPy0Fa0eMv4UD4wYQJw,311
3
3
  blue_assistant/__main__.py,sha256=URtal70XZc0--3FDTYWcLtnGOqBYjMX9gt-L1k8hDXI,361
4
4
  blue_assistant/config.env,sha256=npodyuuhkZUHUv9FnEiQQZkKxFbg8nQb1YpOCURqV3Y,301
5
5
  blue_assistant/env.py,sha256=FTSdJ8-J4jAyI0-h3MBgOweQBWd3YEFIibBHSXpClrY,760
@@ -39,13 +39,14 @@ blue_assistant/help/web.py,sha256=-vi1P3p6zKQFbQzg9qhUMsjtZBLTjdJ0PZh7RokE9Wc,90
39
39
  blue_assistant/script/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
40
40
  blue_assistant/script/__main__.py,sha256=eOSOo5yYTPMwIXZ0GkuWkmOcsDWrZtHvClyJizXSk2w,1657
41
41
  blue_assistant/script/load.py,sha256=JsDY9T3HTM9vXngvKsA0Mt_erxAnRR_jI62-JhrOBMU,831
42
- blue_assistant/script/actions/__init__.py,sha256=tiNL9HT1ql-Ut6CPYuj6B29PXQPuf-B-z8dJcksWACY,534
42
+ blue_assistant/script/actions/__init__.py,sha256=GJJCaXSrfhwW9K5A2PHmrS7iGl-Ss9UUeYHUtxni4k0,576
43
43
  blue_assistant/script/actions/generate_image.py,sha256=PgvOspDV8n2M7ZmgVOdZzJwQ1tnJNJ6V8gV94P74ksA,1336
44
44
  blue_assistant/script/actions/generate_text.py,sha256=SSyII0QPqiD538hveaN3RSyEHOt_lJ7Q-AVUg6fmlaM,1889
45
45
  blue_assistant/script/actions/generic.py,sha256=ET1RaKcUABM8HdIv8JecSpUFasYqmwHacL-5LjF-8NM,355
46
+ blue_assistant/script/actions/web_crawl.py,sha256=3dYt5nTZpTwXSoM30Ik5yS409kkWt4L5GYrsA9LlZN0,1872
46
47
  blue_assistant/script/repository/__init__.py,sha256=zVI3cubRqM9H6WgF0EUP9idILVLCumPFmJgKPM7iVlM,604
47
48
  blue_assistant/script/repository/base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
48
- blue_assistant/script/repository/base/classes.py,sha256=-G81it3Beb3fbhE5H6g0BPJwvZKn3qELiBaqRWXP4OY,3717
49
+ blue_assistant/script/repository/base/classes.py,sha256=JWUnXsFsh0sogOUqJSQSJuHbPHWzFNvTpEFEJ1mX0XI,5276
49
50
  blue_assistant/script/repository/blue_amo/__init__.py,sha256=WjL9GIlN-DBnbUMJ8O_FxTp0rcVGlsIS3H9YtXEefTk,76
50
51
  blue_assistant/script/repository/blue_amo/classes.py,sha256=Rl_UX67AlfhVEhv8tfgdWKItOxI3cUfiGsN12-k8sWI,2085
51
52
  blue_assistant/script/repository/blue_amo/actions/__init__.py,sha256=je2S21KvYB3QkbABs71parwUh8MCh2mdlNZfLx_QuDg,430
@@ -59,14 +60,12 @@ blue_assistant/script/repository/hue/api.py,sha256=C3KzT_MG868gsznUXpwEbUleBjnJO
59
60
  blue_assistant/script/repository/hue/classes.py,sha256=YhifmcuylnZuI0_BjBPmwrSbsO-BOHDHNJ0pSLIExiE,188
60
61
  blue_assistant/script/repository/hue/colors.py,sha256=rUdtCroNAnzm1zUuVp8eVhvfIie1f7sd208ypsFAJ_w,625
61
62
  blue_assistant/script/repository/orbital_data_explorer/__init__.py,sha256=yy5FtCeHlr9dRfqxw4QYWr7_yRjnQpwVyuAY2vLrh4Q,110
62
- blue_assistant/script/repository/orbital_data_explorer/classes.py,sha256=NEJeud6UPXarnAIEvAX_ZKFoRnyK1tiEIORSsrixLxQ,1024
63
- blue_assistant/script/repository/orbital_data_explorer/actions/__init__.py,sha256=RcrFUAwnvhuwNh3gC65w9G26vd_cIa7LV1lFvGFcigk,370
64
- blue_assistant/script/repository/orbital_data_explorer/actions/researching_the_questions.py,sha256=rBJtrttp1LKFVkG5Lvntip6Dl3uO7CtlQRyd5PddVEU,1104
63
+ blue_assistant/script/repository/orbital_data_explorer/classes.py,sha256=ixYd_FHWYtp8Sfd6AiZkIqePjoUlT9iLg7TvuxHIDzA,204
65
64
  blue_assistant/web/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
66
65
  blue_assistant/web/__main__.py,sha256=f6uPh7LnvIuVtrC9kZGbCr8nDFEJju-GcUgdRVsQvQE,1613
67
66
  blue_assistant/web/functions.py,sha256=AiezAvbw0eHG9XaYnXw8KQ_OjCfDvVPzsZxrzxwyPyg,2483
68
- blue_assistant-4.243.1.dist-info/LICENSE,sha256=ogEPNDSH0_dhiv_lT3ifVIdgIzHAqNA_SemnxUfPBJk,7048
69
- blue_assistant-4.243.1.dist-info/METADATA,sha256=VCI_zXnhWT1wAv9X-AQxh5fqgMXkoO9jh_L6MfHdXcY,5086
70
- blue_assistant-4.243.1.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
71
- blue_assistant-4.243.1.dist-info/top_level.txt,sha256=ud0BkBbdOVze13bNqHuhZj1rwCztaBtDf5ChEYzASOs,15
72
- blue_assistant-4.243.1.dist-info/RECORD,,
67
+ blue_assistant-4.268.1.dist-info/LICENSE,sha256=ogEPNDSH0_dhiv_lT3ifVIdgIzHAqNA_SemnxUfPBJk,7048
68
+ blue_assistant-4.268.1.dist-info/METADATA,sha256=Toip9qF5bXXpDE8PZprhRkVi5kmY7GR5rXztqK8xjtw,5380
69
+ blue_assistant-4.268.1.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
70
+ blue_assistant-4.268.1.dist-info/top_level.txt,sha256=ud0BkBbdOVze13bNqHuhZj1rwCztaBtDf5ChEYzASOs,15
71
+ blue_assistant-4.268.1.dist-info/RECORD,,
@@ -1,11 +0,0 @@
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
- }