blue-assistant 4.17.1__tar.gz → 4.24.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 (41) hide show
  1. {blue_assistant-4.17.1/blue_assistant.egg-info → blue_assistant-4.24.1}/PKG-INFO +3 -2
  2. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/README.md +1 -1
  3. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/blue_assistant/__init__.py +1 -1
  4. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/blue_assistant/chat/context.py +32 -4
  5. {blue_assistant-4.17.1 → blue_assistant-4.24.1/blue_assistant.egg-info}/PKG-INFO +3 -2
  6. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/blue_assistant.egg-info/requires.txt +1 -0
  7. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/requirements.txt +1 -0
  8. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/LICENSE +0 -0
  9. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/MANIFEST.in +0 -0
  10. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/blue_assistant/.abcli/abcli.sh +0 -0
  11. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/blue_assistant/.abcli/actions.sh +0 -0
  12. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/blue_assistant/.abcli/alias.sh +0 -0
  13. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/blue_assistant/.abcli/blue_assistant.sh +0 -0
  14. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/blue_assistant/.abcli/browse.sh +0 -0
  15. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/blue_assistant/.abcli/chat.sh +0 -0
  16. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/blue_assistant/.abcli/tests/README.sh +0 -0
  17. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/blue_assistant/.abcli/tests/chat.sh +0 -0
  18. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/blue_assistant/.abcli/tests/help.sh +0 -0
  19. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/blue_assistant/.abcli/tests/version.sh +0 -0
  20. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/blue_assistant/README.py +0 -0
  21. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/blue_assistant/__main__.py +0 -0
  22. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/blue_assistant/chat/__init__.py +0 -0
  23. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/blue_assistant/chat/__main__.py +0 -0
  24. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/blue_assistant/chat/functions.py +1 -1
  25. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/blue_assistant/config.env +0 -0
  26. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/blue_assistant/env.py +0 -0
  27. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/blue_assistant/functions.py +0 -0
  28. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/blue_assistant/help/__init__.py +0 -0
  29. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/blue_assistant/help/__main__.py +0 -0
  30. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/blue_assistant/help/chat.py +0 -0
  31. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/blue_assistant/help/functions.py +0 -0
  32. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/blue_assistant/host.py +0 -0
  33. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/blue_assistant/logger.py +0 -0
  34. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/blue_assistant/sample.env +0 -0
  35. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/blue_assistant/urls.py +0 -0
  36. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/blue_assistant.egg-info/SOURCES.txt +0 -0
  37. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/blue_assistant.egg-info/dependency_links.txt +0 -0
  38. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/blue_assistant.egg-info/top_level.txt +0 -0
  39. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/pyproject.toml +0 -0
  40. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/setup.cfg +0 -0
  41. {blue_assistant-4.17.1 → blue_assistant-4.24.1}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: blue_assistant
3
- Version: 4.17.1
3
+ Version: 4.24.1
4
4
  Summary: 🌀 An AI Assistant.
5
5
  Home-page: https://github.com/kamangir/blue-assistant
6
6
  Author: Arash Abadpour (Kamangir)
@@ -15,6 +15,7 @@ License-File: LICENSE
15
15
  Requires-Dist: blueness
16
16
  Requires-Dist: blue-options
17
17
  Requires-Dist: abcli
18
+ Requires-Dist: openai_commands
18
19
  Requires-Dist: boto3
19
20
  Requires-Dist: geojson
20
21
  Requires-Dist: geopandas
@@ -62,4 +63,4 @@ graph LR
62
63
 
