CapturingLLMClient
A test double implementation of LLMClient that captures the last inputs provided to each API and returns predefined responses. This is useful in unit and integration tests to assert that a component under test interacts with an LLM client as expected without making real network calls.
Constructor parameters allow you to predefine what each method should return.
Constructors
Properties
The last batched input passed to embed, or null if it hasn't been called yet.
The last LLModel passed to executeMultipleChoices, or null if it hasn't been called yet.
The last Prompt passed to executeMultipleChoices, or null if it hasn't been called yet.
The last list of tools passed to executeMultipleChoices, or null if it hasn't been called yet.
The last text passed to embed, or null if it hasn't been called yet.
The last list of tools passed to execute, or null if it hasn't been called yet.
The last LLModel passed to executeStreaming, or null if it hasn't been called yet.
The last Prompt passed to executeStreaming, or null if it hasn't been called yet.
Functions
Simulates an embedding call. Captures input parameters and returns the predefined embedResult.
Simulates a batch embedding call. Captures input parameters and returns the predefined batchEmbedResult.
Simulates a non-streaming LLM execution. Captures input parameters and returns the predefined executeResponse.
Simulates an LLM call that returns multiple choices. Captures input parameters and returns the predefined choices.
Simulates a streaming LLM execution. Captures input parameters and emits the predefined streamingChunks.
Simulates a content moderation call. Captures input parameters and returns the predefined moderationResult.