omniai-openai 2.6.5 → 3.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4c5c440743bc36c6ce9b0485ef1aab69627397d77ae7a729877fa15de14610f3
4
- data.tar.gz: 7fb943d6ad6ad7a03cad46da3f276e4e816e1d66e96fe05584bd0ec586228d39
3
+ metadata.gz: cf857f3e19a92c38074533033d27f0c72c38b8b241821964c6a5afdd43c9c0ea
4
+ data.tar.gz: 99bf66f3fa309e921eb585ad4462090456d5eec6f55886695fd5214a78825ec6
5
5
  SHA512:
6
- metadata.gz: '09a5264c64c11436a65a158624942030300d0520671716ff9ac32f2a5c5f4903481ef07f277d046c13e89694eb61cc229063bcffcfafd8db2e6a051417840b3b'
7
- data.tar.gz: 688b733315e69029a24493c02d44e039445e22c056856f9c3e3748418ecb5b0f98ab86ebb7ad14a6c7ae2095950a6b8d6377e9ccacf7a6d64e28d8675d8fb9f2
6
+ metadata.gz: e5661128cc6388ae20b5eebdcac7eb31d7760fac041cd153ba8ceefa5f9c7461b9834f2c425d712ff15f87ce5f20ad83cf07187be99d7d22a999e56a49081eb4
7
+ data.tar.gz: 9d3a37d7108178cb19dfe8573888eee036c4e635759f0c7b3ed6932d84dad16b1ce19cfbd3db36947587bf5e82d3d51ba6ec36736b97a120966ee451d8930d1a
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OmniAI
4
+ module OpenAI
5
+ class Chat
6
+ # Overrides choice serialize / deserialize.
7
+ module ChoiceSerializer
8
+ # @param choice [OmniAI::Chat::Choice]
9
+ # @param context [Context]
10
+ #
11
+ # @return [Hash]
12
+ def self.serialize(choice, context:)
13
+ choice.message.serialize(context:)
14
+ end
15
+
16
+ # @param data [Hash]
17
+ # @param context [Context]
18
+ #
19
+ # @return [OmniAI::Chat::Choice]
20
+ def self.deserialize(data, context:)
21
+ message = OmniAI::Chat::Message.deserialize(data, context:)
22
+ OmniAI::Chat::Choice.new(message:)
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OmniAI
4
+ module OpenAI
5
+ class Chat
6
+ # Overrides content serialize / deserialize.
7
+ module ContentSerializer
8
+ # @param data [Hash]
9
+ # @param context [Context]
10
+ #
11
+ # @return [OmniAI::Chat::Text, OmniAI::Chat::ToolCall]
12
+ def self.deserialize(data, context:)
13
+ case data["type"]
14
+ when /(input|output)_text/ then OmniAI::Chat::Text.deserialize(data, context:)
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OmniAI
4
+ module OpenAI
5
+ class Chat
6
+ # Overrides file serialize / deserialize.
7
+ module FileSerializer
8
+ # @param file [OmniAI::Chat::File]
9
+ # @param direction [String] "input" or "output"
10
+ #
11
+ # @return [Hash]
12
+ def self.serialize(file, direction:, **)
13
+ type = file.image? ? "image" : "file"
14
+
15
+ {
16
+ type: "#{direction}_#{type}",
17
+ "#{type}_data": file.data,
18
+ filename: file.filename,
19
+ }
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,93 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OmniAI
4
+ module OpenAI
5
+ class Chat
6
+ # Overrides message serialize / deserialize.
7
+ module MessageSerializer
8
+ # @param message [OmniAI::Chat::Message]
9
+ # @param context [OmniAI::Context]
10
+ #
11
+ # @return [Hash]
12
+ def self.serialize(message, context:)
13
+ if message.tool?
14
+ serialize_for_tool_call(message, context:)
15
+ else
16
+ serialize_for_content(message, context:)
17
+ end
18
+ end
19
+
20
+ # @param message [OmniAI::Chat::Message]
21
+ # @param context [OmniAI::Context]
22
+ #
23
+ # @return [Hash]
24
+ def self.serialize_for_tool_call(message, context:)
25
+ tool_call_list = message.tool_call_list
26
+ tool_call = tool_call_list[0]
27
+ tool_call.serialize(context:)
28
+ end
29
+
30
+ # @param message [OmniAI::Chat::Message]
31
+ # @param context [OmniAI::Context]
32
+ #
33
+ # @return [Hash]
34
+ def self.serialize_for_content(message, context:)
35
+ role = message.role
36
+ direction = message.direction
37
+ parts = arrayify(message.content)
38
+
39
+ content = parts.map do |part|
40
+ case part
41
+ when String then { type: "#{direction}_text", text: part }
42
+ else part.serialize(context:, direction:)
43
+ end
44
+ end
45
+
46
+ { role:, content: }
47
+ end
48
+
49
+ # @param data [Hash]
50
+ # @param context [OmniAI::Context]
51
+ #
52
+ # @return [OmniAI::Chat::Message]
53
+ def self.deserialize(data, context:)
54
+ case data["type"]
55
+ when "message" then deserialize_for_content(data, context:)
56
+ when "function_call" then deserialize_for_tool_call(data, context:)
57
+ end
58
+ end
59
+
60
+ # @param data [Hash]
61
+ # @param context [OmniAI::Context]
62
+ #
63
+ # @return [OmniAI::Chat::Message]
64
+ def self.deserialize_for_content(data, context:)
65
+ role = data["role"]
66
+ content = data["content"].map do |content|
67
+ OmniAI::Chat::Content.deserialize(content, context:)
68
+ end
69
+ OmniAI::Chat::Message.new(role:, content:)
70
+ end
71
+
72
+ # @param data [Hash]
73
+ # @param context [OmniAI::Context]
74
+ #
75
+ # @return [OmniAI::Chat::Message]
76
+ def self.deserialize_for_tool_call(data, context:)
77
+ entry = OmniAI::Chat::ToolCall.deserialize(data, context:)
78
+ tool_call_list = OmniAI::Chat::ToolCallList.new(entries: [entry])
79
+ OmniAI::Chat::Message.new(role: OmniAI::Chat::Role::TOOL, content: nil, tool_call_list:)
80
+ end
81
+
82
+ # @param content [Object]
83
+ #
84
+ # @return [Array<Object>]
85
+ def self.arrayify(content)
86
+ return [] if content.nil?
87
+
88
+ content.is_a?(Array) ? content : [content]
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OmniAI
4
+ module OpenAI
5
+ class Chat
6
+ # Overrides response serialize / deserialize.
7
+ module ResponseSerializer
8
+ # @param response [OmniAI::Chat::Response]
9
+ # @param context [OmniAI::Context]
10
+ #
11
+ # @return [Hash]
12
+ def self.serialize(response, context:)
13
+ usage = response.usage.serialize(context:)
14
+ output = response.choices.serialize(context:)
15
+
16
+ {
17
+ usage:,
18
+ output:,
19
+ }
20
+ end
21
+
22
+ # @param data [Hash]
23
+ # @param context [OmniAI::Context]
24
+ #
25
+ # @return [OmniAI::Chat::Response]
26
+ def self.deserialize(data, context:)
27
+ usage = OmniAI::Chat::Usage.deserialize(data["usage"], context:) if data["usage"]
28
+ choices = data["output"].map { |choice_data| OmniAI::Chat::Choice.deserialize(choice_data, context:) }
29
+
30
+ OmniAI::Chat::Response.new(data:, choices:, usage:)
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OmniAI
4
+ module OpenAI
5
+ class Chat
6
+ # For each chunk yield the text delta. Parse the final content into a response.
7
+ class Stream < OmniAI::Chat::Stream
8
+ # @yield [delta]
9
+ # @yieldparam delta [OmniAI::Chat::Delta]
10
+ #
11
+ # @return [Hash]
12
+ def stream!(&block)
13
+ response = {}
14
+
15
+ @chunks.each do |chunk|
16
+ parser.feed(chunk) do |type, data, _id|
17
+ case type
18
+ when /response\.(.*)_text\.delta/
19
+ block.call(OmniAI::Chat::Delta.new(text: JSON.parse(data)["delta"]))
20
+ when "response.completed"
21
+ response = JSON.parse(data)["response"]
22
+ end
23
+ end
24
+ end
25
+
26
+ response
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OmniAI
4
+ module OpenAI
5
+ class Chat
6
+ # Overrides text serialize / deserialize.
7
+ module TextSerializer
8
+ # @param text [OmniAI::Chat::Text]
9
+ # @param direction [String] "input" or "output"
10
+ #
11
+ # @return [Hash]
12
+ def self.serialize(text, direction:, **)
13
+ raise text.inspect if direction.nil?
14
+
15
+ { type: "#{direction}_text", text: text.text }
16
+ end
17
+
18
+ # @param data [Hash]
19
+ #
20
+ # @return [OmniAI::Chat::Text]
21
+ def self.deserialize(data, *)
22
+ OmniAI::Chat::Text.new(data["text"])
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OmniAI
4
+ module OpenAI
5
+ class Chat
6
+ # Overrides tool-call message serialize / deserialize.
7
+ module ToolCallMessageSerializer
8
+ # @param message [OmniAI::Chat::ToolCallMessage]
9
+ #
10
+ # @return [Hash]
11
+ def self.serialize(message, *)
12
+ {
13
+ type: "function_call_output",
14
+ call_id: message.tool_call_id,
15
+ output: JSON.generate(message.content),
16
+ }
17
+ end
18
+
19
+ # @param data [Hash]
20
+ #
21
+ # @return [OmniAI::Chat::ToolCallMessage]
22
+ def self.deserialize(data, *)
23
+ content = data["content"]
24
+ tool_call_id = data["call_id"]
25
+ OmniAI::Chat::ToolCallMessage.new(content:, tool_call_id:)
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OmniAI
4
+ module OpenAI
5
+ class Chat
6
+ # Overrides tool-call response serialize / deserialize.
7
+ module ToolCallResultSerializer
8
+ # @param tool_call_result [OmniAI::Chat::ToolCallResult]
9
+ #
10
+ # @return [Hash]
11
+ def self.serialize(tool_call_result, *)
12
+ {
13
+ type: "function_call_output",
14
+ call_id: tool_call_result.tool_call_id,
15
+ output: tool_call_result.text,
16
+ }
17
+ end
18
+
19
+ # @param data [Hash]
20
+ #
21
+ # @return [OmniAI::Chat::ToolCallResult]
22
+ def self.deserialize(data, *)
23
+ tool_call_id = data["call_id"]
24
+ content = data["output"]
25
+
26
+ OmniAI::Chat::ToolCallResult.new(content:, tool_call_id:)
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OmniAI
4
+ module OpenAI
5
+ class Chat
6
+ # Overrides tool-call serialize / deserialize.
7
+ module ToolCallSerializer
8
+ # @param tool_call [OmniAI::Chat::ToolCall]
9
+ # @param context [OmniAI::Context]
10
+ #
11
+ # @return [Hash]
12
+ def self.serialize(tool_call, context:)
13
+ function = tool_call.function.serialize(context:)
14
+
15
+ {
16
+ call_id: tool_call.id,
17
+ type: "function_call",
18
+ }.merge(function)
19
+ end
20
+
21
+ # @param data [Hash]
22
+ # @param context [OmniAI::Context]
23
+ #
24
+ # @return [OmniAI::Chat::ToolCall]
25
+ def self.deserialize(data, context:)
26
+ function = OmniAI::Chat::Function.deserialize(data, context:)
27
+ OmniAI::Chat::ToolCall.new(id: data["id"], function:)
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OmniAI
4
+ module OpenAI
5
+ class Chat
6
+ # Overrides text serialize / deserialize.
7
+ module ToolSerializer
8
+ # @param tool [OmniAI::Tool]
9
+ # @return [Hash]
10
+ def self.serialize(tool, *)
11
+ {
12
+ type: "function",
13
+ name: tool.name,
14
+ description: tool.description,
15
+ parameters: tool.parameters.is_a?(Schema::Object) ? tool.parameters.serialize : tool.parameters,
16
+ strict: true,
17
+ }
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OmniAI
4
+ module OpenAI
5
+ class Chat
6
+ # Overrides media serialize / deserialize.
7
+ module URLSerializer
8
+ # @param url [OmniAI::Chat::URL]
9
+ # @param direction [String] "input" or "output"
10
+ #
11
+ # @return [Hash]
12
+ def self.serialize(url, direction:, **)
13
+ type = url.image? ? "image" : "file"
14
+
15
+ {
16
+ type: "#{direction}_#{type}",
17
+ "#{type}_url": url.uri,
18
+ }
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -12,8 +12,6 @@ module OmniAI
12
12
  # end
13
13
  # completion.choice.message.content # '...'
14
14
  class Chat < OmniAI::Chat
15
- DEFAULT_STREAM_OPTIONS = { include_usage: ENV.fetch("OMNIAI_STREAM_USAGE", "on").eql?("on") }.freeze
16
-
17
15
  module ResponseFormat
18
16
  TEXT_TYPE = "text"
19
17
  JSON_TYPE = "json_object"
@@ -34,6 +32,7 @@ module OmniAI
34
32
  end
35
33
 
36
34
  module Model
35
+ GPT_5_2 = "gpt-5.2"
37
36
  GPT_5_1 = "gpt-5.1"
38
37
  GPT_5 = "gpt-5"
39
38
  GPT_5_MINI = "gpt-5-mini"
@@ -53,23 +52,72 @@ module OmniAI
53
52
  O3 = "o3"
54
53
  end
55
54
 
56
- DEFAULT_MODEL = Model::GPT_4_1
55
+ DEFAULT_MODEL = Model::GPT_5_2
56
+
57
+ # @return [Context]
58
+ CONTEXT = Context.build do |context|
59
+ context.serializers[:choice] = ChoiceSerializer.method(:serialize)
60
+ context.deserializers[:choice] = ChoiceSerializer.method(:deserialize)
61
+ context.serializers[:message] = MessageSerializer.method(:serialize)
62
+ context.deserializers[:message] = MessageSerializer.method(:deserialize)
63
+ context.serializers[:text] = TextSerializer.method(:serialize)
64
+ context.deserializers[:text] = TextSerializer.method(:deserialize)
65
+ context.serializers[:response] = ResponseSerializer.method(:serialize)
66
+ context.deserializers[:response] = ResponseSerializer.method(:deserialize)
67
+ context.deserializers[:content] = ContentSerializer.method(:deserialize)
68
+ context.serializers[:file] = FileSerializer.method(:serialize)
69
+ context.serializers[:url] = URLSerializer.method(:serialize)
70
+ context.serializers[:tool] = ToolSerializer.method(:serialize)
71
+ context.serializers[:tool_call] = ToolCallSerializer.method(:serialize)
72
+ context.deserializers[:tool_call] = ToolCallSerializer.method(:deserialize)
73
+ context.serializers[:tool_call_result] = ToolCallResultSerializer.method(:serialize)
74
+ context.deserializers[:tool_call_result] = ToolCallResultSerializer.method(:deserialize)
75
+ context.serializers[:tool_call_message] = ToolCallMessageSerializer.method(:serialize)
76
+ context.deserializers[:tool_call_message] = ToolCallMessageSerializer.method(:deserialize)
77
+ end
57
78
 
58
79
  protected
59
80
 
81
+ # @return [Context]
82
+ def context
83
+ CONTEXT
84
+ end
85
+
86
+ # @return [Array<Hash>]
87
+ def input
88
+ @prompt
89
+ .messages
90
+ .reject(&:system?)
91
+ .map { |message| message.serialize(context:) }
92
+ end
93
+
94
+ # @return [String, nil]
95
+ def instructions
96
+ parts = @prompt
97
+ .messages
98
+ .filter(&:system?)
99
+ .filter(&:text?)
100
+ .map(&:text)
101
+
102
+ return if parts.empty?
103
+
104
+ parts.join("\n\n")
105
+ end
106
+
60
107
  # @return [Float, nil]
61
108
  def temperature
62
109
  return if @temperature.nil?
63
110
 
64
- unsupported_models = [
65
- Model::O1_MINI, Model::O3_MINI, Model::O1,
66
- Model::GPT_5_1, Model::GPT_5, Model::GPT_5_MINI, Model::GPT_5_NANO,
67
- ]
68
-
69
- if unsupported_models.any? { |model| model.eql?(@model) }
70
- logger&.warn("unsupported temperature=#{@temperature} for model=#{@model}")
71
- return
72
- end
111
+ return if [
112
+ Model::GPT_5,
113
+ Model::GPT_5_MINI,
114
+ Model::GPT_5_NANO,
115
+ Model::GPT_5_1,
116
+ Model::GPT_5_2,
117
+ Model::O1_MINI,
118
+ Model::O1,
119
+ Model::O3_MINI,
120
+ ].include?(@model)
73
121
 
74
122
  @temperature
75
123
  end
@@ -77,71 +125,61 @@ module OmniAI
77
125
  # @return [Hash]
78
126
  def payload
79
127
  OmniAI::OpenAI.config.chat_options.merge({
80
- messages: @prompt.serialize,
81
- model: @model,
82
- response_format:,
128
+ instructions:,
129
+ input:,
130
+ model: @model || DEFAULT_MODEL,
83
131
  stream: stream? || nil,
84
- stream_options: (DEFAULT_STREAM_OPTIONS if stream?),
85
132
  temperature:,
86
- tools: (@tools.map(&:serialize) if @tools&.any?),
87
- reasoning_effort: reasoning_effort_payload,
88
- verbosity: verbosity_payload,
89
- }.merge(@kwargs || {})).compact
133
+ tools:,
134
+ text:,
135
+ reasoning:,
136
+ }).compact
137
+ end
138
+
139
+ # @return [Array<Hash>]
140
+ def tools
141
+ return unless @tools&.any?
142
+
143
+ @tools.map { |tool| tool.serialize(context:) }
90
144
  end
91
145
 
92
146
  # @return [String]
93
147
  def path
94
- "#{@client.api_prefix}/#{OmniAI::OpenAI::Client::VERSION}/chat/completions"
148
+ "#{@client.api_prefix}/#{OmniAI::OpenAI::Client::VERSION}/responses"
149
+ end
150
+
151
+ # @return [Hash]
152
+ def text
153
+ options = @options.fetch(:text, {}).merge(format:).compact
154
+ options unless options.empty?
155
+ end
156
+
157
+ # @return [Hash]
158
+ def reasoning
159
+ options = @options.fetch(:reasoning, {})
160
+ options unless options.empty?
95
161
  end
96
162
 
97
163
  # @raise [ArgumentError]
98
164
  #
99
165
  # @return [Hash, nil]
100
- def response_format
166
+ def format
101
167
  return if @format.nil?
102
168
 
103
169
  case @format
104
170
  when :text then { type: ResponseFormat::TEXT_TYPE }
105
171
  when :json then { type: ResponseFormat::JSON_TYPE }
106
- when OmniAI::Schema::Format then { type: ResponseFormat::SCHEMA_TYPE, json_schema: @format.serialize }
172
+ when OmniAI::Schema::Format
173
+ @format.serialize.merge({ type: ResponseFormat::SCHEMA_TYPE, strict: true })
107
174
  else raise ArgumentError, "unknown format=#{@format}"
108
175
  end
109
176
  end
110
177
 
111
- # @raise [ArgumentError]
112
- #
113
- # @return [String, nil]
114
- def reasoning_effort_payload
115
- return if @reasoning.nil?
116
-
117
- effort = @reasoning[:effort] || @reasoning["effort"]
118
- return if effort.nil?
119
-
120
- valid_efforts = [ReasoningEffort::NONE, ReasoningEffort::LOW, ReasoningEffort::MEDIUM, ReasoningEffort::HIGH]
121
- unless valid_efforts.include?(effort)
122
- raise ArgumentError,
123
- "reasoning effort must be one of #{valid_efforts.join(', ')}"
124
- end
125
-
126
- effort
127
- end
128
-
129
- # @raise [ArgumentError]
130
- #
131
- # @return [String, nil]
132
- def verbosity_payload
133
- return if @verbosity.nil?
134
-
135
- text = @verbosity[:text] || @verbosity["text"]
136
- return if text.nil?
137
-
138
- valid_text_levels = [VerbosityText::LOW, VerbosityText::MEDIUM, VerbosityText::HIGH]
139
- unless valid_text_levels.include?(text)
140
- raise ArgumentError,
141
- "verbosity text must be one of #{valid_text_levels.join(', ')}"
178
+ # @return [Array<ToolCallMessage>]
179
+ def build_tool_call_messages(tool_call_list)
180
+ tool_call_list.map do |tool_call|
181
+ ToolCallMessage.new(tool_call_id: tool_call.id, content: execute_tool_call(tool_call))
142
182
  end
143
-
144
- text
145
183
  end
146
184
  end
147
185
  end
@@ -71,22 +71,19 @@ module OmniAI
71
71
 
72
72
  # @raise [OmniAI::Error]
73
73
  #
74
- # @param messages [String] optional
75
- # @param model [String] optional
76
- # @param format [Symbol] optional :text or :json
74
+ # @param prompt [String, OmniAI::Chat::Prompt, nil] optional
75
+ # @param model [String, nil] optional
76
+ # @param format [Symbol, OmniAI::Schema::Format, nil] optional (e.g. `:text`, `:json`, `OmniAI::Schema.format(...)`)
77
77
  # @param temperature [Float, nil] optional
78
78
  # @param stream [Proc, nil] optional
79
79
  # @param tools [Array<OmniAI::Tool>, nil] optional
80
- # @param reasoning [Hash, nil] optional reasoning configuration
81
- # @param verbosity [Hash, nil] optional verbosity configuration
82
80
  #
83
81
  # @yield [prompt]
84
82
  # @yieldparam prompt [OmniAI::Chat::Prompt]
85
83
  #
86
84
  # @return [OmniAI::Chat::Completion]
87
- def chat(messages = nil, model: Chat::DEFAULT_MODEL, temperature: nil, format: nil, stream: nil, tools: nil,
88
- reasoning: nil, verbosity: nil, &)
89
- Chat.process!(messages, model:, temperature:, format:, stream:, tools:, reasoning:, verbosity:, client: self, &)
85
+ def chat(prompt = nil, model: Chat::DEFAULT_MODEL, temperature: nil, format: nil, stream: nil, tools: nil, **, &)
86
+ Chat.process!(prompt, model:, temperature:, format:, stream:, tools:, client: self, **, &)
90
87
  end
91
88
 
92
89
  # @raise [OmniAI::Error]
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAI
4
4
  module OpenAI
5
- VERSION = "2.6.5"
5
+ VERSION = "3.0.1"
6
6
  end
7
7
  end
data/lib/omniai/openai.rb CHANGED
@@ -7,6 +7,7 @@ require "zeitwerk"
7
7
  loader = Zeitwerk::Loader.for_gem
8
8
  loader.push_dir(__dir__, namespace: OmniAI)
9
9
  loader.inflector.inflect "openai" => "OpenAI"
10
+ loader.inflector.inflect "url_serializer" => "URLSerializer"
10
11
  loader.setup
11
12
 
12
13
  module OmniAI
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniai-openai
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.5
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Sylvestre
@@ -29,14 +29,28 @@ dependencies:
29
29
  requirements:
30
30
  - - "~>"
31
31
  - !ruby/object:Gem::Version
32
- version: '2.6'
32
+ version: '3.0'
33
33
  type: :runtime
34
34
  prerelease: false
35
35
  version_requirements: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '2.6'
39
+ version: '3.0'
40
+ - !ruby/object:Gem::Dependency
41
+ name: openssl
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
40
54
  - !ruby/object:Gem::Dependency
41
55
  name: zeitwerk
42
56
  requirement: !ruby/object:Gem::Requirement
@@ -62,6 +76,18 @@ files:
62
76
  - README.md
63
77
  - lib/omniai/openai.rb
64
78
  - lib/omniai/openai/chat.rb
79
+ - lib/omniai/openai/chat/choice_serializer.rb
80
+ - lib/omniai/openai/chat/content_serializer.rb
81
+ - lib/omniai/openai/chat/file_serializer.rb
82
+ - lib/omniai/openai/chat/message_serializer.rb
83
+ - lib/omniai/openai/chat/response_serializer.rb
84
+ - lib/omniai/openai/chat/stream.rb
85
+ - lib/omniai/openai/chat/text_serializer.rb
86
+ - lib/omniai/openai/chat/tool_call_message_serializer.rb
87
+ - lib/omniai/openai/chat/tool_call_result_serializer.rb
88
+ - lib/omniai/openai/chat/tool_call_serializer.rb
89
+ - lib/omniai/openai/chat/tool_serializer.rb
90
+ - lib/omniai/openai/chat/url_serializer.rb
65
91
  - lib/omniai/openai/client.rb
66
92
  - lib/omniai/openai/config.rb
67
93
  - lib/omniai/openai/embed.rb