ingestFileV1IngestFilePost method
Ingest File
Ingests and processes a file, storing its chunks to be used as context. The context obtained from files is later used in /chat/completions, /completions, and /chunks APIs. Most common document formats are supported, but you may be prompted to install an extra dependency to manage a specific file type. A file can generate different Documents (for example a PDF generates one Document per page). All Documents IDs are returned in the response, together with the extracted Metadata (which is later used to improve context retrieval). Those IDs can be used to filter the context used to create responses in /chat/completions, /completions, and /chunks APIs.
Parameters:
MultipartFilefile (required):
Implementation
Future<IngestResponse?> ingestFileV1IngestFilePost(MultipartFile file,) async {
final response = await ingestFileV1IngestFilePostWithHttpInfo(file,);
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;
}