FakeEmbeddingModel class final

An EmbeddingModel returning deterministic vectors.

Vectors are derived from the text's characters, so identical text embeds identically and different text embeds differently — enough to test a retrieval pipeline end to end without a network or a real model.

Implemented types
Available extensions

Constructors

FakeEmbeddingModel({int dimensions = 8, int maxBatchSize = 100})
Creates a fake embedder.

Properties

dimensions int
Number of components each vector has.
final
embedded List<String>
Every input this model was asked to embed.
final
hashCode int
The hash code for this object.
no setterinherited
info ModelInfo
What this model is.
final
maxBatchSize int
Maximum inputs accepted in one call.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() Future<void>
Releases every resource held by this object.
embed(List<String> inputs, {required EmbeddingPurpose purpose, AgenticContext? context}) Future<List<Embedding>>
Embeds inputs, returning one vector per input, in order.
override
embedAll(List<String> inputs, {required EmbeddingPurpose purpose, AgenticContext? context, void onProgress(int done, int total)?}) Future<List<Embedding>>

Available on EmbeddingModel, provided by the EmbeddingModelOperations extension

Embeds any number of inputs, splitting into provider-sized batches.
embedDocument(String text, {AgenticContext? context}) Future<Embedding>

Available on EmbeddingModel, provided by the EmbeddingModelOperations extension

Embeds a single document.
embedQuery(String text, {AgenticContext? context}) Future<Embedding>

Available on EmbeddingModel, provided by the EmbeddingModelOperations extension

Embeds a single search query.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited