llmtrim 0.1.9-x86_64-linux → 0.1.10-x86_64-linux
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/llmtrim/libllmtrim_ffi.so +0 -0
- data/lib/llmtrim/llmtrim_ffi.rb +135 -3
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d966521f8d682b3073a31add7e64ce408443f5555cad149311ca43d109c542ef
|
|
4
|
+
data.tar.gz: d74194d9d23402aa4178b603d1e04d0148627d0bc7a14d036b06335ca501c983
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 19f2baeb9d6a6e7a326bc2bd22ba27c015b07871b4c24e4e5a5ca46773a86246d89533dfcb3db3f30c9df424216a3b1bebba3c13d192ddeef43f7e261b0783cf
|
|
7
|
+
data.tar.gz: e4eeee23e469486bf5e8492cc68d091c76455125686a0f0a2e587586a285699c069ad8250bb61d65ec0147ff71aa6a481fa71cf985344734e42d42a5899e7c8a
|
|
Binary file
|
data/lib/llmtrim/llmtrim_ffi.rb
CHANGED
|
@@ -123,6 +123,7 @@ end
|
|
|
123
123
|
|
|
124
124
|
|
|
125
125
|
|
|
126
|
+
RustBuffer.check_lower_SequenceTypeStageReport(v.stages)
|
|
126
127
|
end
|
|
127
128
|
|
|
128
129
|
def self.alloc_from_TypeCompressOutput(v)
|
|
@@ -138,6 +139,29 @@ end
|
|
|
138
139
|
end
|
|
139
140
|
end
|
|
140
141
|
|
|
142
|
+
# The Record type StageReport.
|
|
143
|
+
|
|
144
|
+
def self.check_lower_TypeStageReport(v)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
RustBuffer.check_lower_Optionalstring(v.note)
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
def self.alloc_from_TypeStageReport(v)
|
|
153
|
+
RustBuffer.allocWithBuilder do |builder|
|
|
154
|
+
builder.write_TypeStageReport(v)
|
|
155
|
+
return builder.finalize
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
def consumeIntoTypeStageReport
|
|
160
|
+
consumeWithStream do |stream|
|
|
161
|
+
return stream.readTypeStageReport
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
|
|
141
165
|
|
|
142
166
|
|
|
143
167
|
# The Enum type Provider.
|
|
@@ -201,6 +225,27 @@ end
|
|
|
201
225
|
end
|
|
202
226
|
end
|
|
203
227
|
|
|
228
|
+
# The Sequence<T> type for TypeStageReport.
|
|
229
|
+
|
|
230
|
+
def self.check_lower_SequenceTypeStageReport(v)
|
|
231
|
+
v.each do |item|
|
|
232
|
+
RustBuffer.check_lower_TypeStageReport(item)
|
|
233
|
+
end
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
def self.alloc_from_SequenceTypeStageReport(v)
|
|
237
|
+
RustBuffer.allocWithBuilder do |builder|
|
|
238
|
+
builder.write_SequenceTypeStageReport(v)
|
|
239
|
+
return builder.finalize()
|
|
240
|
+
end
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
def consumeIntoSequenceTypeStageReport
|
|
244
|
+
consumeWithStream do |stream|
|
|
245
|
+
return stream.readSequenceTypeStageReport
|
|
246
|
+
end
|
|
247
|
+
end
|
|
248
|
+
|
|
204
249
|
|
|
205
250
|
end
|
|
206
251
|
|
|
@@ -280,7 +325,20 @@ class RustBufferStream
|
|
|
280
325
|
input_tokens_before: readU64,
|
|
281
326
|
input_tokens_after: readU64,
|
|
282
327
|
frozen_input_tokens: readU64,
|
|
283
|
-
output_shaped: readBool
|
|
328
|
+
output_shaped: readBool,
|
|
329
|
+
stages: readSequenceTypeStageReport
|
|
330
|
+
)
|
|
331
|
+
end
|
|
332
|
+
|
|
333
|
+
# The Record type StageReport.
|
|
334
|
+
|
|
335
|
+
def readTypeStageReport
|
|
336
|
+
StageReport.new(
|
|
337
|
+
name: readString,
|
|
338
|
+
applied: readBool,
|
|
339
|
+
tokens_before: readU64,
|
|
340
|
+
tokens_after: readU64,
|
|
341
|
+
note: readOptionalstring
|
|
284
342
|
)
|
|
285
343
|
end
|
|
286
344
|
|
|
@@ -358,6 +416,22 @@ class RustBufferStream
|
|
|
358
416
|
end
|
|
359
417
|
end
|
|
360
418
|
|
|
419
|
+
# The Sequence<T> type for TypeStageReport.
|
|
420
|
+
|
|
421
|
+
def readSequenceTypeStageReport
|
|
422
|
+
count = unpack_from 4, 'l>'
|
|
423
|
+
|
|
424
|
+
raise InternalError, 'Unexpected negative sequence length' if count.negative?
|
|
425
|
+
|
|
426
|
+
items = []
|
|
427
|
+
|
|
428
|
+
count.times do
|
|
429
|
+
items.append readTypeStageReport
|
|
430
|
+
end
|
|
431
|
+
|
|
432
|
+
items
|
|
433
|
+
end
|
|
434
|
+
|
|
361
435
|
|
|
362
436
|
|
|
363
437
|
def unpack_from(size, format)
|
|
@@ -431,6 +505,17 @@ class RustBufferBuilder
|
|
|
431
505
|
self.write_U64(v.input_tokens_after)
|
|
432
506
|
self.write_U64(v.frozen_input_tokens)
|
|
433
507
|
self.write_Bool(v.output_shaped)
|
|
508
|
+
self.write_SequenceTypeStageReport(v.stages)
|
|
509
|
+
end
|
|
510
|
+
|
|
511
|
+
# The Record type StageReport.
|
|
512
|
+
|
|
513
|
+
def write_TypeStageReport(v)
|
|
514
|
+
self.write_String(v.name)
|
|
515
|
+
self.write_Bool(v.applied)
|
|
516
|
+
self.write_U64(v.tokens_before)
|
|
517
|
+
self.write_U64(v.tokens_after)
|
|
518
|
+
self.write_Optionalstring(v.note)
|
|
434
519
|
end
|
|
435
520
|
|
|
436
521
|
|
|
@@ -464,6 +549,16 @@ class RustBufferBuilder
|
|
|
464
549
|
end
|
|
465
550
|
end
|
|
466
551
|
|
|
552
|
+
# The Sequence<T> type for TypeStageReport.
|
|
553
|
+
|
|
554
|
+
def write_SequenceTypeStageReport(items)
|
|
555
|
+
pack_into(4, 'l>', items.size)
|
|
556
|
+
|
|
557
|
+
items.each do |item|
|
|
558
|
+
self.write_TypeStageReport(item)
|
|
559
|
+
end
|
|
560
|
+
end
|
|
561
|
+
|
|
467
562
|
|
|
468
563
|
|
|
469
564
|
private
|
|
@@ -660,9 +755,9 @@ end
|
|
|
660
755
|
|
|
661
756
|
# Record type CompressOutput
|
|
662
757
|
class CompressOutput
|
|
663
|
-
attr_reader :request_json, :provider, :model, :tokenizer_label, :tokenizer_exact, :input_tokens_before, :input_tokens_after, :frozen_input_tokens, :output_shaped
|
|
758
|
+
attr_reader :request_json, :provider, :model, :tokenizer_label, :tokenizer_exact, :input_tokens_before, :input_tokens_after, :frozen_input_tokens, :output_shaped, :stages
|
|
664
759
|
|
|
665
|
-
def initialize(request_json:, provider:, model:, tokenizer_label:, tokenizer_exact:, input_tokens_before:, input_tokens_after:, frozen_input_tokens:, output_shaped:)
|
|
760
|
+
def initialize(request_json:, provider:, model:, tokenizer_label:, tokenizer_exact:, input_tokens_before:, input_tokens_after:, frozen_input_tokens:, output_shaped:, stages:)
|
|
666
761
|
@request_json = request_json
|
|
667
762
|
@provider = provider
|
|
668
763
|
@model = model
|
|
@@ -672,6 +767,7 @@ class CompressOutput
|
|
|
672
767
|
@input_tokens_after = input_tokens_after
|
|
673
768
|
@frozen_input_tokens = frozen_input_tokens
|
|
674
769
|
@output_shaped = output_shaped
|
|
770
|
+
@stages = stages
|
|
675
771
|
end
|
|
676
772
|
|
|
677
773
|
def ==(other)
|
|
@@ -702,6 +798,42 @@ class CompressOutput
|
|
|
702
798
|
if @output_shaped != other.output_shaped
|
|
703
799
|
return false
|
|
704
800
|
end
|
|
801
|
+
if @stages != other.stages
|
|
802
|
+
return false
|
|
803
|
+
end
|
|
804
|
+
|
|
805
|
+
true
|
|
806
|
+
end
|
|
807
|
+
end
|
|
808
|
+
|
|
809
|
+
# Record type StageReport
|
|
810
|
+
class StageReport
|
|
811
|
+
attr_reader :name, :applied, :tokens_before, :tokens_after, :note
|
|
812
|
+
|
|
813
|
+
def initialize(name:, applied:, tokens_before:, tokens_after:, note:)
|
|
814
|
+
@name = name
|
|
815
|
+
@applied = applied
|
|
816
|
+
@tokens_before = tokens_before
|
|
817
|
+
@tokens_after = tokens_after
|
|
818
|
+
@note = note
|
|
819
|
+
end
|
|
820
|
+
|
|
821
|
+
def ==(other)
|
|
822
|
+
if @name != other.name
|
|
823
|
+
return false
|
|
824
|
+
end
|
|
825
|
+
if @applied != other.applied
|
|
826
|
+
return false
|
|
827
|
+
end
|
|
828
|
+
if @tokens_before != other.tokens_before
|
|
829
|
+
return false
|
|
830
|
+
end
|
|
831
|
+
if @tokens_after != other.tokens_after
|
|
832
|
+
return false
|
|
833
|
+
end
|
|
834
|
+
if @note != other.note
|
|
835
|
+
return false
|
|
836
|
+
end
|
|
705
837
|
|
|
706
838
|
true
|
|
707
839
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: llmtrim
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.10
|
|
5
5
|
platform: x86_64-linux
|
|
6
6
|
authors:
|
|
7
7
|
- François Kiene
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-06-
|
|
11
|
+
date: 2026-06-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: ffi
|
|
@@ -59,5 +59,6 @@ requirements: []
|
|
|
59
59
|
rubygems_version: 3.5.22
|
|
60
60
|
signing_key:
|
|
61
61
|
specification_version: 4
|
|
62
|
-
summary: Static, deterministic LLM prompt/payload compression
|
|
62
|
+
summary: Static, deterministic LLM prompt/payload compression that cuts input tokens
|
|
63
|
+
30-90%.
|
|
63
64
|
test_files: []
|