refactor(agent): remove hasWebTools conditional in data section
Web tools are always available, so the conditional branching was unnecessary. Data section now always includes the dynamic evidence decision guidance. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
0330b8b7ca
commit
24435cdba4
2 changed files with 6 additions and 16 deletions
|
|
@ -181,8 +181,8 @@ describe("buildConditionalToolSections", () => {
|
|||
expect(text).toContain("Web usage is conditional, not mandatory");
|
||||
});
|
||||
|
||||
it("adds dynamic evidence decision guidance when both data and web tools are present", () => {
|
||||
const result = buildConditionalToolSections(["data", "web_search"], "full");
|
||||
it("adds dynamic evidence decision guidance when data tool is present", () => {
|
||||
const result = buildConditionalToolSections(["data"], "full");
|
||||
const text = result.join("\n");
|
||||
expect(text).toContain("## Data Access");
|
||||
expect(text).toContain("dynamic evidence decision");
|
||||
|
|
|
|||
|
|
@ -240,7 +240,6 @@ export function buildConditionalToolSections(
|
|||
if (mode === "none" || !tools || tools.length === 0) return [];
|
||||
|
||||
const toolSet = new Set(tools.map((t) => t.toLowerCase()));
|
||||
const hasWebTools = toolSet.has("web_search") || toolSet.has("web_fetch");
|
||||
const lines: string[] = [];
|
||||
|
||||
// Memory tools
|
||||
|
|
@ -271,28 +270,19 @@ export function buildConditionalToolSections(
|
|||
|
||||
// Data tools
|
||||
if (toolSet.has("data")) {
|
||||
const dataLines = [
|
||||
lines.push(
|
||||
"## Data Access",
|
||||
"You have access to structured financial and market data via the `data` tool.",
|
||||
'Use domain="finance" with specific actions to retrieve stock prices, financial statements, SEC filings, metrics, and more.',
|
||||
"Always specify dates in YYYY-MM-DD format. Use period='annual' or 'quarterly' or 'ttm' for financial statements.",
|
||||
hasWebTools
|
||||
? "When both data and web tools are available, make a dynamic evidence decision: start from structured data, and use web tools only when external validation is needed (for example: event-driven, time-sensitive, or conflicting/incomplete evidence)."
|
||||
: "Use tool outputs as evidence, and clearly state assumptions when data is incomplete.",
|
||||
...(hasWebTools
|
||||
? [
|
||||
"Make this evidence decision internally. In final answers, present concise user-facing research rationale instead of technical decision labels unless the user asks for methodology details.",
|
||||
]
|
||||
: []),
|
||||
"When both data and web tools are available, make a dynamic evidence decision: start from structured data, and use web tools only when external validation is needed (for example: event-driven, time-sensitive, or conflicting/incomplete evidence).",
|
||||
"Make this evidence decision internally. In final answers, present concise user-facing research rationale instead of technical decision labels unless the user asks for methodology details.",
|
||||
"",
|
||||
];
|
||||
lines.push(
|
||||
...dataLines,
|
||||
);
|
||||
}
|
||||
|
||||
// Web tools
|
||||
if (hasWebTools) {
|
||||
if (toolSet.has("web_search") || toolSet.has("web_fetch")) {
|
||||
lines.push(
|
||||
"## Web Access",
|
||||
"You have web access. Use it when the user asks about current events, needs up-to-date information, or requests content from URLs.",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue