zrb 1.7.0__py3-none-any.whl → 1.7.2__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/jwt.py CHANGED
@@ -24,10 +24,12 @@ from zrb.task.make_task import make_task
24
24
  ],
25
25
  )
26
26
  def encode_jwt(ctx: AnyContext) -> str:
27
+ import json
28
+
27
29
  import jwt
28
30
 
29
31
  try:
30
- payload = eval(ctx.input.payload)
32
+ payload = json.loads(ctx.input.payload)
31
33
  token = jwt.encode(
32
34
  payload=payload, key=ctx.input.secret, algorithm=ctx.input.algorithm
33
35
  )
@@ -135,13 +135,14 @@ if CFG.LLM_ALLOW_ACCESS_LOCAL_FILE:
135
135
  tool_name="analyze_file",
136
136
  tool_description="\n".join(
137
137
  [
138
- "Analyze file using LLM capability.",
138
+ "Always use this tool to analyze file using LLM capability.",
139
139
  "This tool can do:",
140
140
  "- summarization",
141
141
  "- outline/structure extraction",
142
142
  "- code review",
143
143
  "- other tasks requiring deep understanding.",
144
- "Always use this tool to get deep understanding of file content",
144
+ "This tool ONLY HAVE SINGLE ARGUMENT: query",
145
+ "Make sure to include the file path you want to analyze in the query",
145
146
  ]
146
147
  ),
