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
urlat all, judged the wayWeb::networkjudges 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
modelreally 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
wordswords is made of, opening withrunand its own size so that no two probes begin alike. Seemeasurefor 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
entryand says what answered.