blue-assistant 4.53.1__tar.gz → 4.62.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.
Files changed (61) hide show
  1. {blue_assistant-4.53.1/blue_assistant.egg-info → blue_assistant-4.62.1}/PKG-INFO +6 -2
  2. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/README.md +1 -1
  3. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant/__init__.py +1 -1
  4. blue_assistant-4.62.1/blue_assistant/config.env +3 -0
  5. blue_assistant-4.62.1/blue_assistant/env.py +17 -0
  6. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant/script/__main__.py +2 -1
  7. blue_assistant-4.62.1/blue_assistant/script/actions/__init__.py +14 -0
  8. blue_assistant-4.53.1/blue_assistant/script/actions/__init__.py → blue_assistant-4.62.1/blue_assistant/script/actions/functions.py +26 -14
  9. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant/script/actions/generate_image.py +6 -3
  10. blue_assistant-4.62.1/blue_assistant/script/actions/generate_text.py +66 -0
  11. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant/script/actions/generic.py +13 -4
  12. blue_assistant-4.62.1/blue_assistant/script/load.py +27 -0
  13. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant/script/repository/__init__.py +1 -1
  14. blue_assistant-4.62.1/blue_assistant/script/repository/generic/classes.py +72 -0
  15. {blue_assistant-4.53.1 → blue_assistant-4.62.1/blue_assistant.egg-info}/PKG-INFO +6 -2
  16. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant.egg-info/SOURCES.txt +1 -0
  17. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant.egg-info/requires.txt +4 -0
  18. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/requirements.txt +6 -0
  19. blue_assistant-4.53.1/blue_assistant/config.env +0 -1
  20. blue_assistant-4.53.1/blue_assistant/env.py +0 -11
  21. blue_assistant-4.53.1/blue_assistant/script/actions/generate_text.py +0 -21
  22. blue_assistant-4.53.1/blue_assistant/script/load.py +0 -17
  23. blue_assistant-4.53.1/blue_assistant/script/repository/generic/classes.py +0 -104
  24. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/LICENSE +0 -0
  25. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/MANIFEST.in +0 -0
  26. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant/.abcli/abcli.sh +0 -0
  27. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant/.abcli/actions.sh +0 -0
  28. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant/.abcli/alias.sh +0 -0
  29. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant/.abcli/blue_assistant.sh +0 -0
  30. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant/.abcli/browse.sh +0 -0
  31. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant/.abcli/script/list.sh +0 -0
  32. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant/.abcli/script/run.sh +0 -0
  33. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant/.abcli/script.sh +0 -0
  34. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant/.abcli/tests/README.sh +0 -0
  35. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant/.abcli/tests/help.sh +0 -0
  36. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant/.abcli/tests/script_list.sh +0 -0
  37. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant/.abcli/tests/script_run.sh +0 -0
  38. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant/.abcli/tests/version.sh +0 -0
  39. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant/README.py +0 -0
  40. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant/__main__.py +0 -0
  41. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant/functions.py +0 -0
  42. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant/help/__init__.py +0 -0
  43. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant/help/__main__.py +0 -0
  44. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant/help/functions.py +0 -0
  45. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant/help/script.py +0 -0
  46. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant/host.py +0 -0
  47. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant/logger.py +0 -0
  48. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant/sample.env +0 -0
  49. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant/script/__init__.py +0 -0
  50. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant/script/actions/wip.py +0 -0
  51. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant/script/repository/blue_amo/__init__.py +0 -0
  52. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant/script/repository/blue_amo/classes.py +0 -0
  53. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant/script/repository/generic/__init__.py +0 -0
  54. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant/script/repository/moon_datasets/__init__.py +0 -0
  55. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant/script/repository/moon_datasets/classes.py +0 -0
  56. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant/urls.py +0 -0
  57. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant.egg-info/dependency_links.txt +0 -0
  58. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/blue_assistant.egg-info/top_level.txt +0 -0
  59. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/pyproject.toml +0 -0
  60. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/setup.cfg +0 -0
  61. {blue_assistant-4.53.1 → blue_assistant-4.62.1}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: blue_assistant
3
- Version: 4.53.1
3
+ Version: 4.62.1
4
4
  Summary: 🧠 An AI Assistant.
5
5
  Home-page: https://github.com/kamangir/blue-assistant
6
6
  Author: Arash Abadpour (Kamangir)
