brute 6.1.1 → 6.1.2
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/brute/messages.rb +0 -47
- data/lib/brute/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: e08acbbd71a23c8da28df07f18d191b8df282b81e43faa49934d123274258090
|
|
4
|
+
data.tar.gz: 418f3ced0cba3f915859741f43f6e64150651c3f00f05ec05825db38376e9033
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 117fccb5ea1751db05c53ff3a4d1ceee66de13b4c3384877ed198cd1c384eaad0eb1344280a04486c013fdb0f956a2aab1038e1c7f156bda144de88e52fd200f
|
|
7
|
+
data.tar.gz: 9a9deb24a12e26280dd77402489140907ff8760a8232616b8288c1586e345c844c090858435d3662a3258089734fb2a16c1fedca75a271abb4aa9b01ca93c60a
|
data/lib/brute/messages.rb
CHANGED
|
@@ -92,34 +92,12 @@ module Brute
|
|
|
92
92
|
# What the model thought, for anyone reading rather than replaying.
|
|
93
93
|
def text = blocks.filter_map(&:text).join("\n")
|
|
94
94
|
|
|
95
|
-
# Whether these blocks may be sent back to this provider as they are. A
|
|
96
|
-
# signature the provider did not issue is worse than no signature: it is
|
|
97
|
-
# a rejected request.
|
|
98
|
-
def signed_by?(format) = !format.nil? && blocks.any? && issued_by?(format) && blocks.all?(&:signed?)
|
|
99
|
-
|
|
100
95
|
# Whether this is the sequence the model emitted rather than one built
|
|
101
96
|
# around a plaintext string. Only the former may be replayed: a provider
|
|
102
97
|
# checks what comes back against what it produced, and prose lifted out of
|
|
103
98
|
# a `reasoning` field was never a sequence at all.
|
|
104
99
|
def detailed? = blocks.any? { |block| block.signed? || block.format || block.id }
|
|
105
100
|
|
|
106
|
-
# Whether every block came from this provider. The sequence goes back
|
|
107
|
-
# whole or not at all, so one foreign block disqualifies all of them.
|
|
108
|
-
#
|
|
109
|
-
# A block that names no provider is nobody's to vouch for: unsigned there
|
|
110
|
-
# is nothing to vouch for and it passes, but signed it is a signature that
|
|
111
|
-
# cannot be attributed, and offering one the provider did not issue is a
|
|
112
|
-
# rejected request rather than an unverified one.
|
|
113
|
-
def issued_by?(format)
|
|
114
|
-
blocks.all? do |block|
|
|
115
|
-
if block.format.nil?
|
|
116
|
-
!block.signed?
|
|
117
|
-
else
|
|
118
|
-
format.nil? || block.format == format
|
|
119
|
-
end
|
|
120
|
-
end
|
|
121
|
-
end
|
|
122
|
-
|
|
123
101
|
def to_h(...) = { blocks: blocks.map(&:to_h) }
|
|
124
102
|
end
|
|
125
103
|
|
|
@@ -256,31 +234,6 @@ describe "brute/messages" do
|
|
|
256
234
|
Brute::Message.new(**m.to_h).should == m
|
|
257
235
|
end
|
|
258
236
|
|
|
259
|
-
it "will not vouch for a sequence in which any block is unsigned" do
|
|
260
|
-
# A provider that verifies signatures rejects a thinking block without
|
|
261
|
-
# one, so one signed block among several does not make the sequence
|
|
262
|
-
# sendable: every block has to carry its own signature, or none goes.
|
|
263
|
-
mixed = Brute::Reasoning.build(blocks: [
|
|
264
|
-
{ type: :text, text: "step one", signature: "sig-1", format: "anthropic-claude-v1" },
|
|
265
|
-
{ type: :text, text: "step two", format: "anthropic-claude-v1" },
|
|
266
|
-
])
|
|
267
|
-
|
|
268
|
-
mixed.signed_by?("anthropic-claude-v1").should.be.false
|
|
269
|
-
end
|
|
270
|
-
|
|
271
|
-
it "will not vouch for a signature that names no provider" do
|
|
272
|
-
# A block with a signature and no format cannot be attributed, and a
|
|
273
|
-
# signature the provider did not issue is a rejected request rather than
|
|
274
|
-
# an unverified one. Unsigned and unstamped is nobody's claim to make, so
|
|
275
|
-
# it passes.
|
|
276
|
-
unattributed = Brute::Reasoning.build(text: "thought", signature: "sig-1")
|
|
277
|
-
|
|
278
|
-
unattributed.issued_by?("anthropic-claude-v1").should.be.false
|
|
279
|
-
unattributed.signed_by?("anthropic-claude-v1").should.be.false
|
|
280
|
-
|
|
281
|
-
Brute::Reasoning.build(text: "just prose").issued_by?("anthropic-claude-v1").should.be.true
|
|
282
|
-
end
|
|
283
|
-
|
|
284
237
|
it "knows a sequence the model produced from one built around a string" do
|
|
285
238
|
# Only what the model actually emitted may be sent back as a sequence, so
|
|
286
239
|
# reasoning coerced from plaintext is not one to be replayed.
|
data/lib/brute/version.rb
CHANGED