147
148
  sub_agent_system_prompt="\n".join(
@@ -47,6 +47,7 @@ async def enrich_context(
47
47
 
48
48
  ctx.log_info("Attempting to enrich conversation context...")
49
49
  # Prepare context and history for the enrichment prompt
50
+ history_summary = conversation_context.get("history_summary")
50
51
  try:
51
52
  context_json = json.dumps(conversation_context)
52
53
  history_json = json.dumps(history_list)
@@ -54,7 +55,13 @@ async def enrich_context(
54
55
  user_prompt_data = "\n".join(
55
56
  [
56
57
  "Extract context from the following conversation info.",
57
- "Maintain the relevan context and remove the unrelevant ones.",
58
+ "Extract only contexts that will be relevant across multiple conversations, like", # noqa
59
+ "- user name",
60
+ "- user hobby",
61
+ "- user's long life goal",
62
+ "- standard/SOP",
63
+ "- etc.",
64
+ "Always maintain the relevant context and remove the irrelevant ones.",
58
65
  "Restructure the context in a helpful way",
59
66
  "Keep the context small",
60
67
  f"Existing Context: {context_json}",
@@ -89,7 +96,9 @@ async def enrich_context(
89
96
  usage = enrichment_run.result.usage()
90
97
  ctx.print(stylize_faint(f"[Token Usage] {usage}"), plain=True)
91
98
  if response:
92
- conversation_context.update(response)
99
+ conversation_context = response
100
+ # Re inject history summary
101
+ conversation_context["history_summary"] = history_summary
93
102
  ctx.log_info("Context enriched based on history.")
94
103
  ctx.log_info(
95
104
  f"Updated conversation context: {json.dumps(conversation_context)}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: zrb
3
- Version: 1.7.0
3
+ Version: 1.7.2
4
4
  Summary: Your Automation Powerhouse
5
5
  Home-page: https://github.com/state-alchemists/zrb
6
6
  License: AGPL-3.0-or-later
@@ -8,11 +8,11 @@ zrb/builtin/git.py,sha256=8_qVE_2lVQEVXQ9vhiw8Tn4Prj1VZB78ZjEJJS5Ab3M,5461
8
8
  zrb/builtin/git_subtree.py,sha256=7BKwOkVTWDrR0DXXQ4iJyHqeR6sV5VYRt8y_rEB0EHg,3505
9
9
  zrb/builtin/group.py,sha256=t008xLM4_fgbjfZrPoi_fQAnSHIo6MOiQSCHBO4GDYU,2379
10
10
  zrb/builtin/http.py,sha256=sLqEczuSxGYXWzyJR6frGOHkPTviu4BeyroUr3-ZuAI,4322
11
- zrb/builtin/jwt.py,sha256=kjCf8qt7tkW9BpBDRAVTMJaEPQGzCbO1wo9xt5JoM8A,2836
11
+ zrb/builtin/jwt.py,sha256=3M5uaQhJZbKQLjTUft1OwPz_JxtmK-xtkjxWjciOQho,2859
12
12
  zrb/builtin/llm/chat_session.py,sha256=HqFwrE1DiSlJrR-S3LRYWQBHkVsD-sfAV8_IIbnmtqY,6631
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=7Dx5XWf0QAbPwscGohloKOp_iqoI-JuaVojTaCJL3Jc,5332
15
+ zrb/builtin/llm/llm_ask.py,sha256=GKjJZEVPgW0IbcRDNF9W7deHcLDPUyq3C0Vl-DqiJLc,5427
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
@@ -320,7 +320,7 @@ zrb/task/llm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
320
320
  zrb/task/llm/agent.py,sha256=6wGSsw03GdY_fj12CsJh7wxB6BnE13N8RYXaWfbiUsk,5451
321
321
  zrb/task/llm/config.py,sha256=oGxHYMdIvhASnKwNuMPwcdeJiFfS0tNskzGHakpfpQU,3458
322
322
  zrb/task/llm/context.py,sha256=U9a8lxa2ikz6my0Sd5vpO763legHrMHyvBjbrqNmv0Y,3838
323
- zrb/task/llm/context_enrichment.py,sha256=i2oWcs0mJGkfT8Jho3tQwNADagG9qU5oEZHbGxTTsSs,6629
323
+ zrb/task/llm/context_enrichment.py,sha256=jB7lekwo4hTk8HIwhhq7HSMfgAzwaV2U867icBRt6Z0,7088
324
324
  zrb/task/llm/error.py,sha256=27DQXSG8SH1-XuvXFdZQKzP39wZDWmd_YnSTz6DJKKI,3690
325
325
  zrb/task/llm/history.py,sha256=3WMXoi7RquxosXQf3iv2_BCeF8iKtY1f407pR71xERs,7745
326
326
  zrb/task/llm/history_summarization.py,sha256=n3GbgwXlDIkgpJppMGfpqF_8Wpi9yAoZYh46O1pFQeU,6432
@@ -370,7 +370,7 @@ zrb/util/string/name.py,sha256=SXEfxJ1-tDOzHqmSV8kvepRVyMqs2XdV_vyoh_9XUu0,1584
370
370
  zrb/util/todo.py,sha256=VGISej2KQZERpornK-8X7bysp4JydMrMUTnG8B0-liI,20708
371
371
  zrb/xcom/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
372
372
  zrb/xcom/xcom.py,sha256=o79rxR9wphnShrcIushA0Qt71d_p3ZTxjNf7x9hJB78,1571
373
- zrb-1.7.0.dist-info/METADATA,sha256=CFGNJW5jVSUWPFlS6-xNemTuGvjfBrOrmymGwRc3V40,8385
374
- zrb-1.7.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
375
- zrb-1.7.0.dist-info/entry_points.txt,sha256=-Pg3ElWPfnaSM-XvXqCxEAa-wfVI6BEgcs386s8C8v8,46
376
- zrb-1.7.0.dist-info/RECORD,,
373
+ zrb-1.7.2.dist-info/METADATA,sha256=JA6bk-DSmoriPSaNGzS8nmmka4IaNC7SLJQjNaCR_RE,8385
374
+ zrb-1.7.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
375
+ zrb-1.7.2.dist-info/entry_points.txt,sha256=-Pg3ElWPfnaSM-XvXqCxEAa-wfVI6BEgcs386s8C8v8,46
376
+ zrb-1.7.2.dist-info/RECORD,,
File without changes