mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-30 03:00:41 -04:00
fix(backend/copilot): keep tool schema under char budget for web_search
Trim web_search description + params (733 → 476 chars saved 257) and bump the schema char budget from 32_500 to 32_800 to absorb the remaining skeleton cost of a newly added LLM-facing primitive. Unblocks test_total_schema_char_budget in the py3.11/3.12/3.13 matrix.
This commit is contained in:
@@ -21,7 +21,11 @@ from backend.copilot.tools import TOOL_REGISTRY
|
||||
# response shape carries) and the dry_run description. Keeps the
|
||||
# regression gate effective while accepting a deliberate ~120-token
|
||||
# spend on LLM-decision-critical copy.
|
||||
_CHAR_BUDGET = 32_500
|
||||
# Bumped 32500 -> 32800 on PR #12871 for the new web_search tool
|
||||
# (server-side Anthropic beta). Description already trimmed to the
|
||||
# minimum viable copy; the bump absorbs the schema skeleton cost
|
||||
# (~300 chars / ~75 tokens) for a new LLM-facing primitive.
|
||||
_CHAR_BUDGET = 32_800
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
|
||||
@@ -36,13 +36,9 @@ class WebSearchTool(BaseTool):
|
||||
@property
|
||||
def description(self) -> str:
|
||||
return (
|
||||
"Search the web and return cited results. Use this for live "
|
||||
"information — news, current events, up-to-date docs, recent "
|
||||
"releases — when the model's training data would be stale. "
|
||||
"Returns a list of {title, url, snippet} plus the URLs so "
|
||||
"``web_fetch`` can deep-dive any result. Costs a few cents "
|
||||
"per search; prefer one well-targeted query over many "
|
||||
"reformulations."
|
||||
"Search the web for live info (news, recent docs). Returns "
|
||||
"{title, url, snippet}; use web_fetch to deep-dive a URL. "
|
||||
"Prefer one targeted query over many reformulations."
|
||||
)
|
||||
|
||||
@property
|
||||
@@ -52,13 +48,13 @@ class WebSearchTool(BaseTool):
|
||||
"properties": {
|
||||
"query": {
|
||||
"type": "string",
|
||||
"description": "The search query — a question or topic.",
|
||||
"description": "Search query.",
|
||||
},
|
||||
"max_results": {
|
||||
"type": "integer",
|
||||
"description": (
|
||||
f"Maximum results to return (default "
|
||||
f"{_DEFAULT_MAX_RESULTS}, hard cap {_HARD_MAX_RESULTS})."
|
||||
f"Max results (default {_DEFAULT_MAX_RESULTS}, "
|
||||
f"cap {_HARD_MAX_RESULTS})."
|
||||
),
|
||||
"default": _DEFAULT_MAX_RESULTS,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user