@tiens.nguyen/gonext-local-worker 1.0.91 → 1.0.92
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.
- package/gonext_agent_chat.py +21 -11
- package/package.json +1 -1
package/gonext_agent_chat.py
CHANGED
|
@@ -482,22 +482,23 @@ def run_agent_chat(cfg):
|
|
|
482
482
|
|
|
483
483
|
# Agent path — from here all step events go into <think>.
|
|
484
484
|
_log("router: agent (HTTP tool use needed)")
|
|
485
|
-
_emit({"type": "step", "text": "
|
|
485
|
+
_emit({"type": "step", "text": "Choosing a tool…"})
|
|
486
486
|
|
|
487
487
|
# Prepend explicit tool instructions so small models pick the right tool, never
|
|
488
488
|
# fabricate URLs/responses, and always terminate with final_answer().
|
|
489
489
|
from datetime import datetime as _dt_now
|
|
490
490
|
now_str = _dt_now.now().astimezone().strftime("%A, %d %B %Y, %H:%M %Z")
|
|
491
491
|
tool_hint = (
|
|
492
|
-
|
|
493
|
-
"
|
|
494
|
-
"
|
|
492
|
+
"YOU HAVE EXACTLY ONE TURN. Read the TASK above. In a single code block, call "
|
|
493
|
+
"the ONE tool that fits THAT task, then pass its result to final_answer(). "
|
|
494
|
+
"Do not plan multiple steps.\n\n"
|
|
495
495
|
"You have THREE tools:\n"
|
|
496
496
|
" 1. http_request(method, url, headers='', body='', username='', password='') — "
|
|
497
497
|
"call a SPECIFIC known API/URL.\n"
|
|
498
|
-
" 2. web_search(query) — look up facts
|
|
499
|
-
"Returns a summary + source.\n"
|
|
500
|
-
" 3. get_current_datetime(timezone='') — current date/time (
|
|
498
|
+
" 2. web_search(query) — look up facts about a person, place, thing, or topic "
|
|
499
|
+
"when you do NOT already have a real URL. Returns a summary + source.\n"
|
|
500
|
+
f" 3. get_current_datetime(timezone='') — current date/time ONLY (now: {now_str}). "
|
|
501
|
+
"Use this ONLY when the task explicitly asks for the date or time.\n"
|
|
501
502
|
"\n"
|
|
502
503
|
"http_request RETURN FORMAT: 'HTTP 200\\n{body}' — first line is 'HTTP <code>', body follows.\n"
|
|
503
504
|
"\n"
|
|
@@ -511,9 +512,10 @@ def run_agent_chat(cfg):
|
|
|
511
512
|
" response = http_request('GET', url, headers='{\"Authorization\": \"Bearer TOKEN\"}')\n"
|
|
512
513
|
" final_answer(response)\n"
|
|
513
514
|
"\n"
|
|
514
|
-
"CHOOSING A TOOL:\n"
|
|
515
|
-
"-
|
|
516
|
-
"- '
|
|
515
|
+
"CHOOSING A TOOL (match the TASK, not these examples):\n"
|
|
516
|
+
"- ONLY a date/time question (e.g. 'what is the date today') -> get_current_datetime().\n"
|
|
517
|
+
"- 'who is' / 'what is' / 'tell me about' / a person / place / topic / general "
|
|
518
|
+
"knowledge -> web_search(query).\n"
|
|
517
519
|
"- A specific known API/URL was given -> http_request().\n"
|
|
518
520
|
"\n"
|
|
519
521
|
"RULES:\n"
|
|
@@ -525,7 +527,15 @@ def run_agent_chat(cfg):
|
|
|
525
527
|
"- If a tool returns 'Error:' or HTTP 4xx/5xx, try a DIFFERENT approach, not the same URL.\n"
|
|
526
528
|
"- Do NOT put final_answer outside the code block.\n\n"
|
|
527
529
|
)
|
|
528
|
-
|
|
530
|
+
# Lead with the TASK so the weak model anchors on what's actually being asked —
|
|
531
|
+
# not on the tool reference below. (Previously the hint led with the date, and the
|
|
532
|
+
# 3B model treated every message as a date question.)
|
|
533
|
+
task_with_hint = (
|
|
534
|
+
"TASK (answer THIS, choose the tool that fits it):\n"
|
|
535
|
+
f"{task_text}\n\n"
|
|
536
|
+
"----- TOOL REFERENCE -----\n"
|
|
537
|
+
+ tool_hint
|
|
538
|
+
)
|
|
529
539
|
|
|
530
540
|
# Track URLs that have already failed so we don't retry dead endpoints across steps.
|
|
531
541
|
_failed_urls: set = set()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiens.nguyen/gonext-local-worker",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.92",
|
|
4
4
|
"description": "Polls GoNext cloud API for async local LLM jobs and runs them against Ollama/OpenAI-compatible servers on this Mac",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|