Skip to main content

Module ask

Module ask 

Source
Expand description

Asking a provider what it can do, over a seam a test can stand in for.

Every request in QCode that leaves the machine goes through Web, for the same reason every installation goes through Installer: the real one is built in one place, and a test is handed one that answers from a string it was given. No test in this crate can reach the network, whatever it asks for, and the suite is the same on a machine with no server anywhere.

Three things are asked here.

What models there are, what window each of them claims and what each of them costs — all from the provider’s own API, never guessed and never scraped: ollama answers /api/tags and /api/show, OpenRouter answers /api/v1/models with a price beside every model. A ready-made provider answers its own /v1/models; where that names a model without its window, the window its maker publishes is kept, and the page says where it was read.

What window the server really gives, which is the one that matters and the one nobody tells you. A model’s record can say 262 144 while the endpoint a harness actually uses pins the window to 4 096 and throws the front of every larger prompt away without a word or an error. measure finds that edge the only way it can be found: it sends prompts of growing size and watches where the input token count the server reports stops growing.

A request goes out only when the person asked for it. Nothing here runs because a page was opened.

Structs§

Answer
What a provider answered.
Ask
One request to a provider.
Secret
How a key is carried into a request.
Web
How a request is carried out.

Enums§

AskError
Why a question could not be answered.
Method
The two methods anything here uses.
Reached
What a trial found.

Functions§

can_be_sent_to
Whether a request could be sent to url at all, judged the way Web::network judges it.
list_models
What a provider offers, with the window each model claims and, where the service publishes one, what each of them costs.
listing
The request that lists what a provider offers.
measure
Measures the window model really gets on this server, by sending prompts of growing size and watching for the first one the server does not read whole.
probing
The request one probe of words words is made of, opening with run and its own size so that no two probes begin alike. See measure for why that matters.
secret_of
entry’s key as the header its kind reads it from, when it has one. The relay adds the very same header, so what the page tried is what a tab sends.
showing
The request that asks an ollama server about one model, which is where its claimed window comes from.
trial
The request that tries the connection: the one thing that only ever goes out because the person pressed something.
try_connection
Tries the connection to entry and says what answered.