OpenAICompatibleEmbedder constructor
OpenAICompatibleEmbedder({
- required Uri baseUrl,
- required String model,
- required int dimensions,
- String? apiKey,
- int batchSize = 128,
- bool requestDimensions = false,
- String? purposeField,
- Map<
String, Object?> extraBody = const {}, - Map<
String, String> headers = const {}, - Duration timeout = const Duration(minutes: 2),
- int maxRetries = 2,
- HttpClient? httpClient,
Creates an embedder.
Implementation
OpenAICompatibleEmbedder({
required this.baseUrl,
required this.model,
required this.dimensions,
this.apiKey,
this.batchSize = 128,
this.requestDimensions = false,
this.purposeField,
this.extraBody = const {},
this.headers = const {},
Duration timeout = const Duration(minutes: 2),
int maxRetries = 2,
HttpClient? httpClient,
}) : _http = HttpTransport(
client: httpClient,
timeout: timeout,
maxRetries: maxRetries,
) {
if (dimensions <= 0) {
throw ArgumentError.value(dimensions, 'dimensions', 'must be positive');
}
if (batchSize <= 0) {
throw ArgumentError.value(batchSize, 'batchSize', 'must be positive');
}
}