Package io.github.sashirestela.openai
Interface OpenAI.Files
-
- Enclosing interface:
- OpenAI
@Resource("/v1/files") public static interface OpenAI.Files
Files are used to upload documents that can be used with features like fine-tuning.- See Also:
- OpenAI Files
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description CompletableFuture<FileResponse>
create(FileRequest fileRequest)
Upload a file that contains document(s) to be used across various endpoints/features.CompletableFuture<DeletedObject>
delete(String fileId)
Delete a file.CompletableFuture<String>
getContent(String fileId)
Returns a file content.CompletableFuture<InputStream>
getContentInputStream(String fileId)
Returns a file content as a stream.default CompletableFuture<List<FileResponse>>
getList(FileRequest.PurposeType purpose)
Returns a list of files that belong to the user's organization.CompletableFuture<Generic<FileResponse>>
getListPrimitive(FileRequest.PurposeType purpose)
Returns a Generic of files that belong to the user's organization (don't call it directly).CompletableFuture<FileResponse>
getOne(String fileId)
Returns information about a specific file.
-
-
-
Method Detail
-
create
@Multipart @POST CompletableFuture<FileResponse> create(@Body FileRequest fileRequest)
Upload a file that contains document(s) to be used across various endpoints/features. Currently *.jsonl files are supported only.- Parameters:
fileRequest
- Includes the file to be uploaded.- Returns:
- Represents a document that has been uploaded.
-
getListPrimitive
@GET CompletableFuture<Generic<FileResponse>> getListPrimitive(@Query("purpose") FileRequest.PurposeType purpose)
Returns a Generic of files that belong to the user's organization (don't call it directly).- Parameters:
purpose
- Only return files with the given purpose.- Returns:
- Generic object of files.
-
getList
default CompletableFuture<List<FileResponse>> getList(FileRequest.PurposeType purpose)
Returns a list of files that belong to the user's organization.- Parameters:
purpose
- Only return files with the given purpose.- Returns:
- List of files.
-
getOne
@GET("/{fileId}") CompletableFuture<FileResponse> getOne(@Path("fileId") String fileId)
Returns information about a specific file.- Parameters:
fileId
- The id of the file to use for this request.- Returns:
- Specific file.
-
getContent
@GET("/{fileId}/content") CompletableFuture<String> getContent(@Path("fileId") String fileId)
Returns a file content.- Parameters:
fileId
- The id of the file to use for this request.- Returns:
- Content of specific file.
-
getContentInputStream
@GET("/{fileId}/content") CompletableFuture<InputStream> getContentInputStream(@Path("fileId") String fileId)
Returns a file content as a stream.- Parameters:
fileId
- The id of the file to use for this request.- Returns:
- Content of specific file.
-
delete
@DELETE("/{fileId}") CompletableFuture<DeletedObject> delete(@Path("fileId") String fileId)
Delete a file.- Parameters:
fileId
- The id of the file to use for this request.- Returns:
- Deletion status.
-
-