Available on crate feature
test-utils only.Expand description
Test utilities for deterministic completion-model tests.
Modules§
- streaming_
conformance Not ( target_os=unknownand WebAssembly) - Wire-sequence conformance scenarios for provider streaming pipelines.
Structs§
- Append
Failing Memory - Memory backend that loads empty history and always fails on append.
- Captured
Http Request - Request data captured by
RecordingHttpClient. - Counting
Memory - Memory backend that records load and append calls while delegating storage to
InMemoryConversationMemory. - Failing
Memory - Memory backend that always fails on load and no-ops append and clear.
- Http
Error Streaming Client - An
HttpClientExtimplementation whosesend_streamingfails immediately with a non-success HTTP status and response body. - Mock
Completion Model - A cloneable scripted
CompletionModelfor tests. - Mock
Embedding Model - A deterministic
EmbeddingModelthat returns a fixed vector for each input document. - Mock
Model Lister - A
ModelListerthat returns a preconfigured list of models. - Mock
Multi Text Document - A test document that contributes multiple text fragments to an embedding request.
- Mock
Streaming Client - A mock HTTP client that returns pre-built SSE bytes from
send_streaming. - Mock
Text Document - A test document that contributes one text fragment to an embedding request.
- Mock
Turn - A scripted non-streaming mock completion turn.
- Recording
Http Client - An
HttpClientExtimplementation that records unary requests and returns a fixed response. - Sequenced
Http Client - An
HttpClientExtimplementation that records unary requests and returns one scripted response per request. - Sequenced
Streaming Http Client - An
HttpClientExtimplementation that returns one scripted stream of byte chunks fromsend_streaming.
Enums§
- Mock
Error - Scripted error returned by
MockCompletionModel. - Mock
Http Response - Response scripted for
RecordingHttpClient. - Mock
Stream Event - Scripted streaming event yielded by
MockCompletionModel.
Constants§
- MOCK_
PROVIDER - Provider descriptor name reported by the test doubles.
Functions§
- mock_
final - Build the terminal record the mock model yields, carrying
usage. - mock_
final_ with_ total_ tokens - Build a terminal record whose usage has only
total_tokensset. - scoped_
tracing_ subscriber_ guard - Serializes tests that install scoped tracing subscribers
(
tracing::subscriber::set_default/with_default). - scoped_
tracing_ subscriber_ guard_ blocking - Blocking variant of
scoped_tracing_subscriber_guardfor synchronous tests.