createSearch method
- String engineId,
- CreateSearchRequest createSearchRequest
The search endpoint computes similarity scores between provided query and documents. Documents can be passed directly to the API if there are no more than 200 of them. To go beyond the 200 document limit, documents can be processed offline and then used for efficient retrieval at query time. When file is set, the search endpoint searches over all the documents in the given file and returns up to the max_rerank number of documents. These documents will be returned along with their search scores. The similarity score is a positive score that usually ranges from 0 to 300 (but can sometimes go higher), where a score above 200 usually means the document is semantically similar to the query.
Parameters:
-
String engineId (required): The ID of the engine to use for this request. You can select one of
ada,babbage,curie, ordavinci. -
CreateSearchRequest createSearchRequest (required):
Implementation
Future<CreateSearchResponse?> createSearch(String engineId, CreateSearchRequest createSearchRequest,) async {
final response = await createSearchWithHttpInfo(engineId, createSearchRequest,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'CreateSearchResponse',) as CreateSearchResponse;
}
return null;
}