ingestTextV1IngestTextPost method

Future<IngestResponse?> ingestTextV1IngestTextPost(
  1. IngestTextBody ingestTextBody
)

Ingest Text

Ingests and processes a text, storing its chunks to be used as context. The context obtained from files is later used in /chat/completions, /completions, and /chunks APIs. A Document will be generated with the given text. The Document ID is returned in the response, together with the extracted Metadata (which is later used to improve context retrieval). That ID can be used to filter the context used to create responses in /chat/completions, /completions, and /chunks APIs.

Parameters:

Implementation

Future<IngestResponse?> ingestTextV1IngestTextPost(IngestTextBody ingestTextBody,) async {
  final response = await ingestTextV1IngestTextPostWithHttpInfo(ingestTextBody,);
  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), 'IngestResponse',) as IngestResponse;

  }
  return null;
}