@@ -2075,6 +2075,27 @@ static VALUE rb_llama_kv_self_seq_div(VALUE self, VALUE ctx, VALUE seq_id, VALUE
2075
2075
return Qnil ;
2076
2076
}
2077
2077
2078
+ /**
2079
+ * @overload llama_kv_self_seq_pos_min(context, seq_id)
2080
+ * @param [LlamaContext] context
2081
+ * @param [Integer] seq_id
2082
+ * @return [Integer]
2083
+ */
2084
+ static VALUE rb_llama_kv_self_seq_pos_min (VALUE self , VALUE ctx , VALUE seq_id ) {
2085
+ if (!rb_obj_is_kind_of (ctx , rb_cLlamaContext )) {
2086
+ rb_raise (rb_eArgError , "ctx must be a LlamaContext" );
2087
+ return Qnil ;
2088
+ }
2089
+ if (!RB_INTEGER_TYPE_P (seq_id )) {
2090
+ rb_raise (rb_eArgError , "seq_id must be an Integer" );
2091
+ return Qnil ;
2092
+ }
2093
+ llama_context_wrapper * context_wrapper = get_llama_context_wrapper (ctx );
2094
+ const int32_t pos_max = llama_kv_self_seq_pos_min (context_wrapper -> context , NUM2INT (seq_id ));
2095
+ RB_GC_GUARD (ctx );
2096
+ return INT2NUM (pos_max );
2097
+ }
2098
+
2078
2099
/**
2079
2100
* @overload llama_kv_self_seq_pos_max(context, seq_id)
2080
2101
* @param [LlamaContext] context
@@ -4800,6 +4821,9 @@ void Init_llama_cpp(void) {
4800
4821
/* llama_kv_self_seq_div */
4801
4822
rb_define_module_function (rb_mLlamaCpp , "llama_kv_self_seq_div" , rb_llama_kv_self_seq_div , 5 );
4802
4823
4824
+ /* llama_kv_self_seq_pos_min */
4825
+ rb_define_module_function (rb_mLlamaCpp , "llama_kv_self_seq_pos_min" , rb_llama_kv_self_seq_pos_min , 2 );
4826
+
4803
4827
/* llama_kv_self_seq_pos_max */
4804
4828
rb_define_module_function (rb_mLlamaCpp , "llama_kv_self_seq_pos_max" , rb_llama_kv_self_seq_pos_max , 2 );
4805
4829
0 commit comments