zrb 1.8.6__py3-none-any.whl → 1.8.8__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/builtin/llm/llm_ask.py +2 -2
- zrb/builtin/llm/tool/code.py +2 -2
- zrb/builtin/llm/tool/file.py +23 -7
- zrb/config.py +5 -5
- zrb/llm_config.py +33 -20
- {zrb-1.8.6.dist-info → zrb-1.8.8.dist-info}/METADATA +2 -2
- {zrb-1.8.6.dist-info → zrb-1.8.8.dist-info}/RECORD +9 -9
- {zrb-1.8.6.dist-info → zrb-1.8.8.dist-info}/WHEEL +0 -0
- {zrb-1.8.6.dist-info → zrb-1.8.8.dist-info}/entry_points.txt +0 -0
zrb/builtin/llm/llm_ask.py
CHANGED
@@ -141,6 +141,6 @@ if CFG.LLM_ALLOW_ACCESS_SHELL:
|
|
141
141
|
|
142
142
|
if CFG.LLM_ALLOW_ACCESS_INTERNET:
|
143
143
|
llm_ask.append_tool(open_web_page, search_wikipedia, search_arxiv)
|
144
|
-
if CFG.
|
145
|
-
llm_ask.append_tool(create_search_internet_tool(CFG.
|
144
|
+
if CFG.SERPAPI_KEY != "":
|
145
|
+
llm_ask.append_tool(create_search_internet_tool(CFG.SERPAPI_KEY))
|
146
146
|
llm_ask.append_tool(get_current_location, get_current_weather)
|
zrb/builtin/llm/tool/code.py
CHANGED
@@ -4,7 +4,7 @@ from zrb.builtin.llm.tool.file import DEFAULT_EXCLUDED_PATTERNS, is_excluded
|
|
4
4
|
from zrb.builtin.llm.tool.sub_agent import create_sub_agent_tool
|
5
5
|
from zrb.context.any_context import AnyContext
|
6
6
|
|
7
|
-
|
7
|
+
_EXTRACT_INFO_FROM_REPO_SYSTEM_PROMPT = """
|
8
8
|
You are an extraction info agent.
|
9
9
|
Your goal is to help to extract relevant information to help the main LLM Agent.
|
10
10
|
You write your output is in markdown format containing path and relevant information.
|
@@ -169,7 +169,7 @@ async def _extract_info(
|
|
169
169
|
extract = create_sub_agent_tool(
|
170
170
|
tool_name="extract",
|
171
171
|
tool_description="extract",
|
172
|
-
system_prompt=
|
172
|
+
system_prompt=_EXTRACT_INFO_FROM_REPO_SYSTEM_PROMPT,
|
173
173
|
)
|
174
174
|
extracted_infos = []
|
175
175
|
content_buffer = ""
|
zrb/builtin/llm/tool/file.py
CHANGED
@@ -8,6 +8,28 @@ from zrb.builtin.llm.tool.sub_agent import create_sub_agent_tool
|
|
8
8
|
from zrb.context.any_context import AnyContext
|
9
9
|
from zrb.util.file import read_file, read_file_with_line_numbers, write_file
|
10
10
|
|
11
|
+
_EXTRACT_INFO_SYSTEM_PROMPT = """
|
12
|
+
You are an extraction info agent.
|
13
|
+
Your goal is to help to extract relevant information to help the main LLM Agent.
|
14
|
+
You write your output is in markdown format containing path and relevant information.
|
15
|
+
Extract only information that relevant to main LLM Agent's goal.
|
16
|
+
|
17
|
+
Extracted Information format (Use this as reference, extract relevant information only):
|
18
|
+
# imports
|
19
|
+
- <imported-package>
|
20
|
+
- ...
|
21
|
+
# variables
|
22
|
+
- <variable-type> <variable-name>: <the-purpose-of-the-variable>
|
23
|
+
- ...
|
24
|
+
# functions
|
25
|
+
- <function-name>:
|
26
|
+
- parameters: <parameters>
|
27
|
+
- logic/description: <what-the-function-do-and-how-it-works>
|
28
|
+
...
|
29
|
+
...
|
30
|
+
""".strip()
|
31
|
+
|
32
|
+
|
11
33
|
DEFAULT_EXCLUDED_PATTERNS = [
|
12
34
|
# Common Python artifacts
|
13
35
|
"__pycache__",
|
@@ -464,13 +486,7 @@ async def analyze_file(ctx: AnyContext, path: str, query: str) -> str:
|
|
464
486
|
_analyze_file = create_sub_agent_tool(
|
465
487
|
tool_name="analyze_file",
|
466
488
|
tool_description="analyze file with LLM capability",
|
467
|
-
system_prompt=
|
468
|
-
[
|
469
|
-
"You are a file analyzer assistant",
|
470
|
-
"Your goal is to help the main asisstant by reading file",
|
471
|
-
"and perform necessary indepth analysis required by the main assistant",
|
472
|
-
]
|
473
|
-
),
|
489
|
+
system_prompt=_EXTRACT_INFO_SYSTEM_PROMPT,
|
474
490
|
tools=[read_from_file, search_files],
|
475
491
|
)
|
476
492
|
return await _analyze_file(
|
zrb/config.py
CHANGED
@@ -245,17 +245,17 @@ class Config:
|
|
245
245
|
@property
|
246
246
|
def LLM_MAX_TOKENS_PER_MINUTE(self) -> int:
|
247
247
|
"""Maximum number of LLM tokens allowed per minute."""
|
248
|
-
return int(os.getenv("
|
248
|
+
return int(os.getenv("ZRB_LLM_MAX_TOKENS_PER_MINUTE", "120000"))
|
249
249
|
|
250
250
|
@property
|
251
251
|
def LLM_MAX_TOKENS_PER_REQUEST(self) -> int:
|
252
252
|
"""Maximum number of tokens allowed per individual LLM request."""
|
253
|
-
return int(os.getenv("
|
253
|
+
return int(os.getenv("ZRB_LLM_MAX_TOKENS_PER_REQUEST", "30000"))
|
254
254
|
|
255
255
|
@property
|
256
256
|
def LLM_THROTTLE_SLEEP(self) -> float:
|
257
257
|
"""Number of seconds to sleep when throttling is required."""
|
258
|
-
return float(os.getenv("
|
258
|
+
return float(os.getenv("ZRB_LLM_THROTTLE_SLEEP", "1.0"))
|
259
259
|
|
260
260
|
@property
|
261
261
|
def LLM_CONTEXT_ENRICHMENT_PROMPT(self) -> str | None:
|
@@ -321,8 +321,8 @@ class Config:
|
|
321
321
|
return int(os.getenv("ZRB_RAG_MAX_RESULT_COUNT", "5"))
|
322
322
|
|
323
323
|
@property
|
324
|
-
def
|
325
|
-
return os.getenv("
|
324
|
+
def SERPAPI_KEY(self) -> str:
|
325
|
+
return os.getenv("SERPAPI_KEY", "")
|
326
326
|
|
327
327
|
@property
|
328
328
|
def BANNER(self) -> str:
|
zrb/llm_config.py
CHANGED
@@ -12,42 +12,55 @@ else:
|
|
12
12
|
from zrb.config import CFG
|
13
13
|
|
14
14
|
DEFAULT_SYSTEM_PROMPT = """
|
15
|
-
You have access to tools.
|
16
|
-
Your goal is to complete the user's task efficiently.
|
15
|
+
You have access to tools and two forms of memory: a narrative summary of the long-term conversation and a structured JSON object with key facts.
|
16
|
+
Your goal is to complete the user's task efficiently by synthesizing information from both memory types and the current turn.
|
17
17
|
Analyze the request and use the available tools proactively to achieve the goal.
|
18
18
|
Infer parameters and actions from the context.
|
19
|
-
Do not ask for confirmation unless strictly necessary due to ambiguity
|
20
|
-
missing critical information.
|
19
|
+
Do not ask for confirmation unless strictly necessary for irreversible actions or due to critical ambiguity.
|
21
20
|
Apply relevant domain knowledge and best practices.
|
22
21
|
Respond directly and concisely upon task completion or when clarification is essential.
|
23
22
|
Make sure to always include all necessary information in your final answer.
|
24
|
-
Remember that
|
23
|
+
Remember that your narrative summary may be condensed; rely on the structured JSON for precise facts when available.
|
25
24
|
""".strip()
|
26
25
|
|
27
26
|
DEFAULT_PERSONA = """
|
28
|
-
You are
|
27
|
+
You are a helpful, clear, and precise expert in various fields including technology, science, history, and more.
|
28
|
+
As an expert, your goal is to provide accurate information efficiently, getting straight to the point while remaining helpful.
|
29
|
+
While you are an expert, if you are uncertain about a fact, state what you know and what you are unsure about.
|
29
30
|
""".strip()
|
30
31
|
|
31
32
|
# Concise summarization focused on preserving critical context for continuity.
|
32
33
|
DEFAULT_SUMMARIZATION_PROMPT = """
|
33
|
-
You are a summarization assistant.
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
34
|
+
You are a summarization assistant. Your goal is to help the main assistant continue a conversation by creating an updated, concise summary.
|
35
|
+
You will integrate the previous summary (if any) with the new conversation history.
|
36
|
+
|
37
|
+
It is CRITICAL to preserve the immediate context of the most recent exchange. Your summary MUST conclude with the user's last intent and the assistant's pending action.
|
38
|
+
For example, if the user says "Yes" after the assistant asks "Do you want me to search?", the summary must explicitly state: "The user has confirmed that they want the assistant to proceed with the search for [topic]."
|
39
|
+
|
40
|
+
Preserve ALL critical context:
|
41
|
+
- The user's main, overarching goal.
|
42
|
+
- The user's most recent, immediate intent.
|
43
|
+
- Key decisions, facts, and entities (names, files, IDs).
|
44
|
+
- Results from any tool usage.
|
45
|
+
- Any pending questions or actions the assistant was about to take.
|
46
|
+
|
47
|
+
Do not omit details that would force the main assistant to re-ask a question the user has already answered.
|
40
48
|
Output *only* the updated summary text.
|
41
49
|
""".strip()
|
42
50
|
|
43
51
|
DEFAULT_CONTEXT_ENRICHMENT_PROMPT = """
|
44
|
-
You are an information extraction assistant.
|
45
|
-
|
46
|
-
|
47
|
-
Analyze the conversation
|
48
|
-
user_name,
|
49
|
-
|
50
|
-
|
52
|
+
You are an information extraction assistant. Your goal is to help the main assistant by extracting important structured information from the conversation.
|
53
|
+
Handle all data, especially personally identifiable information (PII), with strict confidentiality.
|
54
|
+
|
55
|
+
Analyze the conversation to extract two types of information:
|
56
|
+
1. **Stable Facts**: Key-value pairs that are unlikely to change often (e.g., user_name, user_id, project_name).
|
57
|
+
2. **Conversational State**: The immediate task-related context. This is critical for maintaining continuity.
|
58
|
+
- "user_intent": The user's most recently stated goal (e.g., "find information about Albert Einstein").
|
59
|
+
- "pending_action": An action the assistant has proposed and is awaiting confirmation for or is about to execute (e.g., "search_internet").
|
60
|
+
- "action_parameters": A JSON object of parameters for the pending_action (e.g., {"query": "Albert Einstein"}).
|
61
|
+
|
62
|
+
If an existing key needs to be updated (e.g., user changes their mind), replace the old value with the new one.
|
63
|
+
Return only a JSON object containing a single key "response", whose value is another JSON object with these details (i.e., {"response": {"context_name": "value"}}).
|
51
64
|
If no context can be extracted, return {"response": {}}.
|
52
65
|
""".strip()
|
53
66
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: zrb
|
3
|
-
Version: 1.8.
|
3
|
+
Version: 1.8.8
|
4
4
|
Summary: Your Automation Powerhouse
|
5
5
|
Home-page: https://github.com/state-alchemists/zrb
|
6
6
|
License: AGPL-3.0-or-later
|
@@ -26,7 +26,7 @@ Requires-Dist: openai (>=1.76.0,<2.0.0) ; extra == "rag" or extra == "all"
|
|
26
26
|
Requires-Dist: pdfplumber (>=0.11.6,<0.12.0) ; extra == "rag" or extra == "all"
|
27
27
|
Requires-Dist: playwright (>=1.51.0,<2.0.0) ; extra == "playwright" or extra == "all"
|
28
28
|
Requires-Dist: psutil (>=7.0.0,<8.0.0)
|
29
|
-
Requires-Dist: pydantic-ai (>=0.2.
|
29
|
+
Requires-Dist: pydantic-ai (>=0.2.18,<0.3.0)
|
30
30
|
Requires-Dist: pyjwt (>=2.10.1,<3.0.0)
|
31
31
|
Requires-Dist: python-dotenv (>=1.1.0,<2.0.0)
|
32
32
|
Requires-Dist: python-jose[cryptography] (>=3.4.0,<4.0.0)
|
@@ -12,13 +12,13 @@ zrb/builtin/jwt.py,sha256=3M5uaQhJZbKQLjTUft1OwPz_JxtmK-xtkjxWjciOQho,2859
|
|
12
12
|
zrb/builtin/llm/chat_session.py,sha256=ot2ss6yA4qIINg0nl3KJYnLag8H0eB9ggAgRGEUkZdE,6639
|
13
13
|
zrb/builtin/llm/history.py,sha256=cnkOyO43uiMQ9cEvmqk-pPoCk1zCAH_fwAqSgBtsjzY,3079
|
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=ltQlPEItcLW8pSZifUS5Ec9k8OvUo3__8W2MAG9J3IA,4438
|
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=yR9I0ZsI96OeQl9pgwORMASVuXsAL0a89D_iPS4C8Dc,1699
|
19
19
|
zrb/builtin/llm/tool/cli.py,sha256=_CNEmEc6K2Z0i9ppYeM7jGpqaEdT3uxaWQatmxP3jKE,858
|
20
|
-
zrb/builtin/llm/tool/code.py,sha256=
|
21
|
-
zrb/builtin/llm/tool/file.py,sha256
|
20
|
+
zrb/builtin/llm/tool/code.py,sha256=7fozry3yKJ2793W4BQkiGnH4OgU0FCe87kNRG05DJZ4,7428
|
21
|
+
zrb/builtin/llm/tool/file.py,sha256=hgm2s5zjGu2lo05Y0XisBu9HeaPPs2FyzwaoHBSFAhI,18355
|
22
22
|
zrb/builtin/llm/tool/rag.py,sha256=yqx7vXXyrOCJjhQJl4s0TnLL-2uQUTuKRnkWlSQBW0M,7883
|
23
23
|
zrb/builtin/llm/tool/sub_agent.py,sha256=_ItDE5MV_RZtnY_-IUsSMmm6mYaDY3YRINT0hVNsGkA,4702
|
24
24
|
zrb/builtin/llm/tool/web.py,sha256=pXRLhcB_Y6z-2w4C4WezH8n-pg3PSMgt_bwn3aaqi6g,5479
|
@@ -217,7 +217,7 @@ zrb/callback/callback.py,sha256=PFhCqzfxdk6IAthmXcZ13DokT62xtBzJr_ciLw6I8Zg,4030
|
|
217
217
|
zrb/cmd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
218
218
|
zrb/cmd/cmd_result.py,sha256=L8bQJzWCpcYexIxHBNsXj2pT3BtLmWex0iJSMkvimOA,597
|
219
219
|
zrb/cmd/cmd_val.py,sha256=7Doowyg6BK3ISSGBLt-PmlhzaEkBjWWm51cED6fAUOQ,1014
|
220
|
-
zrb/config.py,sha256=
|
220
|
+
zrb/config.py,sha256=XJCJl3u6fo9OlL8V1HNLn5iKcSJjIICQk87CkBrA7IU,10222
|
221
221
|
zrb/content_transformer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
222
222
|
zrb/content_transformer/any_content_transformer.py,sha256=v8ZUbcix1GGeDQwB6OKX_1TjpY__ksxWVeqibwa_iZA,850
|
223
223
|
zrb/content_transformer/content_transformer.py,sha256=STl77wW-I69QaGzCXjvkppngYFLufow8ybPLSyAvlHs,2404
|
@@ -246,7 +246,7 @@ zrb/input/option_input.py,sha256=TQB82ko5odgzkULEizBZi0e9TIHEbIgvdP0AR3RhA74,213
|
|
246
246
|
zrb/input/password_input.py,sha256=szBojWxSP9QJecgsgA87OIYwQrY2AQ3USIKdDZY6snU,1465
|
247
247
|
zrb/input/str_input.py,sha256=NevZHX9rf1g8eMatPyy-kUX3DglrVAQpzvVpKAzf7bA,81
|
248
248
|
zrb/input/text_input.py,sha256=6T3MngWdUs0u0ZVs5Dl11w5KS7nN1RkgrIR_zKumzPM,3695
|
249
|
-
zrb/llm_config.py,sha256=
|
249
|
+
zrb/llm_config.py,sha256=9Pvm8SIW97C0C03tSZv-6aBsaFz4fiId3FG3znFteUk,13473
|
250
250
|
zrb/llm_rate_limitter.py,sha256=RXdtPreMcmoYSE2Ab2StyHH95F0bD2pGmyySXs4gRio,3725
|
251
251
|
zrb/runner/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
252
252
|
zrb/runner/cli.py,sha256=AbLTNqFy5FuyGQOWOjHZGaBC8e2yuE_Dx1sBdnisR18,6984
|
@@ -390,7 +390,7 @@ zrb/util/string/name.py,sha256=SXEfxJ1-tDOzHqmSV8kvepRVyMqs2XdV_vyoh_9XUu0,1584
|
|
390
390
|
zrb/util/todo.py,sha256=VGISej2KQZERpornK-8X7bysp4JydMrMUTnG8B0-liI,20708
|
391
391
|
zrb/xcom/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
392
392
|
zrb/xcom/xcom.py,sha256=o79rxR9wphnShrcIushA0Qt71d_p3ZTxjNf7x9hJB78,1571
|
393
|
-
zrb-1.8.
|
394
|
-
zrb-1.8.
|
395
|
-
zrb-1.8.
|
396
|
-
zrb-1.8.
|
393
|
+
zrb-1.8.8.dist-info/METADATA,sha256=x49O7t73u93ctMp-rTAz-MjelM8ZDyuVZ8vRFSEG54I,9761
|
394
|
+
zrb-1.8.8.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
395
|
+
zrb-1.8.8.dist-info/entry_points.txt,sha256=-Pg3ElWPfnaSM-XvXqCxEAa-wfVI6BEgcs386s8C8v8,46
|
396
|
+
zrb-1.8.8.dist-info/RECORD,,
|
File without changes
|
File without changes
|