web_search: fetch a specific URL directly via Venice's scrape endpoint - #467
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SYNOPSIS
Adds a
urlparam 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_searchruns a one-shot sub-completion withenable_web_search: 'on'against the search model and returns{answer, citations};queryis required on the wire schema.This PR adds a url mode: a new
veniceScrapeUrlhelper in_shared/venice.ts(same fetch-injectable shape + VeniceError mapping as the sibling wire helpers, offline Deno tests) POSTs to/augment/scrapeand returns the page as markdown. The tool caps content at 32k chars with atruncatedflag, and returns a single self-citation so the fetched page rides the existing tool-citation harvest into the sources panel. The wire schema drops therequiredlist and the description steers the model to pass exactly one ofqueryorurl.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 requiringquerywould force a dummy query in url mode. Both provided: url wins, by design.Generated by Claude Code