EmbeddingRequest class

A request to generate embeddings for input text.

Embeddings are numerical representations of text that capture semantic meaning, useful for search, clustering, recommendations, and more.

Example

final request = EmbeddingRequest(
  model: 'text-embedding-3-small',
  input: EmbeddingInput.text('Hello, world!'),
);
Annotations
  • @immutable

Constructors

EmbeddingRequest({required String model, required EmbeddingInput input, EmbeddingEncodingFormat? encodingFormat, int? dimensions, String? user})
Creates an EmbeddingRequest.
const
EmbeddingRequest.fromJson(Map<String, dynamic> json)
Creates an EmbeddingRequest from JSON.
factory

Properties

dimensions int?
The number of dimensions for the output embeddings.
final
encodingFormat EmbeddingEncodingFormat?
The format to return embeddings in.
final
hashCode int
The hash code for this object.
no setteroverride
input EmbeddingInput
The input text to generate embeddings for.
final
model String
The model to use for generating embeddings.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
user String?
A unique identifier representing your end-user.
final

Methods

copyWith({String? model, EmbeddingInput? input, Object? encodingFormat = unsetCopyWithValue, Object? dimensions = unsetCopyWithValue, Object? user = unsetCopyWithValue}) EmbeddingRequest
Creates a copy with the given fields replaced.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Converts to JSON.
toString() String
A string representation of this object.
override

Operators

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