@@ -16,7 +16,9 @@ Requires-Dist: blueness
16
16
  Requires-Dist: blue-options
17
17
  Requires-Dist: abcli
18
18
  Requires-Dist: openai_commands
19
+ Requires-Dist: blueflow
19
20
  Requires-Dist: boto3
21
+ Requires-Dist: openai
20
22
  Requires-Dist: geojson
21
23
  Requires-Dist: geopandas
22
24
  Requires-Dist: matplotlib
@@ -28,6 +30,8 @@ Requires-Dist: pylint
28
30
  Requires-Dist: pytest
29
31
  Requires-Dist: python-dotenv[cli]
30
32
  Requires-Dist: tqdm
33
+ Requires-Dist: networkx
34
+ Requires-Dist: pydot
31
35
  Dynamic: author
32
36
  Dynamic: author-email
33
37
  Dynamic: classifier
@@ -68,4 +72,4 @@ graph LR
68
72
 
69
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)
70
74
 
71
- built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🧠 [`blue_assistant-4.53.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.62.1`](https://github.com/kamangir/blue-assistant).
@@ -28,4 +28,4 @@ graph LR
28
28
 
29
29
  [![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)
30
30
 
31
- built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🧠 [`blue_assistant-4.53.1`](https://github.com/kamangir/blue-assistant).
31
+ built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🧠 [`blue_assistant-4.62.1`](https://github.com/kamangir/blue-assistant).
@@ -4,7 +4,7 @@ ICON = "🧠"
4
4
 
5
5
  DESCRIPTION = f"{ICON} An AI Assistant."
6
6
 
7
- VERSION = "4.53.1"
7
+ VERSION = "4.62.1"
8
8
 
9
9
  REPO_NAME = "blue-assistant"
10
10
 
@@ -0,0 +1,3 @@
1
+ BLUE_ASSISTANT_DEFAULT_MODEL=gpt-4o
2
+
3
+ BLUE_ASSISTANT_MAX_TOKEN=2000
@@ -0,0 +1,17 @@
1
+ import os
2
+ from blue_options.env import load_config, load_env
3
+
4
+ load_env(__name__)
5
+ load_config(__name__)
6
+
7
+
8
+ BLUE_ASSISTANT_DEFAULT_MODEL = os.getenv(
9
+ "BLUE_ASSISTANT_DEFAULT_MODEL",
10
+ "",
11
+ )
12
+
13
+ BLUE_ASSISTANT_MAX_TOKEN_str = os.getenv("BLUE_ASSISTANT_MAX_TOKEN", "")
14
+ try:
15
+ BLUE_ASSISTANT_MAX_TOKEN = int(BLUE_ASSISTANT_MAX_TOKEN_str)
16
+ except Exception:
17
+ BLUE_ASSISTANT_MAX_TOKEN = 2000
@@ -58,11 +58,12 @@ if args.task == "list":
58
58
  elif args.task == "run":
59
59
  success, script = load_script(
60
60
  script_name=args.script_name,
61
+ object_name=args.object_name,
61
62
  verbose=args.verbose == 1,
62
63
  )
63
64
 
64
65
  if success:
65
- success = script.run(object_name=args.object_name)
66
+ success = script.run()
66
67
  else:
67
68
  success = None
68
69
 
@@ -0,0 +1,14 @@
1
+ from typing import List
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
7
+ from blue_assistant.logger import logger
8
+
9
+ list_of_actions: List[GenericAction] = [
10
+ GenericAction,
11
+ GenerateImageAction,
12
+ GenerateTextAction,
13
+ WorkInProgressAction,
14
+ ]
@@ -1,17 +1,14 @@
1
1
  from typing import List, Dict, Tuple, Type
2
2
 
3
+ from blueness import module
3
4
  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
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
7
9
  from blue_assistant.logger import logger
8
10
 
9
- list_of_actions: List[GenericAction] = [
10
- GenericAction,
11
- GenerateImageAction,
12
- GenerateTextAction,
13
- WorkInProgressAction,
14
- ]
11
+ NAME = module.name(__file__, NAME)
15
12
 
16
13
 
17
14
  def get_action_class(
@@ -26,15 +23,30 @@ def get_action_class(
26
23
 
27
24
 
28
25
  def perform_action(
29
- action_name: str,
30
- node: Dict,
26
+ script: BaseScript,
27
+ node_name: str,
31
28
  ) -> Tuple[bool, Dict]:
29
+ action_name = script.nodes[node_name].get("action", "unknown")
30
+
32
31
  success, action_class = get_action_class(action_name=action_name)
33
32
  if not success:
34
33
  return False, {
35
34
  "error": f"{action_name}: action not found.",
36
35
  }
37
36
 
38
- action_object = action_class(node=node)
39
-
40
- return action_object.perform()
37
+ logger.info(
38
+ "{}.perform_action: {} == {} on {}".format(
39
+ NAME,
40
+ action_name,
41
+ action_class.__name__,
42
+ node_name,
43
+ )
44
+ )
45
+
46
+ action_object = action_class(
47
+ script=script,
48
+ )
49
+
50
+ return action_object.perform(
51
+ node_name=node_name,
52
+ )
@@ -9,12 +9,15 @@ from blue_assistant.logger import logger
9
9
  class GenerateImageAction(GenericAction):
10
10
  name = file.name(__file__)
11
11
 
12
- def perform(self) -> Tuple[bool, Dict]:
13
- success, generic_metadata = super().perform()
12
+ def perform(
13
+ self,
14
+ node_name: str,
15
+ ) -> Tuple[bool, Dict]:
16
+ success, generic_metadata = super().perform(node_name=node_name)
14
17
  if not success:
15
18
  return success, generic_metadata
16
19
 
17
- logger.info(f"🪄 generating image ...: {self.node}")
20
+ logger.info(f"🪄 generating image ...: {node_name}")
18
21
  metadata = {}
19
22
 
20
23
  metadata.update(generic_metadata)
@@ -0,0 +1,66 @@
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
@@ -4,6 +4,7 @@ from blueness import module
4
4
  from blue_objects import file
5
5
 
6
6
  from blue_assistant import NAME
7
+ from blue_assistant.script.repository.base.classes import BaseScript
7
8
  from blue_assistant.logger import logger
8
9
 
9
10
  NAME = module.name(__file__, NAME)
@@ -12,14 +13,22 @@ NAME = module.name(__file__, NAME)
12
13
  class GenericAction:
13
14
  name = file.name(__file__)
14
15
 
15
- def __init__(self, node: Dict):
16
- self.node = node
16
+ def __init__(
17
+ self,
18
+ script: BaseScript,
19
+ ):
20
+ self.script = script
17
21
 
18
- def perform(self) -> Tuple[bool, Dict]:
22
+ def perform(
23
+ self,
24
+ node_name: str,
25
+ ) -> Tuple[bool, Dict]:
19
26
  logger.info(
20
- "{}.perform({}) ...".format(
27
+ "{}.perform({}) on {}.{} ...".format(
21
28
  NAME,
22
29
  self.__class__.__name__,
30
+ self.script.name,
31
+ node_name,
23
32
  ),
24
33
  )
25
34
  return True, {}
@@ -0,0 +1,27 @@
1
+ from typing import Tuple, Type
2
+
3
+ from blue_assistant.script.repository import list_of_script_classes
4
+ from blue_assistant.script.repository.base.classes import BaseScript
5
+ from blue_assistant.logger import logger
6
+
7
+
8
+ def load_script(
9
+ script_name: str,
10
+ object_name: str,
11
+ verbose: bool = False,
12
+ ) -> Tuple[bool, BaseScript]:
13
+ found: bool = False
14
+ script_class: Type[BaseScript] = BaseScript
15
+ for script_class_option in list_of_script_classes:
16
+ if script_class_option.name == script_name:
17
+ found = True
18
+ script_class = script_class_option
19
+ break
20
+
21
+ if not found:
22
+ logger.error(f"{script_name}: script not found.")
23
+
24
+ return found, script_class(
25
+ object_name=object_name,
26
+ verbose=verbose,
27
+ )
@@ -1,6 +1,6 @@
1
1
  from typing import List, Type
2
2
 
3
- from blue_assistant.script.repository.generic import GenericScript
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
6
  from blue_assistant.script.repository.moon_datasets.classes import MiningOnMoonScript
@@ -0,0 +1,72 @@
1
+ from typing import Dict, List
2
+ import os
3
+ from tqdm import tqdm
4
+
5
+
6
+ from blueness import module
7
+ from blue_objects import file, path
8
+ from blue_objects.metadata import post_to_object
9
+
10
+ from blue_assistant import NAME
11
+ from blue_assistant.script.repository.base.classes import BaseScript
12
+ from blue_assistant.script.actions.functions import perform_action
13
+ from blue_assistant.logger import logger
14
+
15
+
16
+ NAME = module.name(__file__, NAME)
17
+
18
+
19
+ class GenericScript(BaseScript):
20
+ name = path.name(file.path(__file__))
21
+
22
+ def run(
23
+ self,
24
+ ) -> bool:
25
+ if not super().run():
26
+ return False
27
+
28
+ metadata: Dict[Dict] = {"nodes": {}}
29
+ 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"]:
36
+ continue
37
+
38
+ pending_dependencies = [
39
+ node_name_
40
+ for node_name_ in self.G.successors(node_name)
41
+ if not self.G.nodes[node_name_]["completed"]
42
+ ]
43
+ if pending_dependencies:
44
+ logger.info(
45
+ 'node "{}": {} pending dependenci(es): {}'.format(
46
+ node_name,
47
+ len(pending_dependencies),
48
+ ", ".join(pending_dependencies),
49
+ )
50
+ )
51
+ continue
52
+
53
+ success, output = perform_action(
54
+ script=self,
55
+ node_name=node_name,
56
+ )
57
+ self.G.nodes[node_name]["completed"] = success
58
+ metadata["nodes"][node_name] = {
59
+ "success": success,
60
+ "output": output,
61
+ }
62
+ if not success:
63
+ break
64
+
65
+ if not post_to_object(
66
+ self.object_name,
67
+ "output",
68
+ metadata,
69
+ ):
70
+ return False
71
+
72
+ return success
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: blue_assistant
3
- Version: 4.53.1
3
+ Version: 4.62.1
4
4
  Summary: 🧠 An AI Assistant.
5
5
  Home-page: https://github.com/kamangir/blue-assistant
6
6
  Author: Arash Abadpour (Kamangir)
@@ -16,7 +16,9 @@ Requires-Dist: blueness
16
16
  Requires-Dist: blue-options
17
17
  Requires-Dist: abcli
18
18
  Requires-Dist: openai_commands
19
+ Requires-Dist: blueflow
19
20
  Requires-Dist: boto3
21
+ Requires-Dist: openai
20
22
  Requires-Dist: geojson
21
23
  Requires-Dist: geopandas
22
24
  Requires-Dist: matplotlib
@@ -28,6 +30,8 @@ Requires-Dist: pylint
28
30
  Requires-Dist: pytest
29
31
  Requires-Dist: python-dotenv[cli]
30
32
  Requires-Dist: tqdm
33
+ Requires-Dist: networkx
34
+ Requires-Dist: pydot
31
35
  Dynamic: author
32
36
  Dynamic: author-email
33
37
  Dynamic: classifier
@@ -68,4 +72,4 @@ graph LR
68
72
 
69
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)
70
74
 
71
- built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🧠 [`blue_assistant-4.53.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.62.1`](https://github.com/kamangir/blue-assistant).
@@ -40,6 +40,7 @@ blue_assistant/script/__init__.py
40
40
  blue_assistant/script/__main__.py
41
41
  blue_assistant/script/load.py
42
42
  blue_assistant/script/actions/__init__.py
43
+ blue_assistant/script/actions/functions.py
43
44
  blue_assistant/script/actions/generate_image.py
44
45
  blue_assistant/script/actions/generate_text.py
45
46
  blue_assistant/script/actions/generic.py
@@ -2,7 +2,9 @@ blueness
2
2
  blue-options
3
3
  abcli
4
4
  openai_commands
5
+ blueflow
5
6
  boto3
7
+ openai
6
8
  geojson
7
9
  geopandas
8
10
  matplotlib
@@ -14,3 +16,5 @@ pylint
14
16
  pytest
15
17
  python-dotenv[cli]
16
18
  tqdm
19
+ networkx
20
+ pydot
@@ -2,7 +2,10 @@ blueness
2
2
  blue-options
3
3
  abcli
4
4
  openai_commands
5
+ blueflow
6
+
5
7
  boto3
8
+ openai
6
9
  geojson
7
10
  geopandas
8
11
  matplotlib
@@ -14,3 +17,6 @@ pylint
14
17
  pytest
15
18
  python-dotenv[cli]
16
19
  tqdm
20
+
21
+ networkx
22
+ pydot
@@ -1 +0,0 @@
1
- BLUE_ASSISTANT_TEST_OBJECT=blue-amo
@@ -1,11 +0,0 @@
1
- import os
2
- from blue_options.env import load_config, load_env
3
-
4
- load_env(__name__)
5
- load_config(__name__)
6
-
7
-
8
- BLUE_ASSISTANT_TEST_OBJECT = os.getenv(
9
- "BLUE_ASSISTANT_TEST_OBJECT",
10
- "",
11
- )
@@ -1,21 +0,0 @@
1
- from typing import Dict, Tuple
2
-
3
- from blue_objects import file
4
-
5
- from blue_assistant.script.actions.generic import GenericAction
6
- from blue_assistant.logger import logger
7
-
8
-
9
- class GenerateTextAction(GenericAction):
10
- name = file.name(__file__)
11
-
12
- def perform(self) -> Tuple[bool, Dict]:
13
- success, generic_metadata = super().perform()
14
- if not success:
15
- return success, generic_metadata
16
-
17
- logger.info(f"🪄 generating text ...: {self.node}")
18
- metadata = {}
19
-
20
- metadata.update(generic_metadata)
21
- return True, metadata
@@ -1,17 +0,0 @@
1
- from typing import Tuple
2
-
3
- from blue_assistant.script.repository import list_of_script_classes
4
- from blue_assistant.script.repository.generic import GenericScript
5
- from blue_assistant.logger import logger
6
-
7
-
8
- def load_script(
9
- script_name: str,
10
- verbose: bool = False,
11
- ) -> Tuple[bool, GenericScript]:
12
- for script_class in list_of_script_classes:
13
- if script_class.name == script_name:
14
- return True, script_class(verbose=verbose)
15
-
16
- logger.error(f"{script_name}: script not found.")
17
- return False, GenericScript(verbose=verbose)
@@ -1,104 +0,0 @@
1
- from typing import Dict, List
2
- import os
3
- from tqdm import tqdm
4
-
5
-
6
- from blueness import module
7
- from blue_objects import file, path
8
- from blue_objects.metadata import post_to_object
9
-
10
- from blue_assistant import NAME
11
- from blue_assistant.script.actions import perform_action
12
- from blue_assistant.logger import logger
13
-
14
-
15
- NAME = module.name(__file__, NAME)
16
-
17
-
18
- class GenericScript:
19
- name = path.name(file.path(__file__))
20
-
21
- def __init__(
22
- self,
23
- verbose: bool = False,
24
- ):
25
- self.verbose = verbose
26
-
27
- metadata_filename = os.path.join(
28
- file.path(__file__),
29
- f"../{self.name}",
30
- "metadata.yaml",
31
- )
32
- self.metadata: Dict
33
- success, self.metadata = file.load_yaml(metadata_filename)
34
- assert success, f"cannot load {self.name}/metadata.yaml"
35
-
36
- logger.info("loaded {} node(s)".format(len(self.nodes)))
37
-
38
- logger.info("loaded {} variable(s)".format(len(self.vars)))
39
- if verbose:
40
- for var_name, var_value in self.vars.items():
41
- logger.info("{}: {}".format(var_name, var_value))
42
-
43
- @property
44
- def script(self) -> str:
45
- return self.metadata.get("script", {})
46
-
47
- @property
48
- def nodes(self) -> str:
49
- return self.metadata.get("script", {}).get("nodes", [])
50
-
51
- @property
52
- def vars(self) -> str:
53
- return self.metadata.get("script", {}).get("vars", {})
54
-
55
- def run(
56
- self,
57
- object_name: str,
58
- ) -> bool:
59
- logger.info(
60
- "{}.run: {}:{} -> {}".format(
61
- NAME,
62
- self.__class__.__name__,
63
- self.name,
64
- object_name,
65
- )
66
- )
67
-
68
- if not post_to_object(
69
- object_name,
70
- "script",
71
- self.script,
72
- ):
73
- return False
74
-
75
- metadata: Dict[Dict] = {"nodes": {}}
76
- success: bool = True
77
- for node_name, node in tqdm(self.nodes.items()):
78
- logger.info(
79
- "{}{}".format(
80
- node_name,
81
- f": {node}" if self.verbose else " ...",
82
- )
83
- )
84
-
85
- assert isinstance(node, dict)
86
- success, output = perform_action(
87
- action_name=node.get("action", "unknown"),
88
- node=node,
89
- )
90
- metadata["nodes"][node_name] = {
91
- "success": success,
92
- "output": output,
93
- }
94
- if not success:
95
- break
96
-
97
- if not post_to_object(
98
- object_name,
99
- "output",
100
- metadata,
101
- ):
102
- return False
103
-
104
- return success
File without changes