ask-llm-providers 0.1.8 → 0.1.9

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: e0a952555ce477b6a2e1ad523112f779a25cd526e0f255a8b6bac78dca33e1c8
4
- data.tar.gz: 1b90e7fe032a0295fff1a9284045b08bb1a3f82d6c3559b9ecf7f47b7a0d2d0c
3
+ metadata.gz: 9420dbab5b91a4dc5d92e0779f4b92e9a5bf11d21f2ea607e1b700ef894c1578
4
+ data.tar.gz: e9e62382fe81dc6723392b8a69591f284c96dec9704e189eb8d8e5540ddb96f9
5
5
  SHA512:
6
- metadata.gz: 57eea3bd9cb97969545688494f37be34cc029e94ea7ee0224efd8041b7534e8b6fab82af2c35f276ef9a7b7f8a64a84edff94972b92508554d37b4dafe556f90
7
- data.tar.gz: 0fc0ba47aa5437fd38cc0734ca84b15736072d925dea337d3a8f12f2226379c0fa6824e9648829ca5c67860460039457402ec87740690844c89eed97d6c6a3eb
6
+ metadata.gz: e9889516e4016d3b4114a2cd4640c419b52d23898d2cdf1bdce7476d341f3f638c680d92deb0f06e84e584f61dc517c6bc5b760b47624d0dc675293ba0d37092
7
+ data.tar.gz: 2a94331cd3f982a9f2241fdf2ce2d817e45ae1b61b66f7b108a6c3ee13b09e53ce13c374720baaa3b8e3082f07b6f81872dfc293d15e743e000b46938a723306
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ask
4
4
  module LLM
5
- VERSION = "0.1.8"
5
+ VERSION = "0.1.9"
6
6
  end
7
7
  end
@@ -109,7 +109,13 @@ module Ask
109
109
  role = msg[:role] || msg["role"] || :user
110
110
  { role: role.to_s, content: msg[:content] || msg["content"] }.tap do |fm|
111
111
  if (tc = msg[:tool_calls] || msg["tool_calls"])
112
- fm[:tool_calls] = tc.map { |t| { id: t[:id] || t["id"], type: "function", function: { name: t.dig(:function, :name) || t.dig("function", "name") || t[:name], arguments: t.dig(:function, :arguments) || t.dig("function", "arguments") || t[:arguments] } } }
112
+ calls = tc.is_a?(Hash) ? tc.values : tc
113
+ fm[:tool_calls] = calls.map { |t|
114
+ id = t.respond_to?(:id) ? t.id : (t[:id] || t["id"])
115
+ name = t.respond_to?(:name) ? t.name : (t.dig(:function, :name) || t.dig("function", "name") || t[:name])
116
+ args = t.respond_to?(:arguments) ? t.arguments : (t.dig(:function, :arguments) || t.dig("function", "arguments") || t[:arguments])
117
+ { id: id, type: "function", function: { name: name, arguments: args } }
118
+ }
113
119
  end
114
120
  fm[:tool_call_id] = msg[:tool_call_id] || msg["tool_call_id"] if msg[:tool_call_id] || msg["tool_call_id"]
115
121
  end.compact
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ask-llm-providers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaka Ruto