naas-abi-cli 1.8.0__py3-none-any.whl → 1.9.0__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.
- naas_abi_cli/cli/new/module.py +6 -9
- naas_abi_cli/cli/new/project.py +4 -2
- naas_abi_cli/cli/new/templates/module/__init__.py +10 -0
- naas_abi_cli/cli/new/templates/module/agents/{{module_name_pascal}}Agent.py +2 -2
- naas_abi_cli/cli/new/utils.py +13 -0
- {naas_abi_cli-1.8.0.dist-info → naas_abi_cli-1.9.0.dist-info}/METADATA +1 -1
- {naas_abi_cli-1.8.0.dist-info → naas_abi_cli-1.9.0.dist-info}/RECORD +9 -8
- {naas_abi_cli-1.8.0.dist-info → naas_abi_cli-1.9.0.dist-info}/WHEEL +0 -0
- {naas_abi_cli-1.8.0.dist-info → naas_abi_cli-1.9.0.dist-info}/entry_points.txt +0 -0
naas_abi_cli/cli/new/module.py
CHANGED
|
@@ -5,10 +5,7 @@ import naas_abi_cli
|
|
|
5
5
|
from naas_abi_cli.cli.utils.Copier import Copier
|
|
6
6
|
|
|
7
7
|
from .new import new
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def sanitize_module_name(module_name: str) -> str:
|
|
11
|
-
return module_name.replace("-", "_").replace(" ", "_").lower()
|
|
8
|
+
from .utils import to_kebab_case, to_pascal_case, to_snake_case
|
|
12
9
|
|
|
13
10
|
|
|
14
11
|
@new.command("module")
|
|
@@ -19,12 +16,12 @@ def _new_module(module_name: str, module_path: str = "."):
|
|
|
19
16
|
|
|
20
17
|
|
|
21
18
|
def new_module(module_name: str, module_path: str = ".", quiet: bool = False):
|
|
22
|
-
module_name =
|
|
19
|
+
module_name = to_kebab_case(module_name)
|
|
23
20
|
|
|
24
21
|
if module_path == ".":
|
|
25
|
-
module_path = os.path.join(os.getcwd(), module_name)
|
|
22
|
+
module_path = os.path.join(os.getcwd(), to_snake_case(module_name))
|
|
26
23
|
else:
|
|
27
|
-
module_path = os.path.join(module_path, module_name)
|
|
24
|
+
module_path = os.path.join(module_path, to_snake_case(module_name))
|
|
28
25
|
|
|
29
26
|
if not os.path.exists(module_path):
|
|
30
27
|
os.makedirs(module_path, exist_ok=True)
|
|
@@ -42,8 +39,8 @@ def new_module(module_name: str, module_path: str = ".", quiet: bool = False):
|
|
|
42
39
|
copier.copy(
|
|
43
40
|
values={
|
|
44
41
|
"module_name": module_name,
|
|
45
|
-
"module_name_snake": module_name
|
|
46
|
-
"module_name_pascal": module_name
|
|
42
|
+
"module_name_snake": to_snake_case(module_name),
|
|
43
|
+
"module_name_pascal": to_pascal_case(module_name),
|
|
47
44
|
}
|
|
48
45
|
)
|
|
49
46
|
|
naas_abi_cli/cli/new/project.py
CHANGED
|
@@ -7,12 +7,14 @@ from naas_abi_cli.cli.utils.Copier import Copier
|
|
|
7
7
|
|
|
8
8
|
from .module import new_module
|
|
9
9
|
from .new import new
|
|
10
|
+
from .utils import to_kebab_case, to_pascal_case, to_snake_case
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
@new.command("project")
|
|
13
14
|
@click.argument("project-name", required=False, default=None)
|
|
14
15
|
@click.argument("project-path", required=False, default=None)
|
|
15
16
|
def new_project(project_name: str | None, project_path: str | None):
|
|
17
|
+
project_name = to_kebab_case(project_name)
|
|
16
18
|
# Defaults must be evaluated at runtime so they reflect the caller's CWD.
|
|
17
19
|
if project_name is None:
|
|
18
20
|
project_name = os.path.basename(os.getcwd())
|
|
@@ -40,8 +42,8 @@ def new_project(project_name: str | None, project_path: str | None):
|
|
|
40
42
|
copier.copy(
|
|
41
43
|
values={
|
|
42
44
|
"project_name": project_name,
|
|
43
|
-
"project_name_snake": project_name
|
|
44
|
-
"project_name_pascal": project_name
|
|
45
|
+
"project_name_snake": to_snake_case(project_name),
|
|
46
|
+
"project_name_pascal": to_pascal_case(project_name),
|
|
45
47
|
}
|
|
46
48
|
)
|
|
47
49
|
|
|
@@ -27,5 +27,15 @@ class ABIModule(BaseModule):
|
|
|
27
27
|
pass
|
|
28
28
|
# example: str
|
|
29
29
|
|
|
30
|
+
# on_initialized is called by the engine after all modules and services have been fully loaded.
|
|
31
|
+
# At this point, you can safely access other modules and services through the engine's interfaces.
|
|
32
|
+
# Override this method to implement any post-initialization logic your module requires.
|
|
30
33
|
def on_initialized(self):
|
|
31
34
|
super().on_initialized()
|
|
35
|
+
|
|
36
|
+
# The on_load method is invoked during initial module loading by the engine.
|
|
37
|
+
# At this point, avoid accessing services or other modules, as they have not been loaded yet.
|
|
38
|
+
# Place any logic here that must occur right as the module is loaded, before initialization.
|
|
39
|
+
# You can see it as the constructor of the module.
|
|
40
|
+
def on_load(self):
|
|
41
|
+
super().on_load()
|
|
@@ -6,10 +6,10 @@ from naas_abi_core.services.agent.Agent import (
|
|
|
6
6
|
AgentSharedState,
|
|
7
7
|
)
|
|
8
8
|
|
|
9
|
-
NAME = "{{
|
|
9
|
+
NAME = "{{module_name_pascal}}Agent"
|
|
10
10
|
DESCRIPTION = "An helpful agent that can help you with your tasks."
|
|
11
11
|
SYSTEM_PROMPT = """
|
|
12
|
-
You are {{
|
|
12
|
+
You are {{module_name_pascal}}Agent.
|
|
13
13
|
"""
|
|
14
14
|
|
|
15
15
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import re
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def to_pascal_case(text):
|
|
5
|
+
return "".join(word.capitalize() for word in re.findall(r"[A-Za-z0-9]+", text))
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def to_snake_case(text):
|
|
9
|
+
return "_".join(word.lower() for word in re.findall(r"[A-Za-z0-9]+", text))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def to_kebab_case(text):
|
|
13
|
+
return "-".join(word.lower() for word in re.findall(r"[A-Za-z0-9]+", text))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: naas-abi-cli
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.9.0
|
|
4
4
|
Summary: Abi cli allowing you to build your AI system.
|
|
5
5
|
Project-URL: Homepage, https://github.com/jupyter-naas/abi
|
|
6
6
|
Project-URL: Repository, https://github.com/jupyter-naas/abi/tree/main/libs/naas-abi-cli
|
|
@@ -9,12 +9,13 @@ naas_abi_cli/cli/module.py,sha256=TBl-SpeGUcy1Rrp40Irbt34yQS00xJcNje-OijNE4Hk,71
|
|
|
9
9
|
naas_abi_cli/cli/run.py,sha256=OLrAs0mtnI0jvyW5Bb_Jd3Sp-bWDMdulCcsPixEq-6s,308
|
|
10
10
|
naas_abi_cli/cli/secret.py,sha256=u_yUZgVEcns-CM-qsIIZUHX8j8T6aioJYluqSQhnXFE,2491
|
|
11
11
|
naas_abi_cli/cli/new/__init__.py,sha256=i-lOPJh8DL729CFhZyuXZibsaswsqPj5e7u_N68xXeM,156
|
|
12
|
-
naas_abi_cli/cli/new/module.py,sha256=
|
|
12
|
+
naas_abi_cli/cli/new/module.py,sha256=X4n9VId4wm5HcMNb5iO9dOuXxFYxlIqSEh2tYlCefbA,1642
|
|
13
13
|
naas_abi_cli/cli/new/new.py,sha256=sfNmeoNZLGhjKRKSHuwEl1vtuxWR_SII0qOo9BVoEwY,55
|
|
14
|
-
naas_abi_cli/cli/new/project.py,sha256=
|
|
15
|
-
naas_abi_cli/cli/new/
|
|
14
|
+
naas_abi_cli/cli/new/project.py,sha256=YSxBgJdMVYqWHGwXs9gxRMKA5Q6uRPPaJ_G5UJ4q5_4,2232
|
|
15
|
+
naas_abi_cli/cli/new/utils.py,sha256=E8ICN4Z8gYYS-Z4nOLld8sY8lHWs6yXFm5lePq9ICFs,336
|
|
16
|
+
naas_abi_cli/cli/new/templates/module/__init__.py,sha256=OzGgLvjdv0eF_l34j55VBAUYHPUz3jk-TBVP0wKrpY0,1588
|
|
16
17
|
naas_abi_cli/cli/new/templates/module/agents/README.md,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
|
-
naas_abi_cli/cli/new/templates/module/agents/{{module_name_pascal}}Agent.py,sha256=
|
|
18
|
+
naas_abi_cli/cli/new/templates/module/agents/{{module_name_pascal}}Agent.py,sha256=Swgms8NI2DFAelf484mu0vNqfmT5NB9DKBtq6Ny-D1s,1323
|
|
18
19
|
naas_abi_cli/cli/new/templates/module/orchestrations/README.md,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
20
|
naas_abi_cli/cli/new/templates/module/pipelines/README.md,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
21
|
naas_abi_cli/cli/new/templates/module/workflows/README.md,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -26,7 +27,7 @@ naas_abi_cli/cli/new/templates/project/.github/workflows/release.yaml,sha256=7uV
|
|
|
26
27
|
naas_abi_cli/cli/utils/Copier.py,sha256=cYo-5INC0jSrxcBgf2tvhahMr-92j2-BLpSmb6nQ1pc,3269
|
|
27
28
|
naas_abi_cli/cli/new/templates/project/config.prod.yaml,sha256=Y57Qzz_yt8tfHbtDqGCSQxOkwnLgF4eoGOWOq66xSA8,1877
|
|
28
29
|
naas_abi_cli/cli/new/templates/project/config.yaml,sha256=iQAAO6N3xO7iszG33vbSAljO11Pcf4KOvW3N-avJrsQ,1610
|
|
29
|
-
naas_abi_cli-1.
|
|
30
|
-
naas_abi_cli-1.
|
|
31
|
-
naas_abi_cli-1.
|
|
32
|
-
naas_abi_cli-1.
|
|
30
|
+
naas_abi_cli-1.9.0.dist-info/METADATA,sha256=ZrGpunTUagOpw2uG1fz9CC9KL9tttLl1OKLCvW2M1FQ,7371
|
|
31
|
+
naas_abi_cli-1.9.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
32
|
+
naas_abi_cli-1.9.0.dist-info/entry_points.txt,sha256=ufNXhYVU3uo5dcZ8e1kdEJv1oh2Vons7LHJPg35cP4w,46
|
|
33
|
+
naas_abi_cli-1.9.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|