openai 0.17.0 → 0.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +39 -0
  3. data/README.md +1 -1
  4. data/lib/openai/helpers/structured_output/array_of.rb +2 -10
  5. data/lib/openai/helpers/structured_output/base_model.rb +4 -11
  6. data/lib/openai/helpers/structured_output/json_schema_converter.rb +19 -3
  7. data/lib/openai/helpers/structured_output/union_of.rb +2 -10
  8. data/lib/openai/internal/type/array_of.rb +1 -0
  9. data/lib/openai/internal/type/base_model.rb +3 -1
  10. data/lib/openai/internal/type/converter.rb +27 -0
  11. data/lib/openai/internal/type/hash_of.rb +1 -0
  12. data/lib/openai/internal/type/union.rb +9 -7
  13. data/lib/openai/models/batch_create_params.rb +38 -1
  14. data/lib/openai/models/beta/thread_create_and_run_params.rb +2 -2
  15. data/lib/openai/models/beta/threads/run.rb +2 -2
  16. data/lib/openai/models/beta/threads/run_create_params.rb +2 -2
  17. data/lib/openai/models/chat/chat_completion.rb +6 -6
  18. data/lib/openai/models/chat/chat_completion_chunk.rb +6 -6
  19. data/lib/openai/models/chat/completion_create_params.rb +7 -7
  20. data/lib/openai/models/file_create_params.rb +37 -1
  21. data/lib/openai/models/graders/text_similarity_grader.rb +6 -5
  22. data/lib/openai/models/reasoning.rb +1 -1
  23. data/lib/openai/models/responses/response.rb +6 -8
  24. data/lib/openai/models/responses/response_create_params.rb +6 -8
  25. data/lib/openai/models/upload_create_params.rb +37 -1
  26. data/lib/openai/resources/batches.rb +3 -1
  27. data/lib/openai/resources/files.rb +4 -2
  28. data/lib/openai/resources/responses.rb +2 -2
  29. data/lib/openai/resources/uploads.rb +3 -1
  30. data/lib/openai/version.rb +1 -1
  31. data/rbi/openai/helpers/structured_output/array_of.rbi +0 -3
  32. data/rbi/openai/helpers/structured_output/json_schema_converter.rbi +10 -0
  33. data/rbi/openai/internal/type/converter.rbi +46 -0
  34. data/rbi/openai/internal/type/union.rbi +7 -2
  35. data/rbi/openai/models/batch_create_params.rbi +60 -0
  36. data/rbi/openai/models/beta/thread_create_and_run_params.rbi +3 -3
  37. data/rbi/openai/models/beta/threads/run.rbi +3 -3
  38. data/rbi/openai/models/beta/threads/run_create_params.rbi +3 -3
  39. data/rbi/openai/models/chat/chat_completion.rbi +6 -9
  40. data/rbi/openai/models/chat/chat_completion_chunk.rbi +6 -9
  41. data/rbi/openai/models/chat/completion_create_params.rbi +8 -11
  42. data/rbi/openai/models/file_create_params.rbi +56 -0
  43. data/rbi/openai/models/graders/text_similarity_grader.rbi +11 -6
  44. data/rbi/openai/models/reasoning.rbi +1 -1
  45. data/rbi/openai/models/responses/response.rbi +8 -11
  46. data/rbi/openai/models/responses/response_create_params.rbi +8 -11
  47. data/rbi/openai/models/upload_create_params.rbi +56 -0
  48. data/rbi/openai/resources/batches.rbi +5 -0
  49. data/rbi/openai/resources/beta/threads/runs.rbi +2 -2
  50. data/rbi/openai/resources/beta/threads.rbi +2 -2
  51. data/rbi/openai/resources/chat/completions.rbi +6 -8
  52. data/rbi/openai/resources/files.rbi +5 -1
  53. data/rbi/openai/resources/responses.rbi +6 -8
  54. data/rbi/openai/resources/uploads.rbi +4 -0
  55. data/sig/openai/internal/type/converter.rbs +17 -0
  56. data/sig/openai/internal/type/union.rbs +2 -2
  57. data/sig/openai/models/batch_create_params.rbs +22 -1
  58. data/sig/openai/models/file_create_params.rbs +22 -1
  59. data/sig/openai/models/graders/text_similarity_grader.rbs +3 -1
  60. data/sig/openai/models/upload_create_params.rbs +22 -1
  61. data/sig/openai/resources/batches.rbs +1 -0
  62. data/sig/openai/resources/files.rbs +1 -0
  63. data/sig/openai/resources/uploads.rbs +1 -0
  64. metadata +2 -2
@@ -3,7 +3,8 @@ module OpenAI
3
3
  type file_create_params =
4
4
  {
5
5
  file: OpenAI::Internal::file_input,
6
- purpose: OpenAI::Models::file_purpose
6
+ purpose: OpenAI::Models::file_purpose,
7
+ expires_after: OpenAI::FileCreateParams::ExpiresAfter
7
8
  }
8
9
  & OpenAI::Internal::Type::request_parameters
9
10
 
@@ -15,17 +16,37 @@ module OpenAI
15
16
 
16
17
  attr_accessor purpose: OpenAI::Models::file_purpose
17
18
 
19
+ attr_reader expires_after: OpenAI::FileCreateParams::ExpiresAfter?
20
+
21
+ def expires_after=: (
22
+ OpenAI::FileCreateParams::ExpiresAfter
23
+ ) -> OpenAI::FileCreateParams::ExpiresAfter
24
+
18
25
  def initialize: (
19
26
  file: OpenAI::Internal::file_input,
20
27
  purpose: OpenAI::Models::file_purpose,
28
+ ?expires_after: OpenAI::FileCreateParams::ExpiresAfter,
21
29
  ?request_options: OpenAI::request_opts
22
30
  ) -> void
23
31
 
24
32
  def to_hash: -> {
25
33
  file: OpenAI::Internal::file_input,
26
34
  purpose: OpenAI::Models::file_purpose,
35
+ expires_after: OpenAI::FileCreateParams::ExpiresAfter,
27
36
  request_options: OpenAI::RequestOptions
28
37
  }
38
+
39
+ type expires_after = { anchor: :created_at, seconds: Integer }
40
+
41
+ class ExpiresAfter < OpenAI::Internal::Type::BaseModel
42
+ attr_accessor anchor: :created_at
43
+
44
+ attr_accessor seconds: Integer
45
+
46
+ def initialize: (seconds: Integer, ?anchor: :created_at) -> void
47
+
48
+ def to_hash: -> { anchor: :created_at, seconds: Integer }
49
+ end
29
50
  end
30
51
  end
31
52
  end
@@ -40,7 +40,8 @@ module OpenAI
40
40
  }
41
41
 
42
42
  type evaluation_metric =
43
- :fuzzy_match
43
+ :cosine
44
+ | :fuzzy_match
44
45
  | :bleu
45
46
  | :gleu
46
47
  | :meteor
@@ -54,6 +55,7 @@ module OpenAI
54
55
  module EvaluationMetric
55
56
  extend OpenAI::Internal::Type::Enum
56
57
 
58
+ COSINE: :cosine
57
59
  FUZZY_MATCH: :fuzzy_match
58
60
  BLEU: :bleu
59
61
  GLEU: :gleu
@@ -5,7 +5,8 @@ module OpenAI
5
5
  bytes: Integer,
6
6
  filename: String,
7
7
  mime_type: String,
8
- purpose: OpenAI::Models::file_purpose
8
+ purpose: OpenAI::Models::file_purpose,
9
+ expires_after: OpenAI::UploadCreateParams::ExpiresAfter
9
10
  }
10
11
  & OpenAI::Internal::Type::request_parameters
11
12
 
@@ -21,11 +22,18 @@ module OpenAI
21
22
 
22
23
  attr_accessor purpose: OpenAI::Models::file_purpose
23
24
 
25
+ attr_reader expires_after: OpenAI::UploadCreateParams::ExpiresAfter?
26
+
27
+ def expires_after=: (
28
+ OpenAI::UploadCreateParams::ExpiresAfter
29
+ ) -> OpenAI::UploadCreateParams::ExpiresAfter
30
+
24
31
  def initialize: (
25
32
  bytes: Integer,
26
33
  filename: String,
27
34
  mime_type: String,
28
35
  purpose: OpenAI::Models::file_purpose,
36
+ ?expires_after: OpenAI::UploadCreateParams::ExpiresAfter,
29
37
  ?request_options: OpenAI::request_opts
30
38
  ) -> void
31
39
 
@@ -34,8 +42,21 @@ module OpenAI
34
42
  filename: String,
35
43
  mime_type: String,
36
44
  purpose: OpenAI::Models::file_purpose,
45
+ expires_after: OpenAI::UploadCreateParams::ExpiresAfter,
37
46
  request_options: OpenAI::RequestOptions
38
47
  }
48
+
49
+ type expires_after = { anchor: :created_at, seconds: Integer }
50
+
51
+ class ExpiresAfter < OpenAI::Internal::Type::BaseModel
52
+ attr_accessor anchor: :created_at
53
+
54
+ attr_accessor seconds: Integer
55
+
56
+ def initialize: (seconds: Integer, ?anchor: :created_at) -> void
57
+
58
+ def to_hash: -> { anchor: :created_at, seconds: Integer }
59
+ end
39
60
  end
40
61
  end
41
62
  end
@@ -6,6 +6,7 @@ module OpenAI
6
6
  endpoint: OpenAI::Models::BatchCreateParams::endpoint,
7
7
  input_file_id: String,
8
8
  ?metadata: OpenAI::Models::metadata?,
9
+ ?output_expires_after: OpenAI::BatchCreateParams::OutputExpiresAfter,
9
10
  ?request_options: OpenAI::request_opts
10
11
  ) -> OpenAI::Batch
11
12
 
@@ -4,6 +4,7 @@ module OpenAI
4
4
  def create: (
5
5
  file: OpenAI::Internal::file_input,
6
6
  purpose: OpenAI::Models::file_purpose,
7
+ ?expires_after: OpenAI::FileCreateParams::ExpiresAfter,
7
8
  ?request_options: OpenAI::request_opts
8
9
  ) -> OpenAI::FileObject
9
10
 
@@ -8,6 +8,7 @@ module OpenAI
8
8
  filename: String,
9
9
  mime_type: String,
10
10
  purpose: OpenAI::Models::file_purpose,
11
+ ?expires_after: OpenAI::UploadCreateParams::ExpiresAfter,
11
12
  ?request_options: OpenAI::request_opts
12
13
  ) -> OpenAI::Upload
13
14
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.0
4
+ version: 0.18.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenAI
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-08-08 00:00:00.000000000 Z
11
+ date: 2025-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool