ruby-openai-swarm 0.2.6 → 0.2.7
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/Gemfile.lock +1 -1
- data/examples/airline/main.rb +4 -1
- data/examples/basic/function_calling.rb +1 -17
- data/lib/ruby-openai-swarm/core.rb +8 -0
- data/lib/ruby-openai-swarm/version.rb +1 -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)
|
@@ -46,7 +46,6 @@ Details:
|
|
46
46
|
Example: “What’s the weather in NYC?”
|
47
47
|
Action: Calls get_weather with location “New York City”.
|
48
48
|
Response: Only provides weather details.
|
49
|
-
|
50
49
|
2. Multiple Function Calls
|
51
50
|
Example: “Tell me the weather in New York and the latest news headlines.”
|
52
51
|
Action: Calls get_weather for weather and get_news for news.
|
@@ -59,19 +58,4 @@ GUIDE_EXAMPLES
|
|
59
58
|
|
60
59
|
puts guide_examples
|
61
60
|
|
62
|
-
|
63
|
-
|
64
|
-
OpenAISwarm.new.run_and_stream(
|
65
|
-
agent: agent,
|
66
|
-
debug: true,
|
67
|
-
messages: [{"role" => "user", "content" => "Tell me the weather in New York and the latest news headlines."}]
|
68
|
-
) do |chunk|
|
69
|
-
if chunk.key?("content") && !chunk["content"].nil?
|
70
|
-
puts ">>>#{chunk}"
|
71
|
-
end
|
72
|
-
|
73
|
-
if chunk.key?('response')
|
74
|
-
binding.pry
|
75
|
-
# log_llm_request(chunk['response'])
|
76
|
-
end
|
77
|
-
end
|
61
|
+
OpenAISwarm::Repl.run_demo_loop(agent, stream: true, debug: env_debug)
|
@@ -265,6 +265,14 @@ module OpenAISwarm
|
|
265
265
|
history.concat(partial_response.messages)
|
266
266
|
context_variables.merge!(partial_response.context_variables)
|
267
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?
|
268
276
|
end
|
269
277
|
|
270
278
|
yield(
|
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-12-
|
11
|
+
date: 2024-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-openai
|