Repository navigation
Added
HttpEmbedderreports the usage its provider sends.Embeddergains
embed_documents_meteredandembed_query_metered, which return the vectors
with the provider's ownusage(prompt_tokens,total_tokens) as a
Metered<T>; the HTTP provider reads it from the OpenAI-compatible response
and sums it across batches, and every other provider reportsNone, so an
application that pays per token settles the bill from the provider's count
instead of an estimate (#212).HttpEmbedderruns over an application-owned transport.
HttpEmbedder::with_transporttakes anEmbeddingTransport: the application
sends eachTransportRequest(the pinned endpoint, headers, JSON body,
timeout and response cap) through its own HTTP client, credential resolver
and admission rules and returns aTransportResponsewith the status,
headers and body. The embedding protocol, retries,Retry-After, parsing and
vector validation stay in the framework, which also refuses a body over the
cap whatever the transport did (#213).LazyEmbedderregisters a shipped profile and loads the model on first
use.SearchRegistry::register_embeddercan take aLazyEmbedderbuilt
from a shippedModelProfileand a loader; the service starts and tests run
without downloading weights. The generation coordinator calls the new
Embedder::resolve_profilebefore it pins a generation, so the generation
still records the loaded model's revision, and a loaded model whose id or
dimensions differ from the shipped profile is refused by name (#214).- A search generation an interrupted build left behind can be reclaimed.
generations::reclaim_generation(index, generation)andsearch:reclaim
release the creation lease of acreatinggeneration so the next create
call resumes at once instead of waiting the 60-second lease out, publish a
buildinggeneration that was never switched to, and report one that is
already current. The caller vouches for exclusive ownership, such as its own
migration lock;SearchEngine::release_creation_leaseis the driver hook,
a no-op for drivers without leases (#215). - A Cloudflare CDN driver for static publication.
CloudflareDriver
(featurecdn-cloudflare, on by default and free of new dependencies) works
the way an R2 bucket with a custom domain already does: the bucket is the
publication disk throughS3Configwith the R2 endpoint, the custom domain
serves it, and nothing runs at the edge. The driver owns a few rules on the
zone, created on the first switch and corrected on every later one: two URL
rewrites that serve/aboutand/about/from the mirrored
about/index.html, a response header rule that carries the published
headers, and a cache rule that caches a response only when its own
Cache-Controlallows a shared cache, as the published objects' does. It
purges by URL in batches of 100 or by prefix, and removes
its rules on a first-publication rollback.CloudflareDriver::for_origin
covers a hostname that mixes dynamic pages: the proxied application serves
the published objects itself and the driver keeps the cache rule and the
purges. R2 charges no egress. - An application's own 5xx page is sent as built. With debug off, the
framework answered every browser 5xx with its minimal status-only view,
which also replaced a 503 page the application built on purpose, with its
recovery link andContent-Security-Policy.HttpResponse::error_view()
marks such a response as the application's own error view, and the
production view leaves it alone, body and headers. Unmarked 5xx responses
keep the minimal view; with debug on the development error page still
replaces a marked response that carries an error report (#217).
Known issue
CloudflareDriver::new, the R2 custom domain mode, serves nothing in this tag: the publisher writes the stable copies the domain serves only when no CDN driver is installed. Fixed on main in 232dda7 (CdnDriver::serves_mirror), which the next release carries. CloudflareDriver::for_origin and the CloudFront driver are not affected.