zrb 1.15.24__py3-none-any.whl → 1.15.25__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.
- zrb/__init__.py +2 -6
- zrb/builtin/group.py +26 -14
- zrb/builtin/llm/llm_ask.py +41 -39
- {zrb-1.15.24.dist-info → zrb-1.15.25.dist-info}/METADATA +1 -1
- {zrb-1.15.24.dist-info → zrb-1.15.25.dist-info}/RECORD +7 -7
- {zrb-1.15.24.dist-info → zrb-1.15.25.dist-info}/WHEEL +0 -0
- {zrb-1.15.24.dist-info → zrb-1.15.25.dist-info}/entry_points.txt +0 -0
zrb/__init__.py
CHANGED
@@ -61,6 +61,7 @@ _LAZY_LOAD = {
|
|
61
61
|
}
|
62
62
|
|
63
63
|
if TYPE_CHECKING:
|
64
|
+
from zrb import builtin
|
64
65
|
from zrb.attr.type import (
|
65
66
|
AnyAttr,
|
66
67
|
BoolAttr,
|
@@ -126,9 +127,4 @@ def __getattr__(name: str) -> Any:
|
|
126
127
|
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
127
128
|
|
128
129
|
|
129
|
-
|
130
|
-
CFG = __getattr__("CFG")
|
131
|
-
if CFG.LOAD_BUILTIN:
|
132
|
-
from zrb import builtin
|
133
|
-
|
134
|
-
assert builtin
|
130
|
+
from zrb import builtin
|
zrb/builtin/group.py
CHANGED
@@ -1,39 +1,51 @@
|
|
1
|
+
from zrb.config.config import CFG
|
1
2
|
from zrb.group.group import Group
|
2
3
|
from zrb.runner.cli import cli
|
3
4
|
|
4
|
-
|
5
|
-
|
5
|
+
|
6
|
+
def _maybe_add_group(group: Group):
|
7
|
+
if CFG.LOAD_BUILTIN:
|
8
|
+
cli.add_group(group)
|
9
|
+
return group
|
10
|
+
|
11
|
+
|
12
|
+
base64_group = _maybe_add_group(
|
13
|
+
Group(name="base64", description="📄 Base64 operations")
|
14
|
+
)
|
15
|
+
uuid_group = _maybe_add_group(Group(name="uuid", description="🆔 UUID operations"))
|
6
16
|
uuid_v1_group = uuid_group.add_group(Group(name="v1", description="UUID V1 operations"))
|
7
17
|
uuid_v3_group = uuid_group.add_group(Group(name="v3", description="UUID V3 operations"))
|
8
18
|
uuid_v4_group = uuid_group.add_group(Group(name="v4", description="UUID V4 operations"))
|
9
19
|
uuid_v5_group = uuid_group.add_group(Group(name="v5", description="UUID V5 operations"))
|
10
|
-
ulid_group =
|
11
|
-
jwt_group =
|
12
|
-
http_group =
|
20
|
+
ulid_group = _maybe_add_group(Group(name="ulid", description="🔢 ULID operations"))
|
21
|
+
jwt_group = _maybe_add_group(Group(name="jwt", description="🔒 JWT encode/decode"))
|
22
|
+
http_group = _maybe_add_group(
|
23
|
+
Group(name="http", description="🌐 HTTP request operations")
|
24
|
+
)
|
13
25
|
|
14
|
-
random_group =
|
15
|
-
git_group =
|
26
|
+
random_group = _maybe_add_group(Group(name="random", description="🔀 Random operation"))
|
27
|
+
git_group = _maybe_add_group(Group(name="git", description="🌱 Git related commands"))
|
16
28
|
git_branch_group = git_group.add_group(
|
17
29
|
Group(name="branch", description="🌿 Git branch related commands")
|
18
30
|
)
|
19
31
|
git_subtree_group = git_group.add_group(
|
20
32
|
Group(name="subtree", description="🌳 Git subtree related commands")
|
21
33
|
)
|
22
|
-
llm_group =
|
23
|
-
md5_group =
|
24
|
-
python_group =
|
34
|
+
llm_group = _maybe_add_group(Group(name="llm", description="🤖 LLM operations"))
|
35
|
+
md5_group = _maybe_add_group(Group(name="md5", description="🔢 Md5 operations"))
|
36
|
+
python_group = _maybe_add_group(
|
25
37
|
Group(name="python", description="🐍 Python related commands")
|
26
38
|
)
|
27
|
-
todo_group =
|
39
|
+
todo_group = _maybe_add_group(Group(name="todo", description="✅ Todo management"))
|
28
40
|
|
29
|
-
shell_group =
|
41
|
+
shell_group = _maybe_add_group(
|
30
42
|
Group(name="shell", description="💬 Shell related commands")
|
31
43
|
)
|
32
44
|
shell_autocomplete_group: Group = shell_group.add_group(
|
33
45
|
Group(name="autocomplete", description="⌨️ Shell autocomplete related commands")
|
34
46
|
)
|
35
47
|
|
36
|
-
project_group =
|
48
|
+
project_group = _maybe_add_group(
|
37
49
|
Group(name="project", description="📁 Project related commands")
|
38
50
|
)
|
39
51
|
add_to_project_group = project_group.add_group(
|
@@ -43,7 +55,7 @@ add_fastapp_to_project_group = add_to_project_group.add_group(
|
|
43
55
|
Group(name="fastapp", description="🚀 Add Fastapp resources")
|
44
56
|
)
|
45
57
|
|
46
|
-
setup_group =
|
58
|
+
setup_group = _maybe_add_group(Group(name="setup", description="🔧 Setup"))
|
47
59
|
setup_latex_group = setup_group.add_group(
|
48
60
|
Group(name="latex", description="✍️ Setup LaTeX")
|
49
61
|
)
|
zrb/builtin/llm/llm_ask.py
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
from collections.abc import Callable
|
2
|
+
from typing import TYPE_CHECKING
|
3
|
+
|
1
4
|
from zrb.builtin.group import llm_group
|
2
5
|
from zrb.builtin.llm.chat_session import get_llm_ask_input_mapping, read_user_prompt
|
3
6
|
from zrb.builtin.llm.history import read_chat_conversation, write_chat_conversation
|
@@ -32,6 +35,42 @@ from zrb.task.base_trigger import BaseTrigger
|
|
32
35
|
from zrb.task.llm_task import LLMTask
|
33
36
|
from zrb.util.string.conversion import to_boolean
|
34
37
|
|
38
|
+
if TYPE_CHECKING:
|
39
|
+
from pydantic_ai import Tool
|
40
|
+
|
41
|
+
ToolOrCallable = Tool | Callable
|
42
|
+
|
43
|
+
|
44
|
+
def _get_tool(ctx: AnyContext) -> list["ToolOrCallable"]:
|
45
|
+
tools = []
|
46
|
+
if CFG.LLM_ALLOW_ANALYZE_REPO:
|
47
|
+
tools.append(analyze_repo)
|
48
|
+
if CFG.LLM_ALLOW_ANALYZE_FILE:
|
49
|
+
tools.append(analyze_file)
|
50
|
+
if CFG.LLM_ALLOW_ACCESS_LOCAL_FILE:
|
51
|
+
tools.append(search_files)
|
52
|
+
tools.append(list_files)
|
53
|
+
tools.append(read_from_file)
|
54
|
+
tools.append(read_many_files)
|
55
|
+
tools.append(replace_in_file)
|
56
|
+
tools.append(write_to_file)
|
57
|
+
tools.append(write_many_files)
|
58
|
+
if CFG.LLM_ALLOW_ACCESS_SHELL:
|
59
|
+
tools.append(run_shell_command)
|
60
|
+
if CFG.LLM_ALLOW_OPEN_WEB_PAGE:
|
61
|
+
tools.append(open_web_page)
|
62
|
+
if CFG.LLM_ALLOW_SEARCH_WIKIPEDIA:
|
63
|
+
tools.append(search_wikipedia)
|
64
|
+
if CFG.LLM_ALLOW_SEARCH_ARXIV:
|
65
|
+
tools.append(search_arxiv)
|
66
|
+
if CFG.LLM_ALLOW_GET_CURRENT_LOCATION:
|
67
|
+
tools.append(get_current_location)
|
68
|
+
if CFG.LLM_ALLOW_GET_CURRENT_WEATHER:
|
69
|
+
tools.append(get_current_weather)
|
70
|
+
if CFG.SERPAPI_KEY != "" and CFG.LLM_ALLOW_SEARCH_INTERNET:
|
71
|
+
tools.append(create_search_internet_tool(CFG.SERPAPI_KEY))
|
72
|
+
return tools
|
73
|
+
|
35
74
|
|
36
75
|
def _get_default_yolo_mode(ctx: AnyContext) -> str:
|
37
76
|
default_value = llm_config.default_yolo_mode
|
@@ -92,7 +131,7 @@ _llm_ask_inputs = [
|
|
92
131
|
"modes",
|
93
132
|
description="Modes",
|
94
133
|
prompt="Modes",
|
95
|
-
default="
|
134
|
+
default=lambda ctx: ",".join(llm_config.default_modes),
|
96
135
|
allow_positional_parsing=False,
|
97
136
|
always_prompt=False,
|
98
137
|
),
|
@@ -144,6 +183,7 @@ llm_ask: LLMTask = llm_group.add_task(
|
|
144
183
|
None if ctx.input.modes.strip() == "" else ctx.input.modes.split(",")
|
145
184
|
),
|
146
185
|
message="{ctx.input.message}",
|
186
|
+
tools=_get_tool,
|
147
187
|
yolo_mode=_render_yolo_mode_input,
|
148
188
|
retries=0,
|
149
189
|
),
|
@@ -169,41 +209,3 @@ llm_group.add_task(
|
|
169
209
|
),
|
170
210
|
alias="chat",
|
171
211
|
)
|
172
|
-
|
173
|
-
if CFG.LLM_ALLOW_ANALYZE_REPO:
|
174
|
-
llm_ask.append_tool(analyze_repo)
|
175
|
-
|
176
|
-
if CFG.LLM_ALLOW_ANALYZE_FILE:
|
177
|
-
llm_ask.append_tool(analyze_file)
|
178
|
-
|
179
|
-
if CFG.LLM_ALLOW_ACCESS_LOCAL_FILE:
|
180
|
-
llm_ask.append_tool(
|
181
|
-
search_files,
|
182
|
-
list_files,
|
183
|
-
read_from_file,
|
184
|
-
read_many_files,
|
185
|
-
replace_in_file,
|
186
|
-
write_to_file,
|
187
|
-
write_many_files,
|
188
|
-
)
|
189
|
-
|
190
|
-
if CFG.LLM_ALLOW_ACCESS_SHELL:
|
191
|
-
llm_ask.append_tool(run_shell_command)
|
192
|
-
|
193
|
-
if CFG.LLM_ALLOW_OPEN_WEB_PAGE:
|
194
|
-
llm_ask.append_tool(open_web_page)
|
195
|
-
|
196
|
-
if CFG.LLM_ALLOW_SEARCH_WIKIPEDIA:
|
197
|
-
llm_ask.append_tool(search_wikipedia)
|
198
|
-
|
199
|
-
if CFG.LLM_ALLOW_SEARCH_ARXIV:
|
200
|
-
llm_ask.append_tool(search_arxiv)
|
201
|
-
|
202
|
-
if CFG.LLM_ALLOW_GET_CURRENT_LOCATION:
|
203
|
-
llm_ask.append_tool(get_current_location)
|
204
|
-
|
205
|
-
if CFG.LLM_ALLOW_GET_CURRENT_WEATHER:
|
206
|
-
llm_ask.append_tool(get_current_weather)
|
207
|
-
|
208
|
-
if CFG.SERPAPI_KEY != "" and CFG.LLM_ALLOW_SEARCH_INTERNET:
|
209
|
-
llm_ask.append_tool(create_search_internet_tool(CFG.SERPAPI_KEY))
|
@@ -1,4 +1,4 @@
|
|
1
|
-
zrb/__init__.py,sha256=
|
1
|
+
zrb/__init__.py,sha256=qkCV2EnAGIgvsawBHYvKgPAp0zzPcikYSmbQXATLzg4,5060
|
2
2
|
zrb/__main__.py,sha256=9SXH9MK4PVyU9lkEyHxiIUABbcsV2wseP94HmlqTR4M,2657
|
3
3
|
zrb/attr/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
4
|
zrb/attr/type.py,sha256=4TV5gPYMMrKh5V-yB6iRYKCbsXAH_AvGXMsjxKLHcUs,568
|
@@ -6,13 +6,13 @@ zrb/builtin/__init__.py,sha256=NjXpvBgAiPH-dNsJx5Fa-zSZE5JVnmVb1GhMNtevpGQ,1614
|
|
6
6
|
zrb/builtin/base64.py,sha256=UjaFttE2oRx0T7_RpKtKfgMtWfiQXfJBAJmA16ek8Ic,1507
|
7
7
|
zrb/builtin/git.py,sha256=8_qVE_2lVQEVXQ9vhiw8Tn4Prj1VZB78ZjEJJS5Ab3M,5461
|
8
8
|
zrb/builtin/git_subtree.py,sha256=7BKwOkVTWDrR0DXXQ4iJyHqeR6sV5VYRt8y_rEB0EHg,3505
|
9
|
-
zrb/builtin/group.py,sha256=
|
9
|
+
zrb/builtin/group.py,sha256=zYC5uw0VE97TXiLCr464kFJ-CJIJyeQ2RXjnVRY5ovs,2577
|
10
10
|
zrb/builtin/http.py,sha256=L6RE73c65wWwG5iHFN-tpOhyh56KsrgVskDd3c3YXtk,4246
|
11
11
|
zrb/builtin/jwt.py,sha256=3M5uaQhJZbKQLjTUft1OwPz_JxtmK-xtkjxWjciOQho,2859
|
12
12
|
zrb/builtin/llm/chat_session.py,sha256=p0giSVYuQMQ5H1hbQzl7cMb49XZqWG0SF7X-ixB5EBU,10203
|
13
13
|
zrb/builtin/llm/history.py,sha256=LDOrL0p7r_AHLa5L8Dp7bHNsOALugmJd7OguXRWGnm4,3087
|
14
14
|
zrb/builtin/llm/input.py,sha256=Nw-26uTWp2QhUgKJcP_IMHmtk-b542CCSQ_vCOjhvhM,877
|
15
|
-
zrb/builtin/llm/llm_ask.py,sha256=
|
15
|
+
zrb/builtin/llm/llm_ask.py,sha256=U-0QKI15bio_SoXxR9p18jCmIEdFNLCCyA2MohtHvyY,6588
|
16
16
|
zrb/builtin/llm/previous-session.js,sha256=xMKZvJoAbrwiyHS0OoPrWuaKxWYLoyR5sguePIoCjTY,816
|
17
17
|
zrb/builtin/llm/tool/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
18
18
|
zrb/builtin/llm/tool/api.py,sha256=T8NGhBe59sQiu8LfdPOIBmsTNMXWFEKaPPSY9bolsQ8,2401
|
@@ -410,7 +410,7 @@ zrb/util/todo_model.py,sha256=hhzAX-uFl5rsg7iVX1ULlJOfBtblwQ_ieNUxBWfc-Os,1670
|
|
410
410
|
zrb/util/truncate.py,sha256=eSzmjBpc1Qod3lM3M73snNbDOcARHukW_tq36dWdPvc,921
|
411
411
|
zrb/xcom/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
412
412
|
zrb/xcom/xcom.py,sha256=o79rxR9wphnShrcIushA0Qt71d_p3ZTxjNf7x9hJB78,1571
|
413
|
-
zrb-1.15.
|
414
|
-
zrb-1.15.
|
415
|
-
zrb-1.15.
|
416
|
-
zrb-1.15.
|
413
|
+
zrb-1.15.25.dist-info/METADATA,sha256=AKQi_6ugcBjR-oDl8QO9fOGLHfNe8_SxoRh-wGT-QP0,9892
|
414
|
+
zrb-1.15.25.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
415
|
+
zrb-1.15.25.dist-info/entry_points.txt,sha256=-Pg3ElWPfnaSM-XvXqCxEAa-wfVI6BEgcs386s8C8v8,46
|
416
|
+
zrb-1.15.25.dist-info/RECORD,,
|
File without changes
|
File without changes
|