blue-assistant 4.137.1__tar.gz → 4.142.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 (64) hide show
  1. {blue_assistant-4.137.1/blue_assistant.egg-info → blue_assistant-4.142.1}/PKG-INFO +2 -2
  2. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/README.md +1 -1
  3. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/__init__.py +1 -1
  4. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/config.env +1 -1
  5. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/env.py +3 -3
  6. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/script/actions/generate_image.py +7 -14
  7. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/script/actions/generate_text.py +11 -31
  8. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/script/repository/base/classes.py +2 -2
  9. {blue_assistant-4.137.1 → blue_assistant-4.142.1/blue_assistant.egg-info}/PKG-INFO +2 -2
  10. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/LICENSE +0 -0
  11. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/MANIFEST.in +0 -0
  12. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/.abcli/abcli.sh +0 -0
  13. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/.abcli/actions.sh +0 -0
  14. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/.abcli/alias.sh +0 -0
  15. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/.abcli/blue_assistant.sh +0 -0
  16. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/.abcli/browse.sh +0 -0
  17. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/.abcli/script/list.sh +0 -0
  18. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/.abcli/script/run.sh +0 -0
  19. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/.abcli/script.sh +0 -0
  20. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/.abcli/tests/README.sh +0 -0
  21. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/.abcli/tests/help.sh +0 -0
  22. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/.abcli/tests/script_list.sh +0 -0
  23. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/.abcli/tests/script_run.sh +0 -0
  24. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/.abcli/tests/version.sh +0 -0
  25. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/README.py +0 -0
  26. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/__main__.py +0 -0
  27. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/functions.py +0 -0
  28. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/help/__init__.py +0 -0
  29. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/help/__main__.py +0 -0
  30. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/help/functions.py +0 -0
  31. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/help/script.py +0 -0
  32. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/host.py +0 -0
  33. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/logger.py +0 -0
  34. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/sample.env +0 -0
  35. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/script/__init__.py +0 -0
  36. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/script/__main__.py +0 -0
  37. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/script/actions/__init__.py +0 -0
  38. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/script/actions/generic.py +0 -0
  39. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/script/actions/skip.py +0 -0
  40. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/script/load.py +0 -0
  41. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/script/repository/__init__.py +0 -0
  42. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/script/repository/base/__init__.py +0 -0
  43. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/script/repository/blue_amo/__init__.py +0 -0
  44. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/script/repository/blue_amo/actions/__init__.py +0 -0
  45. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/script/repository/blue_amo/actions/slicing_into_frames.py +0 -0
  46. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/script/repository/blue_amo/actions/stitching_the_frames.py +0 -0
  47. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/script/repository/blue_amo/classes.py +0 -0
  48. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/script/repository/generic/__init__.py +0 -0
  49. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/script/repository/generic/classes.py +0 -0
  50. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/script/repository/hue/__init__.py +0 -0
  51. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/script/repository/hue/classes.py +0 -0
  52. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/script/repository/orbital_data_explorer/__init__.py +0 -0
  53. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/script/repository/orbital_data_explorer/actions/__init__.py +0 -0
  54. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/script/repository/orbital_data_explorer/actions/researching_the_questions.py +0 -0
  55. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/script/repository/orbital_data_explorer/classes.py +0 -0
  56. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant/urls.py +0 -0
  57. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant.egg-info/SOURCES.txt +0 -0
  58. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant.egg-info/dependency_links.txt +0 -0
  59. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant.egg-info/requires.txt +0 -0
  60. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/blue_assistant.egg-info/top_level.txt +0 -0
  61. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/pyproject.toml +0 -0
  62. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/requirements.txt +0 -0
  63. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/setup.cfg +0 -0
  64. {blue_assistant-4.137.1 → blue_assistant-4.142.1}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: blue_assistant
3
- Version: 4.137.1
3
+ Version: 4.142.1
4
4
  Summary: 🧠 An AI Assistant.
5
5
  Home-page: https://github.com/kamangir/blue-assistant
6
6
  Author: Arash Abadpour (Kamangir)
@@ -76,4 +76,4 @@ graph LR
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.137.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.142.1`](https://github.com/kamangir/blue-assistant).
@@ -32,4 +32,4 @@ graph LR
32
32
 
33
33
  [![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)
34
34
 
35
- 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).
35
+ built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🧠 [`blue_assistant-4.142.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.137.1"
7
+ VERSION = "4.142.1"
8
8
 
9
9
  REPO_NAME = "blue-assistant"
10
10
 
@@ -1,5 +1,5 @@
1
1
  BLUE_ASSISTANT_TEXT_DEFAULT_MODEL=gpt-4o
2
- BLUE_ASSISTANT_TEXT_MAX_TOKEN=2000
2
+ BLUE_ASSISTANT_TEXT_MAX_TOKENS=2000
3
3
 
4
4
  BLUE_ASSISTANT_IMAGE_DEFAULT_MODEL=dall-e-3
5
5
  BLUE_ASSISTANT_IMAGE_DEFAULT_QUALITY=standard
@@ -10,11 +10,11 @@ BLUE_ASSISTANT_TEXT_DEFAULT_MODEL = os.getenv(
10
10
  "",
11
11
  )
12
12
 
13
- BLUE_ASSISTANT_TEXT_MAX_TOKEN_str = os.getenv("BLUE_ASSISTANT_TEXT_MAX_TOKEN", "")
13
+ BLUE_ASSISTANT_TEXT_MAX_TOKENS_str = os.getenv("BLUE_ASSISTANT_TEXT_MAX_TOKENS", "")
14
14
  try:
15
- BLUE_ASSISTANT_TEXT_MAX_TOKEN = int(BLUE_ASSISTANT_TEXT_MAX_TOKEN_str)
15
+ BLUE_ASSISTANT_TEXT_MAX_TOKENS = int(BLUE_ASSISTANT_TEXT_MAX_TOKENS_str)
16
16
  except Exception:
