RecordingLlm

class RecordingLlm(delegate: OnDeviceLlm = FakeOnDeviceLlm()) : OnDeviceLlm(source)

Wraps another OnDeviceLlm (a FakeOnDeviceLlm by default) and records every call that reaches it — so a test can assert what an app's OWN caller actually sent (a CompositeOnDeviceLlm's PromptGuard-wrapped text, a retry, a prompt the caller built up itself) without inspecting that caller's internals. Every non-recording member (isAvailable, supportsImage, capabilities) delegates straight through to delegate via by — this class only intercepts the four call entry points to log them before forwarding.

Constructors

Link copied to clipboard
constructor(delegate: OnDeviceLlm = FakeOnDeviceLlm())

Properties

Link copied to clipboard

Every call this backend has seen, one entry per generate/generateStream invocation, in order.

Link copied to clipboard

The plain text of the LAST call, when it was a single LlmPart.Text (the common generate(prompt) case).

Link copied to clipboard
open override val supportsImage: Boolean

Functions

Link copied to clipboard
open suspend override fun capabilities(): AiCapabilities
Link copied to clipboard
open suspend override fun generate(prompt: String): AiResult<String>
open suspend override fun generate(parts: List<LlmPart>): AiResult<String>
Link copied to clipboard
open override fun generateStream(prompt: String): Flow<String>
open override fun generateStream(parts: List<LlmPart>): Flow<String>
Link copied to clipboard
open override fun isAvailable(): Boolean