swarm_sdk 2.0.8 → 2.1.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 +4 -4
- data/lib/swarm_sdk/agent/chat.rb +15 -0
- data/lib/swarm_sdk/swarm/tool_configurator.rb +4 -1
- data/lib/swarm_sdk/tools/think.rb +3 -3
- data/lib/swarm_sdk/version.rb +1 -1
- data/lib/swarm_sdk.rb +1 -2
- 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: 47978b1c12d2f651d9a6cf9d902e7eff40d46505e436039e53f39bc0d2b05341
|
|
4
|
+
data.tar.gz: ae2b9ac86ec9a6718a14e121c7b19198e519cbd028a236b7b58d8b4acb96d3b9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 48d1f64f551285a081d55ee10e98ba4a31b4b6ee55303b7516e2170bc78f08bc895e740f61eb37c8731196450546f44917ac6a1c98cbb8d0b345c6cda2f91bf7
|
|
7
|
+
data.tar.gz: da736412afc0e1565ea706b0680cc961531649143294f2bbfce6954ebd752cdfa87d039cfd965ae881942764b3549d102f9a1711a15fdf23980a906d3108142c
|
data/lib/swarm_sdk/agent/chat.rb
CHANGED
|
@@ -413,6 +413,18 @@ module SwarmSDK
|
|
|
413
413
|
)
|
|
414
414
|
end
|
|
415
415
|
|
|
416
|
+
# Handle nil response from provider (malformed API response)
|
|
417
|
+
if response.nil?
|
|
418
|
+
raise RubyLLM::Error, "Provider returned nil response. This usually indicates a malformed API response " \
|
|
419
|
+
"that couldn't be parsed.\n\n" \
|
|
420
|
+
"Provider: #{@provider.class.name}\n" \
|
|
421
|
+
"API Base: #{@provider.api_base}\n" \
|
|
422
|
+
"Model: #{@model.id}\n" \
|
|
423
|
+
"Response: #{response.inspect}\n\n" \
|
|
424
|
+
"The API endpoint returned a response that couldn't be parsed into a valid Message object. " \
|
|
425
|
+
"Enable RubyLLM debug logging (RubyLLM.logger.level = Logger::DEBUG) to see the raw API response."
|
|
426
|
+
end
|
|
427
|
+
|
|
416
428
|
@on[:new_message]&.call unless block
|
|
417
429
|
|
|
418
430
|
# Handle schema parsing if needed
|
|
@@ -834,6 +846,9 @@ module SwarmSDK
|
|
|
834
846
|
when "openai", "deepseek", "perplexity", "mistral", "openrouter"
|
|
835
847
|
config.openai_api_base = base_url
|
|
836
848
|
config.openai_api_key = ENV["OPENAI_API_KEY"] || "dummy-key-for-local"
|
|
849
|
+
# Use standard 'system' role instead of 'developer' for OpenAI-compatible proxies
|
|
850
|
+
# Most proxies don't support OpenAI's newer 'developer' role convention
|
|
851
|
+
config.openai_use_system_role = true
|
|
837
852
|
when "ollama"
|
|
838
853
|
config.ollama_api_base = base_url
|
|
839
854
|
when "gpustack"
|
|
@@ -298,7 +298,7 @@ module SwarmSDK
|
|
|
298
298
|
# Check if a tool should be disabled based on disable_default_tools config
|
|
299
299
|
#
|
|
300
300
|
# @param tool_name [Symbol] Tool name to check
|
|
301
|
-
# @param disable_config [nil, Boolean, Array<Symbol>] Disable configuration
|
|
301
|
+
# @param disable_config [nil, Boolean, Symbol, Array<Symbol>] Disable configuration
|
|
302
302
|
# @return [Boolean] True if tool should be disabled
|
|
303
303
|
def tool_disabled?(tool_name, disable_config)
|
|
304
304
|
return false if disable_config.nil?
|
|
@@ -306,6 +306,9 @@ module SwarmSDK
|
|
|
306
306
|
if disable_config == true
|
|
307
307
|
# Disable all default tools
|
|
308
308
|
true
|
|
309
|
+
elsif disable_config.is_a?(Symbol)
|
|
310
|
+
# Single tool name
|
|
311
|
+
disable_config == tool_name
|
|
309
312
|
elsif disable_config.is_a?(Array)
|
|
310
313
|
# Disable only tools in the array
|
|
311
314
|
disable_config.include?(tool_name)
|
|
@@ -72,6 +72,8 @@ module SwarmSDK
|
|
|
72
72
|
back to earlier thinking. Use clear formatting and organization to make it easy to reference
|
|
73
73
|
later. Don't hesitate to think out loud - this tool is designed to augment your cognitive capabilities and help
|
|
74
74
|
you deliver better solutions.
|
|
75
|
+
|
|
76
|
+
**CRITICAL:** The Think tool takes only one parameter: thoughts. Do not include any other parameters.
|
|
75
77
|
DESC
|
|
76
78
|
|
|
77
79
|
param :thoughts,
|
|
@@ -79,9 +81,7 @@ module SwarmSDK
|
|
|
79
81
|
desc: "Your thoughts, plans, calculations, or any notes you want to record",
|
|
80
82
|
required: true
|
|
81
83
|
|
|
82
|
-
def execute(
|
|
83
|
-
return validation_error("thoughts are required") if thoughts.nil? || thoughts.empty?
|
|
84
|
-
|
|
84
|
+
def execute(**kwargs)
|
|
85
85
|
"Thought noted."
|
|
86
86
|
end
|
|
87
87
|
|
data/lib/swarm_sdk/version.rb
CHANGED
data/lib/swarm_sdk.rb
CHANGED