17
- BLUE_ASSISTANT_TEXT_MAX_TOKEN = 2000
17
+ BLUE_ASSISTANT_TEXT_MAX_TOKENS = 2000
18
18
 
19
19
 
20
20
  BLUE_ASSISTANT_IMAGE_DEFAULT_MODEL = os.getenv(
@@ -1,6 +1,5 @@
1
1
  from blueness import module
2
- from blue_objects import objects
3
- from openai_commands.image_generation.api import OpenAIImageGenerator
2
+ from openai_commands.image_generation import api
4
3
 
5
4
  from blue_assistant import NAME
6
5
  from blue_assistant.env import (
@@ -21,20 +20,13 @@ def generate_image(
21
20
  ) -> bool:
22
21
  logger.info(f"{NAME}: {script} @ {node_name} ...")
23
22
 
24
- generator = OpenAIImageGenerator(
25
- model=BLUE_ASSISTANT_IMAGE_DEFAULT_MODEL,
26
- verbose=script.verbose,
27
- )
28
-
29
23
  filename = f"{node_name}.png"
30
24
 
31
- success = generator.generate(
25
+ success, _ = api.generate_image(
32
26
  prompt=script.nodes[node_name]["prompt"],
33
- filename=objects.path_of(
34
- filename=filename,
35
- object_name=script.object_name,
36
- create=True,
37
- ),
27
+ filename=filename,
28
+ object_name=script.object_name,
29
+ model=BLUE_ASSISTANT_IMAGE_DEFAULT_MODEL,
38
30
  quality=(BLUE_ASSISTANT_IMAGE_DEFAULT_QUALITY if script.test_mode else "hd"),
39
31
  size=(BLUE_ASSISTANT_IMAGE_DEFAULT_SIZE if script.test_mode else "1792x1024"),
40
32
  sign_with_prompt=False,
@@ -44,7 +36,8 @@ def generate_image(
44
36
  script.nodes[node_name]["prompt"],
45
37
  )
46
38
  ],
47
- )[0]
39
+ verbose=script.verbose,
40
+ )
48
41
 
49
42
  if success:
50
43
  script.nodes[node_name]["filename"] = filename
@@ -1,15 +1,13 @@
1
1
  from typing import List
2
- from openai import OpenAI
3
- import pprint
4
2
 
5
3
  from blueness import module
6
- from openai_commands.env import OPENAI_API_KEY
4
+ from openai_commands.text_generation import api
7
5
 
8
6
  from blue_assistant import NAME
9
7
  from blue_assistant.script.repository.base.classes import BaseScript
10
8
  from blue_assistant.env import (
11
9
  BLUE_ASSISTANT_TEXT_DEFAULT_MODEL,
12
- BLUE_ASSISTANT_TEXT_MAX_TOKEN,
10
+ BLUE_ASSISTANT_TEXT_MAX_TOKENS,
13
11
  )
14
12
  from blue_assistant.logger import logger
15
13
 
@@ -21,14 +19,10 @@ def generate_text(
21
19
  script: BaseScript,
22
20
  node_name: str,
23
21
  ) -> bool:
24
- if not OPENAI_API_KEY:
25
- logger.error("OPENAI_API_KEY is not set.")
26
- return False
27
-
28
22
  logger.info(f"{NAME}: {script} @ {node_name} ...")
29
23
 
30
24
  messages: List = []
31
- list_of_context_nodes = script.get_history(node_name)
25
+ list_of_context_nodes = script.get_context(node_name)
32
26
  logger.info("node context: {}".format(" <- ".join(list_of_context_nodes)))
33
27
  for context_node in reversed(list_of_context_nodes):
34
28
  messages += [
@@ -56,29 +50,15 @@ def generate_text(
56
50
  }
57
51
  ]
58
52
 
59
- if script.verbose:
60
- logger.info(f"messages: {pprint.pformat(messages)}")
61
-
62
- client = OpenAI(api_key=OPENAI_API_KEY)
63
-
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
73
-
74
- if script.verbose:
75
- logger.info("response: {}".format(response))
76
-
77
- if not response.choices:
78
- logger.error("no choice.")
79
- return False
53
+ success, output, _ = api.generate_text(
54
+ messages=messages,
55
+ model=BLUE_ASSISTANT_TEXT_DEFAULT_MODEL,
56
+ max_tokens=BLUE_ASSISTANT_TEXT_MAX_TOKENS,
57
+ verbose=script.verbose,
58
+ )
59
+ if not success:
60
+ return success
80
61
 
81
- output = response.choices[0].message.content
82
62
  logger.info(f"🗣️ output: {output}")
83
63
  script.nodes[node_name]["output"] = output
84
64
 
@@ -81,13 +81,13 @@ class BaseScript:
81
81
 
82
82
  return self.save_graph()
83
83
 
84
- def get_history(
84
+ def get_context(
85
85
  self,
86
86
  node_name: str,
87
87
  ) -> List[str]:
88
88
  return reduce(
89
89
  lambda x, y: x + y,
90
- [self.get_history(successor) for successor in self.G.successors(node_name)],
90
+ [self.get_context(successor) for successor in self.G.successors(node_name)],
91
91
  [node_name],
92
92
  )
93
93
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: blue_assistant
3
- Version: 4.137.1
3
+ Version: 4.142.1
4
4
  Summary: 🧠 An AI Assistant.
5
5
  Home-page: https://github.com/kamangir/blue-assistant
6
6
  Author: Arash Abadpour (Kamangir)
@@ -76,4 +76,4 @@ graph LR
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.137.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.142.1`](https://github.com/kamangir/blue-assistant).