Skip to content

web_search: fetch a specific URL directly via Venice's scrape endpoint - #467

Merged
sysread merged 1 commit into
mainfrom
claude/web-tool-direct-url-scrape-bjzssl
Jul 30, 2026
Merged

web_search: fetch a specific URL directly via Venice's scrape endpoint#467
sysread merged 1 commit into
mainfrom
claude/web-tool-direct-url-scrape-bjzssl

Conversation

@sysread

@sysread sysread commented Jul 30, 2026

Copy link
Copy Markdown
Owner

SYNOPSIS

Adds a url param to the web_search tool: when provided, the page is fetched directly via Venice's /augment/scrape endpoint instead of the search pipeline.

PURPOSE

Currently a direct link handed to the chat model goes through enable_web_search, a pipeline built around queries - it searches for the URL instead of reading it, so the model fumbles exactly when the user names the page they want.

DESCRIPTION

Today, web_search runs a one-shot sub-completion with enable_web_search: 'on' against the search model and returns {answer, citations}; query is required on the wire schema.

This PR adds a url mode: a new veniceScrapeUrl helper in _shared/venice.ts (same fetch-injectable shape + VeniceError mapping as the sibling wire helpers, offline Deno tests) POSTs to /augment/scrape and returns the page as markdown. The tool caps content at 32k chars with a truncated flag, and returns a single self-citation so the fetched page rides the existing tool-citation harvest into the sources panel. The wire schema drops the required list and the description steers the model to pass exactly one of query or url.

Result: a pasted link is read, not searched for, and the raw-markdown path spends no sub-completion tokens on synthesis.

Notes:

  • required: [] on the schema is intentional - edge-side validation is the real gate (repo convention), and requiring query would force a dummy query in url mode. Both provided: url wins, by design.
  • Blocked hosts (Venice 400s X/Twitter, Reddit) surface the upstream error body verbatim so the model explains instead of retrying.

Generated by Claude Code

The chat model kept fumbling when the user handed it a direct link:
the search pipeline behind enable_web_search is built around queries,
so a bare URL got searched FOR instead of read. This adds a second
retrieval mode to web_search - pass `url` and the tool posts it to
Venice's /augment/scrape endpoint and returns the page content as
markdown, skipping the search sub-completion entirely.

New veniceScrapeUrl helper in _shared/venice.ts follows the sibling
wire-helpers' shape (fetch-injectable, VeniceError mapping, offline
Deno tests). The tool caps returned content at 32k chars with a
truncated flag so an unbounded page can't blow the chat context, and
returns a single self-citation so the fetched page surfaces in the
reply's sources panel through the existing tool-citation harvest.
The wire schema drops the required list (edge-side validation is the
real gate; requiring query would force a dummy query in url mode)
and steers the model to pass exactly one of query or url.
@sysread
sysread merged commit 562a117 into main Jul 30, 2026
1 check passed
@sysread
sysread deleted the claude/web-tool-direct-url-scrape-bjzssl branch July 30, 2026 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants