openai 0.19.0 → 0.20.0

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 (38) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -0
  3. data/README.md +1 -1
  4. data/lib/openai/models/chat/chat_completion_message.rb +7 -5
  5. data/lib/openai/models/chat/chat_completion_message_function_tool_call.rb +7 -5
  6. data/lib/openai/models/conversations/item_list_params.rb +2 -0
  7. data/lib/openai/models/evals/run_cancel_response.rb +2 -2
  8. data/lib/openai/models/evals/run_create_params.rb +2 -2
  9. data/lib/openai/models/evals/run_create_response.rb +2 -2
  10. data/lib/openai/models/evals/run_list_response.rb +2 -2
  11. data/lib/openai/models/evals/run_retrieve_response.rb +2 -2
  12. data/lib/openai/models/responses/response.rb +2 -2
  13. data/lib/openai/models/responses/response_create_params.rb +4 -2
  14. data/lib/openai/models/responses/response_function_tool_call.rb +7 -5
  15. data/lib/openai/models/responses/response_function_web_search.rb +35 -1
  16. data/lib/openai/models/responses/response_includable.rb +2 -0
  17. data/lib/openai/models/responses/response_output_text.rb +7 -5
  18. data/lib/openai/models/responses/tool.rb +158 -1
  19. data/lib/openai/resources/conversations.rb +1 -1
  20. data/lib/openai/resources/responses.rb +2 -2
  21. data/lib/openai/version.rb +1 -1
  22. data/rbi/openai/models/conversations/item_list_params.rbi +4 -0
  23. data/rbi/openai/models/evals/run_cancel_response.rbi +2 -0
  24. data/rbi/openai/models/evals/run_create_params.rbi +4 -0
  25. data/rbi/openai/models/evals/run_create_response.rbi +2 -0
  26. data/rbi/openai/models/evals/run_list_response.rbi +2 -0
  27. data/rbi/openai/models/evals/run_retrieve_response.rbi +2 -0
  28. data/rbi/openai/models/responses/response.rbi +1 -0
  29. data/rbi/openai/models/responses/response_create_params.rbi +8 -0
  30. data/rbi/openai/models/responses/response_function_web_search.rbi +78 -2
  31. data/rbi/openai/models/responses/response_includable.rbi +2 -0
  32. data/rbi/openai/models/responses/tool.rbi +347 -0
  33. data/rbi/openai/resources/conversations/items.rbi +2 -0
  34. data/rbi/openai/resources/conversations.rbi +1 -1
  35. data/rbi/openai/resources/responses.rbi +6 -0
  36. data/sig/openai/models/responses/response_function_web_search.rbs +34 -3
  37. data/sig/openai/models/responses/tool.rbs +121 -0
  38. metadata +2 -2
@@ -40,16 +40,47 @@ module OpenAI
40
40
  module Action
41
41
  extend OpenAI::Internal::Type::Union
42
42
 
43
- type search = { query: String, type: :search }
43
+ type search =
44
+ {
45
+ query: String,
46
+ type: :search,
47
+ sources: ::Array[OpenAI::Responses::ResponseFunctionWebSearch::Action::Search::Source]
48
+ }
44
49
 
45
50
  class Search < OpenAI::Internal::Type::BaseModel
46
51
  attr_accessor query: String
47
52
 
48
53
  attr_accessor type: :search
49
54
 
50
- def initialize: (query: String, ?type: :search) -> void
55
+ attr_reader sources: ::Array[OpenAI::Responses::ResponseFunctionWebSearch::Action::Search::Source]?
51
56
 
52
- def to_hash: -> { query: String, type: :search }
57
+ def sources=: (
58
+ ::Array[OpenAI::Responses::ResponseFunctionWebSearch::Action::Search::Source]
59
+ ) -> ::Array[OpenAI::Responses::ResponseFunctionWebSearch::Action::Search::Source]
60
+
61
+ def initialize: (
62
+ query: String,
63
+ ?sources: ::Array[OpenAI::Responses::ResponseFunctionWebSearch::Action::Search::Source],
64
+ ?type: :search
65
+ ) -> void
66
+
67
+ def to_hash: -> {
68
+ query: String,
69
+ type: :search,
70
+ sources: ::Array[OpenAI::Responses::ResponseFunctionWebSearch::Action::Search::Source]
71
+ }
72
+
73
+ type source = { type: :url, url: String }
74
+
75
+ class Source < OpenAI::Internal::Type::BaseModel
76
+ attr_accessor type: :url
77
+
78
+ attr_accessor url: String
79
+
80
+ def initialize: (url: String, ?type: :url) -> void
81
+
82
+ def to_hash: -> { type: :url, url: String }
83
+ end
53
84
  end
54
85
 
55
86
  type open_page = { type: :open_page, url: String }
@@ -10,11 +10,132 @@ module OpenAI
10
10
  | OpenAI::Responses::Tool::ImageGeneration
11
11
  | OpenAI::Responses::Tool::LocalShell
12
12
  | OpenAI::Responses::CustomTool
13
+ | OpenAI::Responses::Tool::WebSearchTool
13
14
  | OpenAI::Responses::WebSearchTool
14
15
 
15
16
  module Tool
16
17
  extend OpenAI::Internal::Type::Union
17
18
 
19
+ type web_search_tool =
20
+ {
21
+ type: OpenAI::Models::Responses::Tool::WebSearchTool::type_,
22
+ filters: OpenAI::Responses::Tool::WebSearchTool::Filters?,
23
+ search_context_size: OpenAI::Models::Responses::Tool::WebSearchTool::search_context_size,
24
+ user_location: OpenAI::Responses::Tool::WebSearchTool::UserLocation?
25
+ }
26
+
27
+ class WebSearchTool < OpenAI::Internal::Type::BaseModel
28
+ attr_accessor type: OpenAI::Models::Responses::Tool::WebSearchTool::type_
29
+
30
+ attr_accessor filters: OpenAI::Responses::Tool::WebSearchTool::Filters?
31
+
32
+ attr_reader search_context_size: OpenAI::Models::Responses::Tool::WebSearchTool::search_context_size?
33
+
34
+ def search_context_size=: (
35
+ OpenAI::Models::Responses::Tool::WebSearchTool::search_context_size
36
+ ) -> OpenAI::Models::Responses::Tool::WebSearchTool::search_context_size
37
+
38
+ attr_accessor user_location: OpenAI::Responses::Tool::WebSearchTool::UserLocation?
39
+
40
+ def initialize: (
41
+ type: OpenAI::Models::Responses::Tool::WebSearchTool::type_,
42
+ ?filters: OpenAI::Responses::Tool::WebSearchTool::Filters?,
43
+ ?search_context_size: OpenAI::Models::Responses::Tool::WebSearchTool::search_context_size,
44
+ ?user_location: OpenAI::Responses::Tool::WebSearchTool::UserLocation?
45
+ ) -> void
46
+
47
+ def to_hash: -> {
48
+ type: OpenAI::Models::Responses::Tool::WebSearchTool::type_,
49
+ filters: OpenAI::Responses::Tool::WebSearchTool::Filters?,
50
+ search_context_size: OpenAI::Models::Responses::Tool::WebSearchTool::search_context_size,
51
+ user_location: OpenAI::Responses::Tool::WebSearchTool::UserLocation?
52
+ }
53
+
54
+ type type_ = :web_search | :web_search_2025_08_26
55
+
56
+ module Type
57
+ extend OpenAI::Internal::Type::Enum
58
+
59
+ WEB_SEARCH: :web_search
60
+ WEB_SEARCH_2025_08_26: :web_search_2025_08_26
61
+
62
+ def self?.values: -> ::Array[OpenAI::Models::Responses::Tool::WebSearchTool::type_]
63
+ end
64
+
65
+ type filters = { allowed_domains: ::Array[String]? }
66
+
67
+ class Filters < OpenAI::Internal::Type::BaseModel
68
+ attr_accessor allowed_domains: ::Array[String]?
69
+
70
+ def initialize: (?allowed_domains: ::Array[String]?) -> void
71
+
72
+ def to_hash: -> { allowed_domains: ::Array[String]? }
73
+ end
74
+
75
+ type search_context_size = :low | :medium | :high
76
+
77
+ module SearchContextSize
78
+ extend OpenAI::Internal::Type::Enum
79
+
80
+ LOW: :low
81
+ MEDIUM: :medium
82
+ HIGH: :high
83
+
84
+ def self?.values: -> ::Array[OpenAI::Models::Responses::Tool::WebSearchTool::search_context_size]
85
+ end
86
+
87
+ type user_location =
88
+ {
89
+ city: String?,
90
+ country: String?,
91
+ region: String?,
92
+ timezone: String?,
93
+ type: OpenAI::Models::Responses::Tool::WebSearchTool::UserLocation::type_
94
+ }
95
+
96
+ class UserLocation < OpenAI::Internal::Type::BaseModel
97
+ attr_accessor city: String?
98
+
99
+ attr_accessor country: String?
100
+
101
+ attr_accessor region: String?
102
+
103
+ attr_accessor timezone: String?
104
+
105
+ attr_reader type: OpenAI::Models::Responses::Tool::WebSearchTool::UserLocation::type_?
106
+
107
+ def type=: (
108
+ OpenAI::Models::Responses::Tool::WebSearchTool::UserLocation::type_
109
+ ) -> OpenAI::Models::Responses::Tool::WebSearchTool::UserLocation::type_
110
+
111
+ def initialize: (
112
+ ?city: String?,
113
+ ?country: String?,
114
+ ?region: String?,
115
+ ?timezone: String?,
116
+ ?type: OpenAI::Models::Responses::Tool::WebSearchTool::UserLocation::type_
117
+ ) -> void
118
+
119
+ def to_hash: -> {
120
+ city: String?,
121
+ country: String?,
122
+ region: String?,
123
+ timezone: String?,
124
+ type: OpenAI::Models::Responses::Tool::WebSearchTool::UserLocation::type_
125
+ }
126
+
127
+ type type_ = :approximate
128
+
129
+ module Type
130
+ extend OpenAI::Internal::Type::Enum
131
+
132
+ APPROXIMATE: :approximate
133
+
134
+ def self?.values: -> ::Array[OpenAI::Models::Responses::Tool::WebSearchTool::UserLocation::type_]
135
+ end
136
+ end
137
+ end
138
+
18
139
  type mcp =
19
140
  {
20
141
  server_label: String,
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.19.0
4
+ version: 0.20.0
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-21 00:00:00.000000000 Z
11
+ date: 2025-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool