OpenAICompatibleEmbedder constructor

OpenAICompatibleEmbedder({
  1. required Uri baseUrl,
  2. required String model,
  3. required int dimensions,
  4. String? apiKey,
  5. int batchSize = 128,
  6. bool requestDimensions = false,
  7. String? purposeField,
  8. Map<String, Object?> extraBody = const {},
  9. Map<String, String> headers = const {},
  10. Duration timeout = const Duration(minutes: 2),
  11. int maxRetries = 2,
  12. 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');
  }
}