llama_cpp 0.23.9 → 0.23.11

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: 68f7460b6ab553b85308547847c5883ea0c38c32cdc27cd8e6584ec0e91a8e25
4
- data.tar.gz: ece3d349b204f06232f8ffdaccb989bf679475526e10e2991ea4b940598e6e67
3
+ metadata.gz: 5fc81dd7e098dace7f301394170fa517ec4d214bc41d76dbbf4b79c162ebff85
4
+ data.tar.gz: 8641cedea81065a2d7ced2e8db028bf8209de42312e5b3431749c19f605d5134
5
5
  SHA512:
6
- metadata.gz: 66a8a170146f84f50db79c0ae42aa7e808c24dc37ebda1f4132f3a1fc2cf95f333fe8251d43bb43ad80e47b2702dd9f7458838a7ed2173b22340cfa654b3e0af
7
- data.tar.gz: f9c27b9ea682c4a5cfd70f2bf2e1a522505b405fd87965413abe544cf1124d6648a3705281dd28afe9681849697858731fd350d73e945788fe6bb9de30450189
6
+ metadata.gz: 3cb0176fc18bb430ee7d00177a911ebe204f975ef7d2db88a79c696a1e4b3fde2ae74cc9fa34648294a552b4f026238b00572e35c9bb20b892c14e8108286557
7
+ data.tar.gz: f1431d0adb6348e78b62e96c96fa017dda979c282a5d5c61a164f287a6a85b3650bb83cf1206c40d0eb3387ddd9c6cab2325d6d2c12824e0ca5a7df4d9576602
data/CHANGELOG.md CHANGED
@@ -1,12 +1,27 @@
1
+ ## [[0.23.11](https://github.com/yoshoku/llama_cpp.rb/compare/v0.23.10...v0.23.11)] - 2026-01-24
2
+
3
+ - Change supported llama.cpp version to b7790.
4
+ - Add `llama_sampler_init_adaptive_p` module function to `LlamaCpp`.
5
+
6
+ ## [[0.23.10](https://github.com/yoshoku/llama_cpp.rb/compare/v0.23.9...v0.23.10)] - 2026-01-10
7
+
8
+ - Change supported llama.cpp version to b7690.
9
+ - Add `llama_model_n_embd_out` module function to `LlamaCpp`.
10
+ - Add `use_direct_io` accessor to `LlamaModelParams`.
11
+ - Add constant values for `enum llama_params_fit_status` to `LlamaCpp`.
12
+ - `LLAMA_PARAMS_FIT_STATUS_SUCCESS`
13
+ - `LLAMA_PARAMS_FIT_STATUS_FAILURE`
14
+ - `LLAMA_PARAMS_FIT_STATUS_ERROR`
15
+
1
16
  ## [[0.23.9](https://github.com/yoshoku/llama_cpp.rb/compare/v0.23.8...v0.23.9)] - 2025-12-20
2
17
 
3
- - Change supported llama.cpp version to b7470
18
+ - Change supported llama.cpp version to b7470.
4
19
  - Add `no_alloc` accessor to `LlamaModelParams`.
5
20
  - Add `llama_max_tensor_buft_overrides` module function to `LlamaCpp`.
6
21
 
7
22
  ## [[0.23.8](https://github.com/yoshoku/llama_cpp.rb/compare/v0.23.7...v0.23.8)] - 2025-11-30
8
23
 
9
- - Change supported llama.cpp version to b7180
24
+ - Change supported llama.cpp version to b7180.
10
25
  - Add `llama_model_meta_key_str` module function to `LlamaCpp`.
11
26
  - Add constant values for `enum llama_model_meta_key` to `LlamaCpp`.
12
27
  - `LLAMA_MODEL_META_KEY_SAMPLING_SEQUENCE`
@@ -21,7 +36,7 @@
21
36
  - `LLAMA_MODEL_META_KEY_SAMPLING_MIROSTAT`
22
37
  - `LLAMA_MODEL_META_KEY_SAMPLING_MIROSTAT_TAU`
23
38
  - `LLAMA_MODEL_META_KEY_SAMPLING_MIROSTAT_ETA`
24
- - Add `llama_model_meta_count` module function to `LlamaCpp`
39
+ - Add `llama_model_meta_count` module function to `LlamaCpp`.
25
40
 
26
41
  ## [[0.23.7](https://github.com/yoshoku/llama_cpp.rb/compare/v0.23.6...v0.23.7)] - 2025-11-22
