Skip to content

Count a call's searches in core - #105

Merged
VasiliyRad merged 2 commits into
mainfrom
vasiliy/search-units
Oct 7, 2026
Merged

VasiliyRad merged 2 commits into
mainfrom
vasiliy/search-units

Conversation

@VasiliyRad

@VasiliyRad VasiliyRad commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

What

Which fields carry a call's search and fetch counts, and which retrieval operation a channel bills them as, were about to live in the internal app, and the pipeline's search-stack swap carries its own copy. They are catalog knowledge, and every consumer that prices a call (the app, the OSS server, the pipeline) has to read them the same way, so they move here:

  • count_search_units(row): the relay's web_search_calls and grounding_queries, then Anthropic's server_tool_use.web_search_requests, one per Perplexity request (Perplexity bills every request as one), then the web_search_call items among tool_calls. A field that is present and says nothing was searched is a measured zero; None means no field says, which the pipeline treats as unknown rather than free.
  • count_fetch_units(row): Anthropic's server_tool_use.web_fetch_requests, then the web_fetch_call items, with the same rule.
  • search_operation_for_channel(channel) and fetch_operation_for_channel(channel): web_search on openai-api and anthropic-api, google_search_grounding on google-api and google-vertex-ai, search_request_low on perplexity-api (the floor every request pays; no capture path records the context size); web_fetch on anthropic-api. None where a channel charges no fee.

The item types are the pipeline's audited set (web_search_call, web_fetch_call), as the Responses API emits them. Version 0.2.55.

Follow-ups this enables, in their own repos: the pipeline's _PROVIDER_SUPPORT operation strings, native_search_pricing_operation and _native_search_evidence can call these instead of their own copies, so captured Anthropic and Vertex traffic stops reading as search-free in classification; the app's ingest counts fetches into its fee column.

Evidence

  • core/tests: 869 passed. test_search_units.py covers the field order, each capture shape, measured zeros against unknowns, fetches, the operation per channel, and that every named operation prices in the shipped catalog.

🤖 Generated with Claude Code

VasiliyRad and others added 2 commits October 6, 2026 16:09
Which fields carry a call's search count, and which retrieval operation a
channel bills a search as, were each consumer's own knowledge. They are
catalog knowledge: count_search_units reads the relay's counts,
Anthropic's server tool block, the search items among tool calls, and one
per Perplexity request; search_operation_for_channel names the operation
each fee-charging channel prices. Version 0.2.55.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
What the pipeline's search-stack swap reads: Anthropic's fetches beside
its searches, a measured zero (the field is there and says none) apart
from no field at all, and the web_search_call and web_fetch_call item
types the Responses API emits. count_fetch_units and
fetch_operation_for_channel join the search pair so a consumer prices
both the way the pipeline already does.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@VasiliyRad
VasiliyRad merged commit ca737eb into main Oct 7, 2026
5 checks passed
@VasiliyRad
VasiliyRad deleted the vasiliy/search-units branch October 7, 2026 00:30
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.

1 participant