omniai-openai 2.6.2 → 2.6.3
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 +4 -4
- data/lib/omniai/openai/chat.rb +52 -1
- data/lib/omniai/openai/client.rb +5 -2
- data/lib/omniai/openai/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e5e61a00ff0433efbc924958d49f273d17a9182420e8fcf4c1469078333243d2
|
|
4
|
+
data.tar.gz: bf8cd59ce36c89ad864e1c0b1a2ff69b1a38a9bc062d3ca7135851c80639956d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fe597fd91aab8aad25c3ad3b3f38cb59f3424b821bc15894fba58285c53262b96c850d194a8f32172b8308481e0c57786ffe72601dfd3e64fd0bdb8f2a4e5de0
|
|
7
|
+
data.tar.gz: f41c7dee9afb44c963b2eee6e091650848cb0d1ae3581d179c9b36875b5358bf66f14ef871d44876b52c4a38c1d49181ac984fcc8760151f0e2cb32323a14367
|
data/lib/omniai/openai/chat.rb
CHANGED
|
@@ -20,6 +20,19 @@ module OmniAI
|
|
|
20
20
|
SCHEMA_TYPE = "json_schema"
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
+
module ReasoningEffort
|
|
24
|
+
NONE = "none"
|
|
25
|
+
LOW = "low"
|
|
26
|
+
MEDIUM = "medium"
|
|
27
|
+
HIGH = "high"
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
module VerbosityText
|
|
31
|
+
LOW = "low"
|
|
32
|
+
MEDIUM = "medium"
|
|
33
|
+
HIGH = "high"
|
|
34
|
+
end
|
|
35
|
+
|
|
23
36
|
module Model
|
|
24
37
|
GPT_5_1 = "gpt-5.1"
|
|
25
38
|
GPT_5 = "gpt-5"
|
|
@@ -66,7 +79,9 @@ module OmniAI
|
|
|
66
79
|
stream_options: (DEFAULT_STREAM_OPTIONS if stream?),
|
|
67
80
|
temperature:,
|
|
68
81
|
tools: (@tools.map(&:serialize) if @tools&.any?),
|
|
69
|
-
|
|
82
|
+
reasoning: reasoning_payload,
|
|
83
|
+
verbosity: verbosity_payload,
|
|
84
|
+
}.merge(@kwargs || {})).compact
|
|
70
85
|
end
|
|
71
86
|
|
|
72
87
|
# @return [String]
|
|
@@ -87,6 +102,42 @@ module OmniAI
|
|
|
87
102
|
else raise ArgumentError, "unknown format=#{@format}"
|
|
88
103
|
end
|
|
89
104
|
end
|
|
105
|
+
|
|
106
|
+
# @raise [ArgumentError]
|
|
107
|
+
#
|
|
108
|
+
# @return [Hash, nil]
|
|
109
|
+
def reasoning_payload
|
|
110
|
+
return if @reasoning.nil?
|
|
111
|
+
|
|
112
|
+
effort = @reasoning[:effort] || @reasoning["effort"]
|
|
113
|
+
return if effort.nil?
|
|
114
|
+
|
|
115
|
+
valid_efforts = [ReasoningEffort::NONE, ReasoningEffort::LOW, ReasoningEffort::MEDIUM, ReasoningEffort::HIGH]
|
|
116
|
+
unless valid_efforts.include?(effort)
|
|
117
|
+
raise ArgumentError,
|
|
118
|
+
"reasoning effort must be one of #{valid_efforts.join(', ')}"
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
{ effort: }
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
# @raise [ArgumentError]
|
|
125
|
+
#
|
|
126
|
+
# @return [Hash, nil]
|
|
127
|
+
def verbosity_payload
|
|
128
|
+
return if @verbosity.nil?
|
|
129
|
+
|
|
130
|
+
text = @verbosity[:text] || @verbosity["text"]
|
|
131
|
+
return if text.nil?
|
|
132
|
+
|
|
133
|
+
valid_text_levels = [VerbosityText::LOW, VerbosityText::MEDIUM, VerbosityText::HIGH]
|
|
134
|
+
unless valid_text_levels.include?(text)
|
|
135
|
+
raise ArgumentError,
|
|
136
|
+
"verbosity text must be one of #{valid_text_levels.join(', ')}"
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
{ text: }
|
|
140
|
+
end
|
|
90
141
|
end
|
|
91
142
|
end
|
|
92
143
|
end
|
data/lib/omniai/openai/client.rb
CHANGED
|
@@ -77,13 +77,16 @@ module OmniAI
|
|
|
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
|
|
80
82
|
#
|
|
81
83
|
# @yield [prompt]
|
|
82
84
|
# @yieldparam prompt [OmniAI::Chat::Prompt]
|
|
83
85
|
#
|
|
84
86
|
# @return [OmniAI::Chat::Completion]
|
|
85
|
-
def chat(messages = nil, model: Chat::DEFAULT_MODEL, temperature: nil, format: nil, stream: nil, tools: nil,
|
|
86
|
-
|
|
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, &)
|
|
87
90
|
end
|
|
88
91
|
|
|
89
92
|
# @raise [OmniAI::Error]
|