ruby-openai-swarm 0.2.5 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/examples/airline/main.rb +4 -1
- data/lib/ruby-openai-swarm/core.rb +18 -2
- data/lib/ruby-openai-swarm/version.rb +1 -1
- data/lib/ruby-openai-swarm.rb +7 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7e19b63e6210a63fbec735601f6f8c969db926046910dc545a7a37178b06b5d
|
4
|
+
data.tar.gz: e43680dfddffac87d2953611c2c4d1749efc522fe316eecc5a1750de9c73f4c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd71a36f8c62cfc621e9d495e030387da1b0320ec2b668322b5dfa02fdd6c5faca2b64956c1419ce955569cffeed5d00dbd432c759a88f536270a67c99cdb030
|
7
|
+
data.tar.gz: 2a39291b7454cbffa4d0679596c272b8324a1c5c9c801d7853b0a88991c03d6f938c562d1d6469aa5ae7ccaece64dbc900ce80d77dd376fee01e1c76632801df
|
data/Gemfile.lock
CHANGED
data/examples/airline/main.rb
CHANGED
@@ -65,4 +65,7 @@ params:
|
|
65
65
|
GUIDE_EXAMPLES
|
66
66
|
puts guide_examples
|
67
67
|
|
68
|
-
OpenAISwarm::Repl.run_demo_loop(triage_agent,
|
68
|
+
OpenAISwarm::Repl.run_demo_loop(triage_agent,
|
69
|
+
context_variables: context_variables,
|
70
|
+
debug: env_debug,
|
71
|
+
stream: true)
|
@@ -212,8 +212,16 @@ module OpenAISwarm
|
|
212
212
|
|
213
213
|
yield({ delim: "start" }) if block_given?
|
214
214
|
completion.each do |chunk|
|
215
|
-
|
216
|
-
|
215
|
+
if chunk['error']
|
216
|
+
details = {
|
217
|
+
'response' =>
|
218
|
+
Response.new(
|
219
|
+
messages: messages,
|
220
|
+
agent: active_agent,
|
221
|
+
context_variables: context_variables)
|
222
|
+
}
|
223
|
+
raise OpenAISwarm::Error.new(chunk['error'], details)
|
224
|
+
end
|
217
225
|
|
218
226
|
delta = chunk.dig('choices', 0, 'delta')
|
219
227
|
if delta['role'] == "assistant"
|
@@ -257,6 +265,14 @@ module OpenAISwarm
|
|
257
265
|
history.concat(partial_response.messages)
|
258
266
|
context_variables.merge!(partial_response.context_variables)
|
259
267
|
active_agent = partial_response.agent if partial_response.agent
|
268
|
+
|
269
|
+
tool_call_messages = (Array.wrap(message) + partial_response.messages)
|
270
|
+
yield(
|
271
|
+
'tool_call_messages' => Response.new(
|
272
|
+
messages: tool_call_messages,
|
273
|
+
agent: active_agent,
|
274
|
+
context_variables: context_variables)
|
275
|
+
) if block_given?
|
260
276
|
end
|
261
277
|
|
262
278
|
yield(
|
data/lib/ruby-openai-swarm.rb
CHANGED
@@ -8,7 +8,13 @@ require 'ruby-openai-swarm/function_descriptor'
|
|
8
8
|
require 'ruby-openai-swarm/repl'
|
9
9
|
|
10
10
|
module OpenAISwarm
|
11
|
-
class Error < StandardError;
|
11
|
+
class Error < StandardError;
|
12
|
+
attr_reader :details
|
13
|
+
def initialize(message, details = {})
|
14
|
+
@details = details
|
15
|
+
super(message)
|
16
|
+
end
|
17
|
+
end
|
12
18
|
|
13
19
|
class << self
|
14
20
|
def new(client = nil)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-openai-swarm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Grayson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-openai
|