riffer 0.9.0 → 0.10.0
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/.release-please-manifest.json +1 -1
- data/CHANGELOG.md +13 -0
- data/lib/riffer/helpers/class_name_converter.rb +7 -4
- data/lib/riffer/providers/amazon_bedrock.rb +17 -9
- data/lib/riffer/tool.rb +4 -1
- data/lib/riffer/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: d44459cec1b14508aac77178786e7230640ad1d455ced72ebda4ff02166283e4
|
|
4
|
+
data.tar.gz: 58a86d78ac5025d17245596e5ab0680d740fc0345cc3d51f2e68a65c5f3b8641
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9f8816ae7deb524c786afd74096f55bad54102c32d246f706f7bf15ed1c47cb7cd4f2ccb30c05af833b80e4898049febf5df45c98b8085c7b15c0ed71f425c98
|
|
7
|
+
data.tar.gz: 4c2627096ae1181b34d710d744ff339a61ebde623c30c6ea1e000ddac82bf9b374c7eb0d23364f7821856b407466332cc26fedca6288e93b23f9785515d220e7
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.10.0](https://github.com/janeapp/riffer/compare/riffer/v0.9.0...riffer/v0.10.0) (2026-01-30)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* update class name conversion to support configurable namespace separators ([#96](https://github.com/janeapp/riffer/issues/96)) ([e7091e9](https://github.com/janeapp/riffer/commit/e7091e95210c2df27138e61e64032d52ecf174e1))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* handle multiple tools correctly for bedrock ([#95](https://github.com/janeapp/riffer/issues/95)) ([50ae6f6](https://github.com/janeapp/riffer/commit/50ae6f6cd803d5e95b79cb6ceafca5b2d9b4a52c))
|
|
19
|
+
* update class name conversion to use double underscore format ([#93](https://github.com/janeapp/riffer/issues/93)) ([f6ffad7](https://github.com/janeapp/riffer/commit/f6ffad775a2d8254543dd7819dca93c15f514742))
|
|
20
|
+
|
|
8
21
|
## [0.9.0](https://github.com/janeapp/riffer/compare/riffer/v0.8.0...riffer/v0.9.0) (2026-01-28)
|
|
9
22
|
|
|
10
23
|
|
|
@@ -2,15 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
# Helper module for converting class names.
|
|
4
4
|
module Riffer::Helpers::ClassNameConverter
|
|
5
|
-
|
|
5
|
+
DEFAULT_SEPARATOR = "/"
|
|
6
|
+
|
|
7
|
+
# Converts a class name to snake_case identifier format.
|
|
6
8
|
#
|
|
7
9
|
# class_name:: String - the class name (e.g., "Riffer::Agent")
|
|
10
|
+
# separator:: String - the separator to use for namespaces (default: "/")
|
|
8
11
|
#
|
|
9
|
-
# Returns String - the snake_case
|
|
10
|
-
def class_name_to_path(class_name)
|
|
12
|
+
# Returns String - the snake_case identifier (e.g., "riffer/agent").
|
|
13
|
+
def class_name_to_path(class_name, separator: DEFAULT_SEPARATOR)
|
|
11
14
|
class_name
|
|
12
15
|
.to_s
|
|
13
|
-
.gsub("::",
|
|
16
|
+
.gsub("::", separator)
|
|
14
17
|
.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
|
|
15
18
|
.gsub(/([a-z\d])([A-Z])/, '\1_\2')
|
|
16
19
|
.downcase
|
|
@@ -137,15 +137,7 @@ class Riffer::Providers::AmazonBedrock < Riffer::Providers::Base
|
|
|
137
137
|
when Riffer::Messages::Assistant
|
|
138
138
|
conversation_messages << convert_assistant_to_bedrock_format(message)
|
|
139
139
|
when Riffer::Messages::Tool
|
|
140
|
-
conversation_messages
|
|
141
|
-
role: "user",
|
|
142
|
-
content: [{
|
|
143
|
-
tool_result: {
|
|
144
|
-
tool_use_id: message.tool_call_id,
|
|
145
|
-
content: [{text: message.content}]
|
|
146
|
-
}
|
|
147
|
-
}]
|
|
148
|
-
}
|
|
140
|
+
append_tool_result(conversation_messages, message)
|
|
149
141
|
end
|
|
150
142
|
end
|
|
151
143
|
|
|
@@ -155,6 +147,22 @@ class Riffer::Providers::AmazonBedrock < Riffer::Providers::Base
|
|
|
155
147
|
}
|
|
156
148
|
end
|
|
157
149
|
|
|
150
|
+
def append_tool_result(conversation_messages, message)
|
|
151
|
+
tool_result = {
|
|
152
|
+
tool_result: {
|
|
153
|
+
tool_use_id: message.tool_call_id,
|
|
154
|
+
content: [{text: message.content}]
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
prev = conversation_messages.last
|
|
159
|
+
if prev && prev[:role] == "user" && prev[:content]&.first&.key?(:tool_result)
|
|
160
|
+
prev[:content] << tool_result
|
|
161
|
+
else
|
|
162
|
+
conversation_messages << {role: "user", content: [tool_result]}
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
|
|
158
166
|
def convert_assistant_to_bedrock_format(message)
|
|
159
167
|
content = []
|
|
160
168
|
content << {text: message.content} if message.content && !message.content.empty?
|
data/lib/riffer/tool.rb
CHANGED
|
@@ -25,6 +25,9 @@ require "timeout"
|
|
|
25
25
|
class Riffer::Tool
|
|
26
26
|
DEFAULT_TIMEOUT = 10
|
|
27
27
|
|
|
28
|
+
# Some providers do not allow "/" in tool names, so we use "__" as separator.
|
|
29
|
+
TOOL_SEPARATOR = "__"
|
|
30
|
+
|
|
28
31
|
class << self
|
|
29
32
|
include Riffer::Helpers::ClassNameConverter
|
|
30
33
|
|
|
@@ -44,7 +47,7 @@ class Riffer::Tool
|
|
|
44
47
|
#
|
|
45
48
|
# Returns String - the tool identifier (defaults to snake_case class name).
|
|
46
49
|
def identifier(value = nil)
|
|
47
|
-
return @identifier || class_name_to_path(Module.instance_method(:name).bind_call(self)) if value.nil?
|
|
50
|
+
return @identifier || class_name_to_path(Module.instance_method(:name).bind_call(self), separator: TOOL_SEPARATOR) if value.nil?
|
|
48
51
|
@identifier = value.to_s
|
|
49
52
|
end
|
|
50
53
|
|
data/lib/riffer/version.rb
CHANGED