Repository navigation
Count a call's searches in core - #105
Merged
Merged
Conversation
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>
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.
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'sweb_search_callsandgrounding_queries, then Anthropic'sserver_tool_use.web_search_requests, one per Perplexity request (Perplexity bills every request as one), then theweb_search_callitems amongtool_calls. A field that is present and says nothing was searched is a measured zero;Nonemeans no field says, which the pipeline treats as unknown rather than free.count_fetch_units(row): Anthropic'sserver_tool_use.web_fetch_requests, then theweb_fetch_callitems, with the same rule.search_operation_for_channel(channel)andfetch_operation_for_channel(channel):web_searchonopenai-apiandanthropic-api,google_search_groundingongoogle-apiandgoogle-vertex-ai,search_request_lowonperplexity-api(the floor every request pays; no capture path records the context size);web_fetchonanthropic-api.Nonewhere 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_SUPPORToperation strings,native_search_pricing_operationand_native_search_evidencecan 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.pycovers 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