Mock Language Model
Test stub for a LanguageModel. Drives the agent loop deterministically by replaying a list of ScriptedResponses — one per stream call.
Lets tests verify the loop, the tool dispatch, the lifecycle hooks, the stop conditions, and the message-parts conversion without spinning up a real model.
Since
0.3.0-beta01
Constructors
Properties
Map of URL regex → media-tag list describing which URL shapes the provider accepts inline (so the agent doesn't have to download + base64-encode them itself). Mirrors v6's LanguageModelV3.supportedUrls. Empty default — most on-device providers don't accept URLs and fall back to base64.
Functions
One-shot completion. Requires explicit low-level opt-in at direct call sites.
Streaming completion. Cold until collected, then drives one upstream call per collection. Requires explicit low-level opt-in at direct call sites. Streaming has no default deadline; configure the provider transport or wrap the call in a higher-level CallConfig.timeout.
Streaming completion plus metadata available before stream collection. Implementations must keep the returned stream cold, and must not flowOn/emit from a foreign context — the collection context is the caller's choice. Providers can override this to expose request bodies and response headers while preserving the v6 doStream result shape.