63
64
  [![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)
64
65
 
65
- built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🌀 [`blue_assistant-4.17.1`](https://github.com/kamangir/blue-assistant).
66
+ built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🌀 [`blue_assistant-4.24.1`](https://github.com/kamangir/blue-assistant).
@@ -23,4 +23,4 @@ graph LR
23
23
 
24
24
  [![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)
25
25
 
26
- built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🌀 [`blue_assistant-4.17.1`](https://github.com/kamangir/blue-assistant).
26
+ built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🌀 [`blue_assistant-4.24.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.17.1"
7
+ VERSION = "4.24.1"
8
8
 
9
9
  REPO_NAME = "blue-assistant"
10
10
 
@@ -1,5 +1,8 @@
1
+ from blue_objects import file, objects
2
+ from blue_options import string
1
3
  from blue_objects.metadata import post_to_object, get_from_object
2
4
  from blue_options.terminal.functions import hr
5
+ from openai_commands.prompt_completion.api import complete_prompt
3
6
 
4
7
  from blue_assistant import ICON
5
8
  from blue_assistant.logger import logger
@@ -10,7 +13,10 @@ class ChatContext:
10
13
  self,
11
14
  object_name: str,
12
15
  load_history: bool = True,
16
+ verbose: bool = False,
13
17
  ):
18
+ self.verbose = verbose
19
+
14
20
  self.ended: bool = False
15
21
 
16
22
  self.object_name = object_name
@@ -28,7 +34,6 @@ class ChatContext:
28
34
  def chat(
29
35
  self,
30
36
  interactive: bool = True,
31
- verbose: bool = False,
32
37
  ) -> bool:
33
38
  logger.info('Type in "help" for help.')
34
39
 
@@ -45,7 +50,11 @@ class ChatContext:
45
50
 
46
51
  return True
47
52
 
48
- def process_prompt(self, prompt: str) -> bool:
53
+ def process_prompt(
54
+ self,
55
+ prompt: str,
56
+ max_tokens: int = 2000,
57
+ ) -> bool:
49
58
  if prompt in ["help", "?", ""]:
50
59
  return self.show_help()
51
60
 
@@ -53,15 +62,34 @@ class ChatContext:
53
62
  self.ended = True
54
63
  return True
55
64
 
56
- logger.info(f"🪄 {prompt}")
65
+ success, response, metadata = complete_prompt(
66
+ prompt=prompt,
67
+ max_tokens=max_tokens,
68
+ verbose=self.verbose,
69
+ )
70
+ if not success:
71
+ return success
72
+ logger.info(response)
57
73
 
74
+ id_ = string.pretty_date(
75
+ as_filename=True,
76
+ unique=True,
77
+ )
58
78
  self.history.append(
59
79
  {
80
+ "id": id_,
60
81
  "prompt": prompt,
82
+ "response": response,
61
83
  }
62
84
  )
63
85
 
64
- return True
86
+ return file.save_yaml(
87
+ objects.path_of(
88
+ object_name=self.object_name,
89
+ filename=f"{id_}.yaml",
90
+ ),
91
+ metadata,
92
+ )
65
93
 
66
94
  def save(self) -> bool:
67
95
  return post_to_object(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: blue_assistant
3
- Version: 4.17.1
3
+ Version: 4.24.1
4
4
  Summary: 🌀 An AI Assistant.
5
5
  Home-page: https://github.com/kamangir/blue-assistant
6
6
  Author: Arash Abadpour (Kamangir)
@@ -15,6 +15,7 @@ License-File: LICENSE
15
15
  Requires-Dist: blueness
16
16
  Requires-Dist: blue-options
17
17
  Requires-Dist: abcli
18
+ Requires-Dist: openai_commands
18
19
  Requires-Dist: boto3
19
20
  Requires-Dist: geojson
20
21
  Requires-Dist: geopandas
@@ -62,4 +63,4 @@ graph LR
62
63
 
63
64
  [![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)
64
65
 
65
- built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🌀 [`blue_assistant-4.17.1`](https://github.com/kamangir/blue-assistant).
66
+ built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🌀 [`blue_assistant-4.24.1`](https://github.com/kamangir/blue-assistant).
@@ -1,6 +1,7 @@
1
1
  blueness
2
2
  blue-options
3
3
  abcli
4
+ openai_commands
4
5
  boto3
5
6
  geojson
6
7
  geopandas
@@ -1,6 +1,7 @@
1
1
  blueness
2
2
  blue-options
3
3
  abcli
4
+ openai_commands
4
5
  boto3
5
6
  geojson
6
7
  geopandas
File without changes
@@ -25,11 +25,11 @@ def chat(
25
25
  context = ChatContext(
26
26
  object_name,
27
27
  load_history=load_history,
28
+ verbose=verbose,
28
29
  )
29
30
 
30
31
  if not context.chat(
31
32
  interactive=interactive,
32
- verbose=verbose,
33
33
  ):
34
34
  return False
35
35