java/resources/files/methods/retrieve/index.md +0 −116 deleted
File Deleted View Diff
1## Retrieve file
2
3`FileObject files().retrieve(FileRetrieveParamsparams = FileRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())`
4
5**get** `/files/{file_id}`
6
7Returns information about a specific file.
8
9### Parameters
10
11- `FileRetrieveParams params`
12
13 - `Optional<String> fileId`
14
15### Returns
16
17- `class FileObject:`
18
19 The `File` object represents a document that has been uploaded to OpenAI.
20
21 - `String id`
22
23 The file identifier, which can be referenced in the API endpoints.
24
25 - `long bytes`
26
27 The size of the file, in bytes.
28
29 - `long createdAt`
30
31 The Unix timestamp (in seconds) for when the file was created.
32
33 - `String filename`
34
35 The name of the file.
36
37 - `JsonValue; object_ "file"constant`
38
39 The object type, which is always `file`.
40
41 - `FILE("file")`
42
43 - `Purpose purpose`
44
45 The intended purpose of the file. Supported values are `assistants`, `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`, `vision`, and `user_data`.
46
47 - `ASSISTANTS("assistants")`
48
49 - `ASSISTANTS_OUTPUT("assistants_output")`
50
51 - `BATCH("batch")`
52
53 - `BATCH_OUTPUT("batch_output")`
54
55 - `FINE_TUNE("fine-tune")`
56
57 - `FINE_TUNE_RESULTS("fine-tune-results")`
58
59 - `VISION("vision")`
60
61 - `USER_DATA("user_data")`
62
63 - `Status status`
64
65 Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`.
66
67 - `UPLOADED("uploaded")`
68
69 - `PROCESSED("processed")`
70
71 - `ERROR("error")`
72
73 - `Optional<Long> expiresAt`
74
75 The Unix timestamp (in seconds) for when the file will expire.
76
77 - `Optional<String> statusDetails`
78
79 Deprecated. For details on why a fine-tuning training file failed validation, see the `error` field on `fine_tuning.job`.
80
81### Example
82
83```java
84package com.openai.example;
85
86import com.openai.client.OpenAIClient;
87import com.openai.client.okhttp.OpenAIOkHttpClient;
88import com.openai.models.files.FileObject;
89import com.openai.models.files.FileRetrieveParams;
90
91public final class Main {
92 private Main() {}
93
94 public static void main(String[] args) {
95 OpenAIClient client = OpenAIOkHttpClient.fromEnv();
96
97 FileObject fileObject = client.files().retrieve("file_id");
98 }
99}
100```
101
102#### Response
103
104```json
105{
106 "id": "id",
107 "bytes": 0,
108 "created_at": 0,
109 "filename": "filename",
110 "object": "file",
111 "purpose": "assistants",
112 "status": "uploaded",
113 "expires_at": 0,
114 "status_details": "status_details"
115}
116```