27
42
 
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2023-2025 Atsushi Tatsuma
3
+ Copyright (c) 2023-2026 Atsushi Tatsuma
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/llama_cpp.svg)](https://badge.fury.io/rb/llama_cpp)
4
4
  [![License](https://img.shields.io/badge/License-MIT-yellowgreen.svg)](https://github.com/yoshoku/llama_cpp.rb/blob/main/LICENSE.txt)
5
- [![Documentation](https://img.shields.io/badge/api-reference-blue.svg)](https://yoshoku.github.io/llama_cpp.rb/doc/)
5
+ [![Documentation](https://img.shields.io/badge/api-reference-blue.svg)](https://gemdocs.org/gems/llama_cpp/)
6
6
 
7
7
  llama_cpp.rb provides Ruby bindings for the [llama.cpp](https://github.com/ggerganov/llama.cpp).
8
8
 
@@ -507,6 +507,17 @@ static VALUE llama_model_params_set_use_mmap(VALUE self, VALUE use_mmap) {
507
507
  return use_mmap;
508
508
  }
509
509
 
510
+ static VALUE llama_model_params_get_use_direct_io(VALUE self) {
511
+ struct llama_model_params* data = get_llama_model_params(self);
512
+ return data->use_direct_io ? Qtrue : Qfalse;
513
+ }
514
+
515
+ static VALUE llama_model_params_set_use_direct_io(VALUE self, VALUE use_direct_io) {
516
+ struct llama_model_params* data = get_llama_model_params(self);
517
+ data->use_direct_io = RTEST(use_direct_io) ? true : false;
518
+ return use_direct_io;
519
+ }
520
+
510
521
  static VALUE llama_model_params_get_use_mlock(VALUE self) {
511
522
  struct llama_model_params* data = get_llama_model_params(self);
512
523
  return data->use_mlock ? Qtrue : Qfalse;
@@ -1590,6 +1601,20 @@ static VALUE rb_llama_model_n_embd_inp(VALUE self, VALUE model) {
1590
1601
  return INT2NUM(llama_model_n_embd_inp(model_wrapper->model));
1591
1602
  }
1592
1603
 
1604
+ /**
1605
+ * @overload llama_model_n_embd_out(model)
1606
+ * @param [LlamaModel] model
1607
+ * @return [Integer]
1608
+ */
1609
+ static VALUE rb_llama_model_n_embd_out(VALUE self, VALUE model) {
1610
+ if (!rb_obj_is_kind_of(model, rb_cLlamaModel)) {
1611
+ rb_raise(rb_eArgError, "model must be a LlamaModel");
1612
+ return Qnil;
1613
+ }
1614
+ llama_model_wrapper* model_wrapper = get_llama_model_wrapper(model);
1615
+ return INT2NUM(llama_model_n_embd_out(model_wrapper->model));
1616
+ }
1617
+
1593
1618
  /**
1594
1619
  * @overload llama_model_n_layer(model)
1595
1620
  * @param [LlamaModel] model
@@ -3689,6 +3714,30 @@ static VALUE rb_llama_sampler_init_penalties(VALUE self, VALUE penalty_last_n, V
3689
3714
  return TypedData_Wrap_Struct(rb_cLlamaSampler, &llama_sampler_data_type, sampler);
3690
3715
  }
3691
3716
 
3717
+ /**
3718
+ * @overload llama_sampler_init_adaptive_p(target, decay, seed)
3719
+ * @param [Float] target
3720
+ * @param [Float] decay
3721
+ * @param [Integer] seed
3722
+ * @return [LlamaSampler]
3723
+ */
3724
+ static VALUE rb_llama_sampler_init_adaptive_p(VALUE self, VALUE target, VALUE decay, VALUE seed) {
3725
+ if (!RB_FLOAT_TYPE_P(target)) {
3726
+ rb_raise(rb_eArgError, "target must be a Float");
3727
+ return Qnil;
3728
+ }
3729
+ if (!RB_FLOAT_TYPE_P(decay)) {
3730
+ rb_raise(rb_eArgError, "decay must be a Float");
3731
+ return Qnil;
3732
+ }
3733
+ if (!RB_INTEGER_TYPE_P(seed)) {
3734
+ rb_raise(rb_eArgError, "seed must be an Integer");
3735
+ return Qnil;
3736
+ }
3737
+ struct llama_sampler* sampler = llama_sampler_init_adaptive_p(NUM2DBL(target), NUM2DBL(decay), NUM2UINT(seed));
3738
+ return TypedData_Wrap_Struct(rb_cLlamaSampler, &llama_sampler_data_type, sampler);
3739
+ }
3740
+
3692
3741
  /**
3693
3742
  * @overload llama_sampler_init_logit_bias(n_vocab, n_logit_bias, logit_bias)
3694
3743
  * @param [Integer] n_vocab
@@ -4388,6 +4437,17 @@ void Init_llama_cpp(void) {
4388
4437
  * @return [Boolean]
4389
4438
  */
4390
4439
  rb_define_method(rb_cLlamaModelParams, "use_mmap=", RUBY_METHOD_FUNC(llama_model_params_set_use_mmap), 1);
4440
+ /**
4441
+ * Document-method: use_direct_io
4442
+ * @return [Boolean]
4443
+ */
4444
+ rb_define_method(rb_cLlamaModelParams, "use_direct_io", RUBY_METHOD_FUNC(llama_model_params_get_use_direct_io), 0);
4445
+ /**
4446
+ * Document-method: use_direct_io=
4447
+ * @param [Boolean] use_direct_io
4448
+ * @return [Boolean]
4449
+ */
4450
+ rb_define_method(rb_cLlamaModelParams, "use_direct_io=", RUBY_METHOD_FUNC(llama_model_params_set_use_direct_io), 1);
4391
4451
  /**
4392
4452
  * Document-method: use_mlock
4393
4453
  * @return [Boolean]
@@ -4444,6 +4504,8 @@ void Init_llama_cpp(void) {
4444
4504
  */
4445
4505
  rb_define_method(rb_cLlamaModelParams, "no_alloc=", RUBY_METHOD_FUNC(llama_model_params_set_no_alloc), 1);
4446
4506
 
4507
+ /* TODO: struct llama_sampler_seq_config */
4508
+
4447
4509
  /**
4448
4510
  * Document-class: LlamaCpp::LlamaContextParams
4449
4511
  * "struct llama_context_params" wrapper class
@@ -4732,6 +4794,10 @@ void Init_llama_cpp(void) {
4732
4794
  * @return [Boolean]
4733
4795
  */
4734
4796
  rb_define_method(rb_cLlamaContextParams, "kv_unified", RUBY_METHOD_FUNC(llama_context_params_get_kv_unified), 0);
4797
+
4798
+ /* TODO: struct llama_sampler_seq_config * samplers */
4799
+ /* TODO: size_t n_samplers */
4800
+
4735
4801
  /**
4736
4802
  * Document-method: kv_unified=
4737
4803
  * @param [Boolean] kv_unified
@@ -4940,6 +5006,12 @@ void Init_llama_cpp(void) {
4940
5006
  /* llama_free */
4941
5007
  rb_define_module_function(rb_mLlamaCpp, "llama_free", rb_llama_free, 1);
4942
5008
 
5009
+ /* llama_params_fit_status */
5010
+ /* Document-const: LlamaCpp::LLAMA_PARAMS_FIT_STATUS_SUCCESS */
5011
+ rb_define_const(rb_mLlamaCpp, "LLAMA_PARAMS_FIT_STATUS_SUCCESS", INT2NUM(LLAMA_PARAMS_FIT_STATUS_SUCCESS));
5012
+ rb_define_const(rb_mLlamaCpp, "LLAMA_PARAMS_FIT_STATUS_FAILURE", INT2NUM(LLAMA_PARAMS_FIT_STATUS_FAILURE));
5013
+ rb_define_const(rb_mLlamaCpp, "LLAMA_PARAMS_FIT_STATUS_ERROR", INT2NUM(LLAMA_PARAMS_FIT_STATUS_ERROR));
5014
+
4943
5015
  /* TODO: llama_params_fit */
4944
5016
 
4945
5017
  /* llama_time_us */
@@ -5005,6 +5077,9 @@ void Init_llama_cpp(void) {
5005
5077
  /* llama_model_n_embd_inp */
5006
5078
  rb_define_module_function(rb_mLlamaCpp, "llama_model_n_embd_inp", rb_llama_model_n_embd_inp, 1);
5007
5079
 
5080
+ /* llama_model_n_embd_out */
5081
+ rb_define_module_function(rb_mLlamaCpp, "llama_model_n_embd_out", rb_llama_model_n_embd_out, 1);
5082
+
5008
5083
  /* llama_model_n_layer */
5009
5084
  rb_define_module_function(rb_mLlamaCpp, "llama_model_n_layer", rb_llama_model_n_layer, 1);
5010
5085
 
@@ -5200,6 +5275,14 @@ void Init_llama_cpp(void) {
5200
5275
  /* TODO: llama_get_embeddings_ith */
5201
5276
  /* TODO: llama_get_embeddings_seq */
5202
5277
 
5278
+ /* TODO: llama_get_sampled_token_ith */
5279
+ /* TODO: llama_get_sampled_probs_ith */
5280
+ /* TODO: llama_get_sampled_probs_count_ith */
5281
+ /* TODO: llama_get_sampled_logits_ith */
5282
+ /* TODO: llama_get_sampled_logits_count_ith */
5283
+ /* TODO: llama_get_sampled_candidates_ith */
5284
+ /* TODO: llama_get_sampled_candidates_count_ith */
5285
+
5203
5286
  /* llama_vocab_get_text */
5204
5287
  rb_define_module_function(rb_mLlamaCpp, "llama_vocab_get_text", rb_llama_vocab_get_text, 2);
5205
5288
 
@@ -5275,6 +5358,9 @@ void Init_llama_cpp(void) {
5275
5358
  /* TODO: llama_chat_apply_template */
5276
5359
  /* TODO: llama_chat_builtin_templates */
5277
5360
 
5361
+ /* TODO: llama_sampler_context_t */
5362
+ /* TODO: struct llama_sampler_data */
5363
+
5278
5364
  /* TODO: struct llama_sampler_i */
5279
5365
 
5280
5366
  /**
@@ -5284,6 +5370,10 @@ void Init_llama_cpp(void) {
5284
5370
  rb_cLlamaSampler = rb_define_class_under(rb_mLlamaCpp, "LlamaSampler", rb_cObject);
5285
5371
  rb_define_alloc_func(rb_cLlamaSampler, llama_sampler_alloc);
5286
5372
 
5373
+ /* TODO: llama_set_sampler */
5374
+
5375
+ /* TODO: llama_sampler_init */
5376
+
5287
5377
  /* llama_sampler_name */
5288
5378
  rb_define_module_function(rb_mLlamaCpp, "llama_sampler_name", rb_llama_sampler_name, 1);
5289
5379
 
@@ -5363,6 +5453,9 @@ void Init_llama_cpp(void) {
5363
5453
 
5364
5454
  /* TODO: llama_sampler_init_dry */
5365
5455
 
5456
+ /* llama_sampler_init_adaptive_p */
5457
+ rb_define_module_function(rb_mLlamaCpp, "llama_sampler_init_adaptive_p", rb_llama_sampler_init_adaptive_p, 3);
5458
+
5366
5459
  /* llama_sampler_init_logit_bias */
5367
5460
  rb_define_module_function(rb_mLlamaCpp, "llama_sampler_init_logit_bias", rb_llama_sampler_init_logit_bias, 3);
5368
5461
 
@@ -3,8 +3,8 @@
3
3
  # llama_cpp.rb provides Ruby bindings for the llama.cpp.
4
4
  module LlamaCpp
5
5
  # The version of llama_cpp.rb you install.
6
- VERSION = '0.23.9'
6
+ VERSION = '0.23.11'
7
7
 
8
8
  # The supported version of llama.cpp.
9
- LLAMA_CPP_VERSION = 'b7470'
9
+ LLAMA_CPP_VERSION = 'b7790'
10
10
  end
data/lib/llama_cpp.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative 'llama_cpp/version'
4
- # On distributions like Rocky Linux, native extensions are installed in a separate
4
+ # On RHEL-based linux distributions, native extensions are installed in a separate
5
5
  # directory from Ruby code, so use require to load them.
6
6
  require 'llama_cpp/llama_cpp'
7
7
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: llama_cpp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.9
4
+ version: 0.23.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - yoshoku
@@ -33,7 +33,7 @@ metadata:
33
33
  homepage_uri: https://github.com/yoshoku/llama_cpp.rb
34
34
  source_code_uri: https://github.com/yoshoku/llama_cpp.rb
35
35
  changelog_uri: https://github.com/yoshoku/llama_cpp.rb/blob/main/CHANGELOG.md
36
- documentation_uri: https://gemdocs.org/gems/llama_cpp/0.23.9/
36
+ documentation_uri: https://gemdocs.org/gems/llama_cpp/0.23.11/
37
37
  rubygems_mfa_required: 'true'
38
38
  rdoc_options: []
39
39
  require_paths:
@@ -49,7 +49,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
49
49
  - !ruby/object:Gem::Version
50
50
  version: '0'
51
51
  requirements: []
52
- rubygems_version: 3.6.9
52
+ rubygems_version: 4.0.3
53
53
  specification_version: 4
54
54
  summary: Ruby bindings for the llama.cpp.
55
55
  test_files: []