createEmbedding method

Future<EmbeddingsResponse> createEmbedding({
  1. required String prompt,
})

Creates an embedding vector representing the input text. returns it as a EmbeddingsResponse object

Implementation

Future<EmbeddingsResponse> createEmbedding({required String prompt}) async {
  try {
    _checkApi(values: [prompt]);
    final map = {'model': _configEmbedding.model, 'input': prompt};
    final result =
        await service.createEmbedding(apiKey: _apiKey, promptWithModel: map);
    return result;
  } catch (e) {
    throw _exceptionCheck(e);
  }
}