MockEmbeddingModelV2<VALUE> class
A controllable mock embedding model for testing.
Mirrors MockEmbeddingModelV1 from the JS AI SDK v6 ai/test sub-path.
final model = MockEmbeddingModelV2(
embedding: [0.1, 0.2, 0.3],
);
final result = await embed(model: model, value: 'hello');
expect(result.embedding, [0.1, 0.2, 0.3]);
Constructors
Properties
- doEmbedError → Object?
-
If set, doEmbed throws this error instead of returning embeddings.
final
-
embedCalls
→ List<
EmbeddingModelV2CallOptions< VALUE> > -
All call options passed to doEmbed in the order they were called.
final
-
embedding
→ List<
double> -
The embedding vector to return for every input value.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- modelId → String
-
final
- provider → String
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- specificationVersion → String
-
no setter
- usage → EmbeddingModelV2Usage?
-
Token usage to report.
final
Methods
-
doEmbed(
EmbeddingModelV2CallOptions< VALUE> options) → Future<EmbeddingModelV2GenerateResult< VALUE> > -
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