refine: tool schema descriptions, docstring format, context_win 18000→20000
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
"name": "code_run",
|
||||
"description": "Code executor. Prefer python. No concurrent calls. Put code in ```python/powershell blocks in reply body to avoid escaping. No hardcoding bulk data",
|
||||
"parameters": {"type": "object", "properties": {
|
||||
"script": {"type": "string", "description": "[Optional] Code to execute. Prefer code blocks in reply body to avoid escaping (leave empty when using code blocks)"},
|
||||
"script": {"type": "string", "description": "[Optional] NEVER use this param when code is in ```python/powershell blocks in reply body. Only use when no code block in reply. Mutually exclusive with reply code blocks"},
|
||||
"type": {"type": "string", "enum": ["python", "powershell"], "description": "Code type", "default": "python"},
|
||||
"timeout": {"type": "integer", "description": "Timeout in seconds", "default": 60},
|
||||
"cwd": {"type": "string", "description": "Working directory, defaults to cwd"}}}
|
||||
@@ -45,7 +45,7 @@
|
||||
"name": "web_execute_js",
|
||||
"description": "Execute JS to control browser. Use precisely to reduce web_scan calls. Put code in ```javascript blocks in reply body to avoid escaping",
|
||||
"parameters": {"type": "object", "properties": {
|
||||
"script": {"type": "string", "description": "[Optional] JS code or path. Prefer code blocks in reply body to avoid escaping (mutually exclusive with this param)"},
|
||||
"script": {"type": "string", "description": "[Optional] JS code or file path. NEVER use this param when code is in ```javascript blocks in reply body. Only use when no code block in reply. Mutually exclusive with reply code blocks"},
|
||||
"save_to_file": {"type": "string", "description": "Save result to file, for long return values", "default": ""},
|
||||
"no_monitor": {"type": "boolean", "description": "Skip page change monitoring, saves 2-3s. Only set for pure reads, not for page actions", "default": false}}}
|
||||
}},
|
||||
|
||||
6
ga.py
6
ga.py
@@ -287,8 +287,7 @@ class GenericAgentHandler(BaseHandler):
|
||||
return matches[-1].strip() if matches else None
|
||||
|
||||
def do_code_run(self, args, response):
|
||||
'''执行代码片段,有长度限制,不允许代码中放大量数据,如有需要应当通过文件读取进行。
|
||||
'''
|
||||
'''执行代码片段,有长度限制,不允许代码中放大量数据,如有需要应当通过文件读取进行。'''
|
||||
if response.tool_calls and sum(1 for tc in response.tool_calls[:args.get('_index', 0)] if tc.function.name == 'code_run') > 0:
|
||||
return StepOutcome("[BLANK]", next_prompt="no multi code_run in one round!")
|
||||
code_type = args.get("type", "python")
|
||||
@@ -477,8 +476,7 @@ class GenericAgentHandler(BaseHandler):
|
||||
return StepOutcome(response, next_prompt=None, should_exit=True)
|
||||
|
||||
def do_start_long_term_update(self, args, response):
|
||||
'''Agent觉得当前任务完成后有重要信息需要记忆时调用此工具。
|
||||
'''
|
||||
'''Agent觉得当前任务完成后有重要信息需要记忆时调用此工具。'''
|
||||
prompt = '''### [总结提炼经验] 既然你觉得当前任务有重要信息需要记忆,请提取最近一次任务中【事实验证成功且长期有效】的环境事实、用户偏好、重要步骤,更新记忆。
|
||||
本工具是标记开启结算过程,若已在更新记忆过程或没有值得记忆的点,忽略本次调用。
|
||||
**提取行动验证成功的信息**:
|
||||
|
||||
@@ -328,7 +328,7 @@ class ClaudeSession:
|
||||
def __init__(self, cfg):
|
||||
self.api_key = cfg['apikey']; self.api_base = cfg['apibase'].rstrip('/')
|
||||
self.default_model = cfg.get('model', 'claude-opus')
|
||||
self.context_win = cfg.get('context_win', 18000)
|
||||
self.context_win = cfg.get('context_win', 20000)
|
||||
self.raw_msgs, self.lock = [], threading.Lock()
|
||||
self.system = ""
|
||||
def _trim_messages(self, raw_msgs):
|
||||
@@ -375,7 +375,7 @@ class LLMSession:
|
||||
def __init__(self, cfg):
|
||||
self.api_key = cfg['apikey']; self.api_base = cfg['apibase'].rstrip('/')
|
||||
self.default_model = cfg['model']
|
||||
self.context_win = cfg.get('context_win', 18000)
|
||||
self.context_win = cfg.get('context_win', 20000)
|
||||
self.raw_msgs, self.messages = [], []
|
||||
proxy = cfg.get('proxy')
|
||||
self.proxies = {"http": proxy, "https": proxy} if proxy else None
|
||||
|
||||
Reference in New Issue
Block a user