ingestFileV1IngestFilePostWithHttpInfo 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.
Note: This method returns the HTTP Response.
Parameters:
MultipartFilefile (required):
Implementation
Future<Response> ingestFileV1IngestFilePostWithHttpInfo(MultipartFile file,) async {
// ignore: prefer_const_declarations
final path = r'/v1/ingest/file';
// ignore: prefer_final_locals
Object? postBody;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const contentTypes = <String>['multipart/form-data'];
bool hasFields = false;
final mp = MultipartRequest('POST', Uri.parse(path));
hasFields = true;
mp.fields[r'file'] = file.field;
mp.files.add(file);
if (hasFields) {
postBody = mp;
}
return apiClient.invokeAPI(
path,
'POST',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}