ruby/resources/files/methods/retrieve/index.md +0 −105 deleted
File Deleted View Diff
1## Retrieve file
2
3`files.retrieve(file_id) -> FileObject`
4
5**get** `/files/{file_id}`
6
7Returns information about a specific file.
8
9### Parameters
10
11- `file_id: String`
12
13### Returns
14
15- `class FileObject`
16
17 The `File` object represents a document that has been uploaded to OpenAI.
18
19 - `id: String`
20
21 The file identifier, which can be referenced in the API endpoints.
22
23 - `bytes: Integer`
24
25 The size of the file, in bytes.
26
27 - `created_at: Integer`
28
29 The Unix timestamp (in seconds) for when the file was created.
30
31 - `filename: String`
32
33 The name of the file.
34
35 - `object: :file`
36
37 The object type, which is always `file`.
38
39 - `:file`
40
41 - `purpose: :assistants | :assistants_output | :batch | 5 more`
42
43 The intended purpose of the file. Supported values are `assistants`, `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`, `vision`, and `user_data`.
44
45 - `:assistants`
46
47 - `:assistants_output`
48
49 - `:batch`
50
51 - `:batch_output`
52
53 - `:"fine-tune"`
54
55 - `:"fine-tune-results"`
56
57 - `:vision`
58
59 - `:user_data`
60
61 - `status: :uploaded | :processed | :error`
62
63 Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`.
64
65 - `:uploaded`
66
67 - `:processed`
68
69 - `:error`
70
71 - `expires_at: Integer`
72
73 The Unix timestamp (in seconds) for when the file will expire.
74
75 - `status_details: String`
76
77 Deprecated. For details on why a fine-tuning training file failed validation, see the `error` field on `fine_tuning.job`.
78
79### Example
80
81```ruby
82require "openai"
83
84openai = OpenAI::Client.new(api_key: "My API Key")
85
86file_object = openai.files.retrieve("file_id")
87
88puts(file_object)
89```
90
91#### Response
92
93```json
94{
95 "id": "id",
96 "bytes": 0,
97 "created_at": 0,
98 "filename": "filename",
99 "object": "file",
100 "purpose": "assistants",
101 "status": "uploaded",
102 "expires_at": 0,
103 "status_details": "status_details"
104}
105```