liter_llm 2.6.1 → 2.7.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/ext/liter_llm_rb/native/Cargo.lock +3 -3
- data/ext/liter_llm_rb/native/Cargo.toml +3 -3
- data/ext/liter_llm_rb/src/lib.rs +269 -1
- data/lib/liter_llm/version.rb +2 -2
- data/sig/types.rbs +17 -3
- 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: 9df89cc7913f9d0b47b0a5b9ecd070de2dcf0ae2c95757c1161c6c96f2e76537
|
|
4
|
+
data.tar.gz: 1ddae582d580f2fcf02e6696d9fb02c590fa4712edfbf2221a0e1091a8097a9c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 26a9caf641f3f2a621d0f7353fcf611733aaaf6e997594f9e78606ff0f503ca031b5f810373c599945051330182380d5514ebf777558a23fc47930fb1e60dbfa
|
|
7
|
+
data.tar.gz: e5437773d6912a75d5e638732916a24173f2a78192d3b8067e11b5047967f8269176f1669023c9659991d43b06076da122178dc0a0949b93afb83e78d420976c
|
|
@@ -1705,9 +1705,9 @@ checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae"
|
|
|
1705
1705
|
|
|
1706
1706
|
[[package]]
|
|
1707
1707
|
name = "liter-llm"
|
|
1708
|
-
version = "2.
|
|
1708
|
+
version = "2.7.0"
|
|
1709
1709
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1710
|
-
checksum = "
|
|
1710
|
+
checksum = "09ffafc88fabc34e1713bfe917bdb58082dd0c6729414db755fabcbc40a9e174"
|
|
1711
1711
|
dependencies = [
|
|
1712
1712
|
"ahash",
|
|
1713
1713
|
"arc-swap",
|
|
@@ -1757,7 +1757,7 @@ dependencies = [
|
|
|
1757
1757
|
|
|
1758
1758
|
[[package]]
|
|
1759
1759
|
name = "liter-llm-rb"
|
|
1760
|
-
version = "2.
|
|
1760
|
+
version = "2.7.0"
|
|
1761
1761
|
dependencies = [
|
|
1762
1762
|
"futures",
|
|
1763
1763
|
"liter-llm",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# This file is auto-generated by alef — DO NOT EDIT.
|
|
2
|
-
# alef:hash:
|
|
2
|
+
# alef:hash:f6bda61765783b48c1e6f0d89b49f590eb1edf8d1b5f7fcd0bc9bb68b00e9d65
|
|
3
3
|
# To regenerate: alef generate
|
|
4
4
|
# To verify freshness: alef verify
|
|
5
5
|
|
|
6
6
|
[package]
|
|
7
7
|
name = "liter-llm-rb"
|
|
8
|
-
version = "2.
|
|
8
|
+
version = "2.7.0"
|
|
9
9
|
edition = "2024"
|
|
10
10
|
authors = ["Na'aman Hirschfeld <naaman@xberg.io>", "Tobias Perlstein <tobias@xberg.io>"]
|
|
11
11
|
license = "MIT"
|
|
@@ -32,7 +32,7 @@ wasm-http = ["liter-llm/wasm-http"]
|
|
|
32
32
|
|
|
33
33
|
[dependencies]
|
|
34
34
|
futures = "0.3"
|
|
35
|
-
liter-llm = { version = "2.
|
|
35
|
+
liter-llm = { version = "2.7.0", features = ["native-http", "full"] }
|
|
36
36
|
magnus = "0.9"
|
|
37
37
|
rb-sys = ">=0.9.130, <0.10"
|
|
38
38
|
serde = { version = "1", features = ["derive"] }
|
data/ext/liter_llm_rb/src/lib.rs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// This file is auto-generated by alef. DO NOT EDIT.
|
|
2
|
-
// alef:hash:
|
|
2
|
+
// alef:hash:ecf3885dce7ee71a7d2bdea3537ebd28727a086f0f3e807dc80a3c23eaaf0ad2
|
|
3
3
|
// Re-generate with: alef generate
|
|
4
4
|
#![allow(dead_code, unused_imports, unused_variables)]
|
|
5
5
|
#![allow(
|
|
@@ -120,6 +120,7 @@ pub struct AssistantMessage {
|
|
|
120
120
|
refusal: Option<String>,
|
|
121
121
|
function_call: Option<FunctionCall>,
|
|
122
122
|
reasoning_content: Option<String>,
|
|
123
|
+
thinking_blocks: Option<Vec<ThinkingBlock>>,
|
|
123
124
|
}
|
|
124
125
|
|
|
125
126
|
unsafe impl IntoValueFromNative for AssistantMessage {}
|
|
@@ -225,6 +226,15 @@ impl AssistantMessage {
|
|
|
225
226
|
})?),
|
|
226
227
|
None => None,
|
|
227
228
|
},
|
|
229
|
+
thinking_blocks: match kwargs.get(ruby.to_symbol("thinking_blocks")).filter(|v| !v.is_nil()) {
|
|
230
|
+
Some(v) => Some(<Vec<ThinkingBlock>>::try_convert(v).map_err(|e| {
|
|
231
|
+
magnus::Error::new(
|
|
232
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
233
|
+
format!("invalid value for `thinking_blocks`: {}", e),
|
|
234
|
+
)
|
|
235
|
+
})?),
|
|
236
|
+
None => None,
|
|
237
|
+
},
|
|
228
238
|
})
|
|
229
239
|
}
|
|
230
240
|
|
|
@@ -252,6 +262,10 @@ impl AssistantMessage {
|
|
|
252
262
|
self.reasoning_content.clone()
|
|
253
263
|
}
|
|
254
264
|
|
|
265
|
+
fn thinking_blocks(&self) -> Option<Vec<ThinkingBlock>> {
|
|
266
|
+
self.thinking_blocks.clone()
|
|
267
|
+
}
|
|
268
|
+
|
|
255
269
|
fn text(&self) -> Option<String> {
|
|
256
270
|
#[allow(clippy::needless_update)]
|
|
257
271
|
let core_self = liter_llm::types::AssistantMessage {
|
|
@@ -267,6 +281,11 @@ impl AssistantMessage {
|
|
|
267
281
|
|
|
268
282
|
reasoning_content: self.reasoning_content.clone(),
|
|
269
283
|
|
|
284
|
+
thinking_blocks: self
|
|
285
|
+
.thinking_blocks
|
|
286
|
+
.clone()
|
|
287
|
+
.map(|v| v.into_iter().map(Into::into).collect()),
|
|
288
|
+
|
|
270
289
|
..Default::default()
|
|
271
290
|
};
|
|
272
291
|
core_self.text()
|
|
@@ -287,6 +306,11 @@ impl AssistantMessage {
|
|
|
287
306
|
|
|
288
307
|
reasoning_content: self.reasoning_content.clone(),
|
|
289
308
|
|
|
309
|
+
thinking_blocks: self
|
|
310
|
+
.thinking_blocks
|
|
311
|
+
.clone()
|
|
312
|
+
.map(|v| v.into_iter().map(Into::into).collect()),
|
|
313
|
+
|
|
290
314
|
..Default::default()
|
|
291
315
|
};
|
|
292
316
|
core_self.refusal_text().map(|v| v.to_owned())
|
|
@@ -307,6 +331,11 @@ impl AssistantMessage {
|
|
|
307
331
|
|
|
308
332
|
reasoning_content: self.reasoning_content.clone(),
|
|
309
333
|
|
|
334
|
+
thinking_blocks: self
|
|
335
|
+
.thinking_blocks
|
|
336
|
+
.clone()
|
|
337
|
+
.map(|v| v.into_iter().map(Into::into).collect()),
|
|
338
|
+
|
|
310
339
|
..Default::default()
|
|
311
340
|
};
|
|
312
341
|
core_self.reasoning_text().map(|v| v.to_owned())
|
|
@@ -327,6 +356,11 @@ impl AssistantMessage {
|
|
|
327
356
|
|
|
328
357
|
reasoning_content: self.reasoning_content.clone(),
|
|
329
358
|
|
|
359
|
+
thinking_blocks: self
|
|
360
|
+
.thinking_blocks
|
|
361
|
+
.clone()
|
|
362
|
+
.map(|v| v.into_iter().map(Into::into).collect()),
|
|
363
|
+
|
|
330
364
|
..Default::default()
|
|
331
365
|
};
|
|
332
366
|
core_self.output_images().into_iter().map(Into::into).collect()
|
|
@@ -347,6 +381,11 @@ impl AssistantMessage {
|
|
|
347
381
|
|
|
348
382
|
reasoning_content: self.reasoning_content.clone(),
|
|
349
383
|
|
|
384
|
+
thinking_blocks: self
|
|
385
|
+
.thinking_blocks
|
|
386
|
+
.clone()
|
|
387
|
+
.map(|v| v.into_iter().map(Into::into).collect()),
|
|
388
|
+
|
|
350
389
|
..Default::default()
|
|
351
390
|
};
|
|
352
391
|
core_self.output_audio().into_iter().map(Into::into).collect()
|
|
@@ -11374,6 +11413,7 @@ pub struct StreamDelta {
|
|
|
11374
11413
|
function_call: Option<StreamFunctionCall>,
|
|
11375
11414
|
refusal: Option<String>,
|
|
11376
11415
|
reasoning_content: Option<String>,
|
|
11416
|
+
thinking_blocks: Option<Vec<ThinkingBlock>>,
|
|
11377
11417
|
}
|
|
11378
11418
|
|
|
11379
11419
|
unsafe impl IntoValueFromNative for StreamDelta {}
|
|
@@ -11479,6 +11519,15 @@ impl StreamDelta {
|
|
|
11479
11519
|
})?),
|
|
11480
11520
|
None => None,
|
|
11481
11521
|
},
|
|
11522
|
+
thinking_blocks: match kwargs.get(ruby.to_symbol("thinking_blocks")).filter(|v| !v.is_nil()) {
|
|
11523
|
+
Some(v) => Some(<Vec<ThinkingBlock>>::try_convert(v).map_err(|e| {
|
|
11524
|
+
magnus::Error::new(
|
|
11525
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
11526
|
+
format!("invalid value for `thinking_blocks`: {}", e),
|
|
11527
|
+
)
|
|
11528
|
+
})?),
|
|
11529
|
+
None => None,
|
|
11530
|
+
},
|
|
11482
11531
|
})
|
|
11483
11532
|
}
|
|
11484
11533
|
|
|
@@ -11506,6 +11555,10 @@ impl StreamDelta {
|
|
|
11506
11555
|
self.reasoning_content.clone()
|
|
11507
11556
|
}
|
|
11508
11557
|
|
|
11558
|
+
fn thinking_blocks(&self) -> Option<Vec<ThinkingBlock>> {
|
|
11559
|
+
self.thinking_blocks.clone()
|
|
11560
|
+
}
|
|
11561
|
+
|
|
11509
11562
|
#[allow(clippy::should_implement_trait)]
|
|
11510
11563
|
fn to_s(&self) -> String {
|
|
11511
11564
|
self.content.clone().unwrap_or_default()
|
|
@@ -11880,6 +11933,164 @@ impl SystemMessage {
|
|
|
11880
11933
|
}
|
|
11881
11934
|
}
|
|
11882
11935
|
|
|
11936
|
+
#[derive(Clone, Debug, serde::Serialize)]
|
|
11937
|
+
#[serde(default)]
|
|
11938
|
+
#[magnus::wrap(class = "LiterLlm::ThinkingBlock")]
|
|
11939
|
+
pub struct ThinkingBlock {
|
|
11940
|
+
#[serde(rename = "type")]
|
|
11941
|
+
block_type: Option<String>,
|
|
11942
|
+
thinking: Option<String>,
|
|
11943
|
+
signature: Option<String>,
|
|
11944
|
+
data: Option<String>,
|
|
11945
|
+
index: Option<u32>,
|
|
11946
|
+
text_offset: Option<u32>,
|
|
11947
|
+
tool_call_offset: Option<u32>,
|
|
11948
|
+
}
|
|
11949
|
+
|
|
11950
|
+
unsafe impl IntoValueFromNative for ThinkingBlock {}
|
|
11951
|
+
|
|
11952
|
+
impl magnus::TryConvert for ThinkingBlock {
|
|
11953
|
+
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
11954
|
+
if let Ok(r) = <&ThinkingBlock as magnus::TryConvert>::try_convert(val) {
|
|
11955
|
+
return Ok(r.clone());
|
|
11956
|
+
}
|
|
11957
|
+
let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
|
|
11958
|
+
s
|
|
11959
|
+
} else {
|
|
11960
|
+
val.funcall::<_, _, String>("to_json", ()).map_err(|e| {
|
|
11961
|
+
magnus::Error::new(
|
|
11962
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
11963
|
+
format!("no implicit conversion into ThinkingBlock: {}", e),
|
|
11964
|
+
)
|
|
11965
|
+
})?
|
|
11966
|
+
};
|
|
11967
|
+
serde_json::from_str::<ThinkingBlock>(&json_str).map_err(|e| {
|
|
11968
|
+
magnus::Error::new(
|
|
11969
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
11970
|
+
format!("failed to deserialize ThinkingBlock: {}", e),
|
|
11971
|
+
)
|
|
11972
|
+
})
|
|
11973
|
+
}
|
|
11974
|
+
}
|
|
11975
|
+
|
|
11976
|
+
unsafe impl TryConvertOwned for ThinkingBlock {}
|
|
11977
|
+
impl<'de> serde::Deserialize<'de> for ThinkingBlock {
|
|
11978
|
+
fn deserialize<D>(deserializer: D) -> ::core::result::Result<Self, D::Error>
|
|
11979
|
+
where
|
|
11980
|
+
D: serde::Deserializer<'de>,
|
|
11981
|
+
{
|
|
11982
|
+
<liter_llm::types::ThinkingBlock as serde::Deserialize>::deserialize(deserializer).map(Into::into)
|
|
11983
|
+
}
|
|
11984
|
+
}
|
|
11985
|
+
|
|
11986
|
+
impl Default for ThinkingBlock {
|
|
11987
|
+
fn default() -> Self {
|
|
11988
|
+
liter_llm::types::ThinkingBlock::default().into()
|
|
11989
|
+
}
|
|
11990
|
+
}
|
|
11991
|
+
|
|
11992
|
+
impl ThinkingBlock {
|
|
11993
|
+
fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
|
|
11994
|
+
let ruby = unsafe { magnus::Ruby::get_unchecked() };
|
|
11995
|
+
let args = magnus::scan_args::scan_args::<(), (Option<magnus::RHash>,), (), (), (), ()>(args)?;
|
|
11996
|
+
let (kwargs_opt,) = args.optional;
|
|
11997
|
+
let kwargs = kwargs_opt.unwrap_or_else(|| ruby.hash_new());
|
|
11998
|
+
Ok(Self {
|
|
11999
|
+
block_type: match kwargs.get(ruby.to_symbol("block_type")).filter(|v| !v.is_nil()) {
|
|
12000
|
+
Some(v) => Some(String::try_convert(v).map_err(|e| {
|
|
12001
|
+
magnus::Error::new(
|
|
12002
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
12003
|
+
format!("invalid value for `block_type`: {}", e),
|
|
12004
|
+
)
|
|
12005
|
+
})?),
|
|
12006
|
+
None => None,
|
|
12007
|
+
},
|
|
12008
|
+
thinking: match kwargs.get(ruby.to_symbol("thinking")).filter(|v| !v.is_nil()) {
|
|
12009
|
+
Some(v) => Some(String::try_convert(v).map_err(|e| {
|
|
12010
|
+
magnus::Error::new(
|
|
12011
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
12012
|
+
format!("invalid value for `thinking`: {}", e),
|
|
12013
|
+
)
|
|
12014
|
+
})?),
|
|
12015
|
+
None => None,
|
|
12016
|
+
},
|
|
12017
|
+
signature: match kwargs.get(ruby.to_symbol("signature")).filter(|v| !v.is_nil()) {
|
|
12018
|
+
Some(v) => Some(String::try_convert(v).map_err(|e| {
|
|
12019
|
+
magnus::Error::new(
|
|
12020
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
12021
|
+
format!("invalid value for `signature`: {}", e),
|
|
12022
|
+
)
|
|
12023
|
+
})?),
|
|
12024
|
+
None => None,
|
|
12025
|
+
},
|
|
12026
|
+
data: match kwargs.get(ruby.to_symbol("data")).filter(|v| !v.is_nil()) {
|
|
12027
|
+
Some(v) => Some(String::try_convert(v).map_err(|e| {
|
|
12028
|
+
magnus::Error::new(
|
|
12029
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
12030
|
+
format!("invalid value for `data`: {}", e),
|
|
12031
|
+
)
|
|
12032
|
+
})?),
|
|
12033
|
+
None => None,
|
|
12034
|
+
},
|
|
12035
|
+
index: match kwargs.get(ruby.to_symbol("index")).filter(|v| !v.is_nil()) {
|
|
12036
|
+
Some(v) => Some(u32::try_convert(v).map_err(|e| {
|
|
12037
|
+
magnus::Error::new(
|
|
12038
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
12039
|
+
format!("invalid value for `index`: {}", e),
|
|
12040
|
+
)
|
|
12041
|
+
})?),
|
|
12042
|
+
None => None,
|
|
12043
|
+
},
|
|
12044
|
+
text_offset: match kwargs.get(ruby.to_symbol("text_offset")).filter(|v| !v.is_nil()) {
|
|
12045
|
+
Some(v) => Some(u32::try_convert(v).map_err(|e| {
|
|
12046
|
+
magnus::Error::new(
|
|
12047
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
12048
|
+
format!("invalid value for `text_offset`: {}", e),
|
|
12049
|
+
)
|
|
12050
|
+
})?),
|
|
12051
|
+
None => None,
|
|
12052
|
+
},
|
|
12053
|
+
tool_call_offset: match kwargs.get(ruby.to_symbol("tool_call_offset")).filter(|v| !v.is_nil()) {
|
|
12054
|
+
Some(v) => Some(u32::try_convert(v).map_err(|e| {
|
|
12055
|
+
magnus::Error::new(
|
|
12056
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
12057
|
+
format!("invalid value for `tool_call_offset`: {}", e),
|
|
12058
|
+
)
|
|
12059
|
+
})?),
|
|
12060
|
+
None => None,
|
|
12061
|
+
},
|
|
12062
|
+
})
|
|
12063
|
+
}
|
|
12064
|
+
|
|
12065
|
+
fn block_type(&self) -> Option<String> {
|
|
12066
|
+
self.block_type.clone()
|
|
12067
|
+
}
|
|
12068
|
+
|
|
12069
|
+
fn thinking(&self) -> Option<String> {
|
|
12070
|
+
self.thinking.clone()
|
|
12071
|
+
}
|
|
12072
|
+
|
|
12073
|
+
fn signature(&self) -> Option<String> {
|
|
12074
|
+
self.signature.clone()
|
|
12075
|
+
}
|
|
12076
|
+
|
|
12077
|
+
fn data(&self) -> Option<String> {
|
|
12078
|
+
self.data.clone()
|
|
12079
|
+
}
|
|
12080
|
+
|
|
12081
|
+
fn index(&self) -> Option<u32> {
|
|
12082
|
+
self.index
|
|
12083
|
+
}
|
|
12084
|
+
|
|
12085
|
+
fn text_offset(&self) -> Option<u32> {
|
|
12086
|
+
self.text_offset
|
|
12087
|
+
}
|
|
12088
|
+
|
|
12089
|
+
fn tool_call_offset(&self) -> Option<u32> {
|
|
12090
|
+
self.tool_call_offset
|
|
12091
|
+
}
|
|
12092
|
+
}
|
|
12093
|
+
|
|
11883
12094
|
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
11884
12095
|
#[magnus::wrap(class = "LiterLlm::ToolCall")]
|
|
11885
12096
|
pub struct ToolCall {
|
|
@@ -14758,6 +14969,7 @@ impl From<AssistantMessage> for liter_llm::types::AssistantMessage {
|
|
|
14758
14969
|
refusal: val.refusal,
|
|
14759
14970
|
function_call: val.function_call.map(Into::into),
|
|
14760
14971
|
reasoning_content: val.reasoning_content,
|
|
14972
|
+
thinking_blocks: val.thinking_blocks.map(|v| v.into_iter().map(Into::into).collect()),
|
|
14761
14973
|
..Default::default()
|
|
14762
14974
|
}
|
|
14763
14975
|
}
|
|
@@ -14773,6 +14985,7 @@ impl From<liter_llm::types::AssistantMessage> for AssistantMessage {
|
|
|
14773
14985
|
refusal: val.refusal.map(|v| v.to_string()),
|
|
14774
14986
|
function_call: val.function_call.map(Into::into),
|
|
14775
14987
|
reasoning_content: val.reasoning_content.map(|v| v.to_string()),
|
|
14988
|
+
thinking_blocks: val.thinking_blocks.map(|v| v.into_iter().map(Into::into).collect()),
|
|
14776
14989
|
}
|
|
14777
14990
|
}
|
|
14778
14991
|
}
|
|
@@ -16968,6 +17181,7 @@ impl From<StreamDelta> for liter_llm::types::StreamDelta {
|
|
|
16968
17181
|
function_call: val.function_call.map(Into::into),
|
|
16969
17182
|
refusal: val.refusal,
|
|
16970
17183
|
reasoning_content: val.reasoning_content,
|
|
17184
|
+
thinking_blocks: val.thinking_blocks.map(|v| v.into_iter().map(Into::into).collect()),
|
|
16971
17185
|
..Default::default()
|
|
16972
17186
|
}
|
|
16973
17187
|
}
|
|
@@ -16983,6 +17197,7 @@ impl From<liter_llm::types::StreamDelta> for StreamDelta {
|
|
|
16983
17197
|
function_call: val.function_call.map(Into::into),
|
|
16984
17198
|
refusal: val.refusal.map(|v| v.to_string()),
|
|
16985
17199
|
reasoning_content: val.reasoning_content.map(|v| v.to_string()),
|
|
17200
|
+
thinking_blocks: val.thinking_blocks.map(|v| v.into_iter().map(Into::into).collect()),
|
|
16986
17201
|
}
|
|
16987
17202
|
}
|
|
16988
17203
|
}
|
|
@@ -17074,6 +17289,37 @@ impl From<liter_llm::types::SystemMessage> for SystemMessage {
|
|
|
17074
17289
|
}
|
|
17075
17290
|
}
|
|
17076
17291
|
|
|
17292
|
+
#[allow(clippy::needless_update)]
|
|
17293
|
+
impl From<ThinkingBlock> for liter_llm::types::ThinkingBlock {
|
|
17294
|
+
fn from(val: ThinkingBlock) -> Self {
|
|
17295
|
+
Self {
|
|
17296
|
+
block_type: val.block_type,
|
|
17297
|
+
thinking: val.thinking,
|
|
17298
|
+
signature: val.signature,
|
|
17299
|
+
data: val.data,
|
|
17300
|
+
index: val.index,
|
|
17301
|
+
text_offset: val.text_offset,
|
|
17302
|
+
tool_call_offset: val.tool_call_offset,
|
|
17303
|
+
..Default::default()
|
|
17304
|
+
}
|
|
17305
|
+
}
|
|
17306
|
+
}
|
|
17307
|
+
|
|
17308
|
+
#[allow(clippy::redundant_closure)]
|
|
17309
|
+
impl From<liter_llm::types::ThinkingBlock> for ThinkingBlock {
|
|
17310
|
+
fn from(val: liter_llm::types::ThinkingBlock) -> Self {
|
|
17311
|
+
Self {
|
|
17312
|
+
block_type: val.block_type.map(|v| v.to_string()),
|
|
17313
|
+
thinking: val.thinking.map(|v| v.to_string()),
|
|
17314
|
+
signature: val.signature.map(|v| v.to_string()),
|
|
17315
|
+
data: val.data.map(|v| v.to_string()),
|
|
17316
|
+
index: val.index,
|
|
17317
|
+
text_offset: val.text_offset,
|
|
17318
|
+
tool_call_offset: val.tool_call_offset,
|
|
17319
|
+
}
|
|
17320
|
+
}
|
|
17321
|
+
}
|
|
17322
|
+
|
|
17077
17323
|
#[allow(clippy::useless_conversion)]
|
|
17078
17324
|
impl From<ToolCall> for liter_llm::types::ToolCall {
|
|
17079
17325
|
fn from(val: ToolCall) -> Self {
|
|
@@ -18127,6 +18373,8 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
18127
18373
|
|
|
18128
18374
|
class.define_method("reasoning_content", method!(AssistantMessage::reasoning_content, 0))?;
|
|
18129
18375
|
|
|
18376
|
+
class.define_method("thinking_blocks", method!(AssistantMessage::thinking_blocks, 0))?;
|
|
18377
|
+
|
|
18130
18378
|
class.define_method("text", method!(AssistantMessage::text, 0))?;
|
|
18131
18379
|
|
|
18132
18380
|
class.define_method("refusal_text", method!(AssistantMessage::refusal_text, 0))?;
|
|
@@ -19521,6 +19769,8 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
19521
19769
|
|
|
19522
19770
|
class.define_method("reasoning_content", method!(StreamDelta::reasoning_content, 0))?;
|
|
19523
19771
|
|
|
19772
|
+
class.define_method("thinking_blocks", method!(StreamDelta::thinking_blocks, 0))?;
|
|
19773
|
+
|
|
19524
19774
|
class.define_method("to_s", method!(StreamDelta::to_s, 0))?;
|
|
19525
19775
|
|
|
19526
19776
|
let class = module.define_class("StreamFunctionCall", ruby.class_object())?;
|
|
@@ -19557,6 +19807,24 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
19557
19807
|
|
|
19558
19808
|
class.define_method("name", method!(SystemMessage::name, 0))?;
|
|
19559
19809
|
|
|
19810
|
+
let class = module.define_class("ThinkingBlock", ruby.class_object())?;
|
|
19811
|
+
|
|
19812
|
+
class.define_singleton_method("new", function!(ThinkingBlock::new, -1))?;
|
|
19813
|
+
|
|
19814
|
+
class.define_method("block_type", method!(ThinkingBlock::block_type, 0))?;
|
|
19815
|
+
|
|
19816
|
+
class.define_method("thinking", method!(ThinkingBlock::thinking, 0))?;
|
|
19817
|
+
|
|
19818
|
+
class.define_method("signature", method!(ThinkingBlock::signature, 0))?;
|
|
19819
|
+
|
|
19820
|
+
class.define_method("data", method!(ThinkingBlock::data, 0))?;
|
|
19821
|
+
|
|
19822
|
+
class.define_method("index", method!(ThinkingBlock::index, 0))?;
|
|
19823
|
+
|
|
19824
|
+
class.define_method("text_offset", method!(ThinkingBlock::text_offset, 0))?;
|
|
19825
|
+
|
|
19826
|
+
class.define_method("tool_call_offset", method!(ThinkingBlock::tool_call_offset, 0))?;
|
|
19827
|
+
|
|
19560
19828
|
let class = module.define_class("ToolCall", ruby.class_object())?;
|
|
19561
19829
|
|
|
19562
19830
|
class.define_singleton_method("new", function!(ToolCall::new, -1))?;
|
data/lib/liter_llm/version.rb
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# This file is auto-generated by alef — DO NOT EDIT.
|
|
2
|
-
# alef:hash:
|
|
2
|
+
# alef:hash:1c4582aaa2b6857b8e650fe07ef30deec63c7125999452b189c3f2c12d3f6a92
|
|
3
3
|
# To regenerate: alef generate
|
|
4
4
|
# To verify freshness: alef verify
|
|
5
5
|
# frozen_string_literal: true
|
|
6
6
|
|
|
7
7
|
module LiterLlm
|
|
8
8
|
## The version string for this package.
|
|
9
|
-
VERSION = "2.
|
|
9
|
+
VERSION = "2.7.0"
|
|
10
10
|
end
|
data/sig/types.rbs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# This file is auto-generated by alef — DO NOT EDIT.
|
|
2
|
-
# alef:hash:
|
|
2
|
+
# alef:hash:ed81ffec42d8fad4ad8077f3272931745cc8bf4541c0eff0e23a57605e16b011
|
|
3
3
|
# To regenerate: alef generate
|
|
4
4
|
# To verify freshness: alef verify
|
|
5
5
|
|
|
@@ -16,8 +16,9 @@ module LiterLlm
|
|
|
16
16
|
attr_reader refusal: String?
|
|
17
17
|
attr_reader function_call: FunctionCall?
|
|
18
18
|
attr_reader reasoning_content: String?
|
|
19
|
+
attr_reader thinking_blocks: Array[ThinkingBlock]?
|
|
19
20
|
|
|
20
|
-
def initialize: (?content: AssistantContent, ?name: String, ?tool_calls: Array[ToolCall], ?refusal: String, ?function_call: FunctionCall, ?reasoning_content: String) -> void
|
|
21
|
+
def initialize: (?content: AssistantContent, ?name: String, ?tool_calls: Array[ToolCall], ?refusal: String, ?function_call: FunctionCall, ?reasoning_content: String, ?thinking_blocks: Array[ThinkingBlock]) -> void
|
|
21
22
|
def text: () -> String?
|
|
22
23
|
def refusal_text: () -> String?
|
|
23
24
|
def reasoning_text: () -> String?
|
|
@@ -886,8 +887,9 @@ module LiterLlm
|
|
|
886
887
|
attr_reader function_call: StreamFunctionCall?
|
|
887
888
|
attr_reader refusal: String?
|
|
888
889
|
attr_reader reasoning_content: String?
|
|
890
|
+
attr_reader thinking_blocks: Array[ThinkingBlock]?
|
|
889
891
|
|
|
890
|
-
def initialize: (?role: String, ?content: String, ?tool_calls: Array[StreamToolCall], ?function_call: StreamFunctionCall, ?refusal: String, ?reasoning_content: String) -> void
|
|
892
|
+
def initialize: (?role: String, ?content: String, ?tool_calls: Array[StreamToolCall], ?function_call: StreamFunctionCall, ?refusal: String, ?reasoning_content: String, ?thinking_blocks: Array[ThinkingBlock]) -> void
|
|
891
893
|
end
|
|
892
894
|
|
|
893
895
|
class StreamFunctionCall
|
|
@@ -919,6 +921,18 @@ module LiterLlm
|
|
|
919
921
|
def initialize: (?content: UserContent, ?name: String) -> void
|
|
920
922
|
end
|
|
921
923
|
|
|
924
|
+
class ThinkingBlock
|
|
925
|
+
attr_reader block_type: String?
|
|
926
|
+
attr_reader thinking: String?
|
|
927
|
+
attr_reader signature: String?
|
|
928
|
+
attr_reader data: String?
|
|
929
|
+
attr_reader index: Integer?
|
|
930
|
+
attr_reader text_offset: Integer?
|
|
931
|
+
attr_reader tool_call_offset: Integer?
|
|
932
|
+
|
|
933
|
+
def initialize: (?block_type: String, ?thinking: String, ?signature: String, ?data: String, ?index: Integer, ?text_offset: Integer, ?tool_call_offset: Integer) -> void
|
|
934
|
+
end
|
|
935
|
+
|
|
922
936
|
class ToolCall
|
|
923
937
|
attr_reader id: String
|
|
924
938
|
attr_reader call_type: enum_ToolType
|