liter_llm 1.9.0 → 1.9.3
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/README.md +65 -65
- data/ext/liter_llm_rb/native/Cargo.lock +124 -289
- data/ext/liter_llm_rb/native/Cargo.toml +2 -2
- data/ext/liter_llm_rb/src/lib.rs +27 -119
- data/lib/liter_llm/native.rb +96 -48
- data/lib/liter_llm/version.rb +2 -2
- data/lib/liter_llm.rb +10 -1
- data/sig/types.rbs +585 -585
- metadata +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "liter-llm-rb"
|
|
3
|
-
version = "1.9.
|
|
3
|
+
version = "1.9.3"
|
|
4
4
|
edition = "2024"
|
|
5
5
|
license = "MIT"
|
|
6
6
|
description = "Universal LLM API client with Rust-powered polyglot bindings."
|
|
@@ -24,7 +24,7 @@ wasm-http = ["liter-llm/wasm-http"]
|
|
|
24
24
|
|
|
25
25
|
[dependencies]
|
|
26
26
|
futures = "0.3"
|
|
27
|
-
liter-llm = { version = "1.9.
|
|
27
|
+
liter-llm = { version = "1.9.3", features = ["native-http", "full"] }
|
|
28
28
|
magnus = "0.8"
|
|
29
29
|
rb-sys = ">=0.9, <0.9.128"
|
|
30
30
|
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:b34f5dac0a6af082b71cab3b75e126050fd38402a73d6d3ff06130b6fe7d8875
|
|
3
3
|
// Re-generate with: alef generate
|
|
4
4
|
#![allow(dead_code, unused_imports, unused_variables)]
|
|
5
5
|
#![allow(
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
clippy::useless_conversion,
|
|
19
19
|
clippy::clone_on_copy
|
|
20
20
|
)]
|
|
21
|
+
#![allow(clippy::single_match, clippy::collapsible_match)]
|
|
21
22
|
|
|
22
23
|
use futures::StreamExt as _;
|
|
23
24
|
use liter_llm::client::BatchClient;
|
|
@@ -101,10 +102,7 @@ unsafe impl TryConvertOwned for SystemMessage {}
|
|
|
101
102
|
|
|
102
103
|
impl Default for SystemMessage {
|
|
103
104
|
fn default() -> Self {
|
|
104
|
-
|
|
105
|
-
content: Default::default(),
|
|
106
|
-
name: None,
|
|
107
|
-
}
|
|
105
|
+
liter_llm::types::SystemMessage::default().into()
|
|
108
106
|
}
|
|
109
107
|
}
|
|
110
108
|
|
|
@@ -172,10 +170,7 @@ unsafe impl TryConvertOwned for UserMessage {}
|
|
|
172
170
|
|
|
173
171
|
impl Default for UserMessage {
|
|
174
172
|
fn default() -> Self {
|
|
175
|
-
|
|
176
|
-
content: Default::default(),
|
|
177
|
-
name: None,
|
|
178
|
-
}
|
|
173
|
+
liter_llm::types::UserMessage::default().into()
|
|
179
174
|
}
|
|
180
175
|
}
|
|
181
176
|
|
|
@@ -243,10 +238,7 @@ unsafe impl TryConvertOwned for ImageUrl {}
|
|
|
243
238
|
|
|
244
239
|
impl Default for ImageUrl {
|
|
245
240
|
fn default() -> Self {
|
|
246
|
-
|
|
247
|
-
url: String::new(),
|
|
248
|
-
detail: None,
|
|
249
|
-
}
|
|
241
|
+
liter_llm::types::ImageUrl::default().into()
|
|
250
242
|
}
|
|
251
243
|
}
|
|
252
244
|
|
|
@@ -455,13 +447,7 @@ unsafe impl TryConvertOwned for AssistantMessage {}
|
|
|
455
447
|
|
|
456
448
|
impl Default for AssistantMessage {
|
|
457
449
|
fn default() -> Self {
|
|
458
|
-
|
|
459
|
-
content: None,
|
|
460
|
-
name: None,
|
|
461
|
-
tool_calls: None,
|
|
462
|
-
refusal: None,
|
|
463
|
-
function_call: None,
|
|
464
|
-
}
|
|
450
|
+
liter_llm::types::AssistantMessage::default().into()
|
|
465
451
|
}
|
|
466
452
|
}
|
|
467
453
|
|
|
@@ -1141,10 +1127,7 @@ unsafe impl TryConvertOwned for SpecificToolChoice {}
|
|
|
1141
1127
|
|
|
1142
1128
|
impl Default for SpecificToolChoice {
|
|
1143
1129
|
fn default() -> Self {
|
|
1144
|
-
|
|
1145
|
-
choice_type: Default::default(),
|
|
1146
|
-
function: Default::default(),
|
|
1147
|
-
}
|
|
1130
|
+
liter_llm::types::SpecificToolChoice::default().into()
|
|
1148
1131
|
}
|
|
1149
1132
|
}
|
|
1150
1133
|
|
|
@@ -1532,29 +1515,7 @@ unsafe impl TryConvertOwned for ChatCompletionRequest {}
|
|
|
1532
1515
|
|
|
1533
1516
|
impl Default for ChatCompletionRequest {
|
|
1534
1517
|
fn default() -> Self {
|
|
1535
|
-
|
|
1536
|
-
model: String::new(),
|
|
1537
|
-
messages: vec![],
|
|
1538
|
-
temperature: None,
|
|
1539
|
-
top_p: None,
|
|
1540
|
-
n: None,
|
|
1541
|
-
stream: None,
|
|
1542
|
-
stop: None,
|
|
1543
|
-
max_tokens: None,
|
|
1544
|
-
presence_penalty: None,
|
|
1545
|
-
frequency_penalty: None,
|
|
1546
|
-
logit_bias: None,
|
|
1547
|
-
user: None,
|
|
1548
|
-
tools: None,
|
|
1549
|
-
tool_choice: None,
|
|
1550
|
-
parallel_tool_calls: None,
|
|
1551
|
-
response_format: None,
|
|
1552
|
-
stream_options: None,
|
|
1553
|
-
seed: None,
|
|
1554
|
-
reasoning_effort: None,
|
|
1555
|
-
modalities: None,
|
|
1556
|
-
extra_body: None,
|
|
1557
|
-
}
|
|
1518
|
+
liter_llm::types::ChatCompletionRequest::default().into()
|
|
1558
1519
|
}
|
|
1559
1520
|
}
|
|
1560
1521
|
|
|
@@ -1934,11 +1895,7 @@ unsafe impl TryConvertOwned for Choice {}
|
|
|
1934
1895
|
|
|
1935
1896
|
impl Default for Choice {
|
|
1936
1897
|
fn default() -> Self {
|
|
1937
|
-
|
|
1938
|
-
index: 0,
|
|
1939
|
-
message: Default::default(),
|
|
1940
|
-
finish_reason: None,
|
|
1941
|
-
}
|
|
1898
|
+
liter_llm::types::Choice::default().into()
|
|
1942
1899
|
}
|
|
1943
1900
|
}
|
|
1944
1901
|
|
|
@@ -2135,11 +2092,7 @@ unsafe impl TryConvertOwned for StreamChoice {}
|
|
|
2135
2092
|
|
|
2136
2093
|
impl Default for StreamChoice {
|
|
2137
2094
|
fn default() -> Self {
|
|
2138
|
-
|
|
2139
|
-
index: 0,
|
|
2140
|
-
delta: Default::default(),
|
|
2141
|
-
finish_reason: None,
|
|
2142
|
-
}
|
|
2095
|
+
liter_llm::types::StreamChoice::default().into()
|
|
2143
2096
|
}
|
|
2144
2097
|
}
|
|
2145
2098
|
|
|
@@ -2313,12 +2266,7 @@ unsafe impl TryConvertOwned for StreamToolCall {}
|
|
|
2313
2266
|
|
|
2314
2267
|
impl Default for StreamToolCall {
|
|
2315
2268
|
fn default() -> Self {
|
|
2316
|
-
|
|
2317
|
-
index: 0,
|
|
2318
|
-
id: None,
|
|
2319
|
-
call_type: None,
|
|
2320
|
-
function: None,
|
|
2321
|
-
}
|
|
2269
|
+
liter_llm::types::StreamToolCall::default().into()
|
|
2322
2270
|
}
|
|
2323
2271
|
}
|
|
2324
2272
|
|
|
@@ -2470,13 +2418,7 @@ unsafe impl TryConvertOwned for EmbeddingRequest {}
|
|
|
2470
2418
|
|
|
2471
2419
|
impl Default for EmbeddingRequest {
|
|
2472
2420
|
fn default() -> Self {
|
|
2473
|
-
|
|
2474
|
-
model: String::new(),
|
|
2475
|
-
input: Default::default(),
|
|
2476
|
-
encoding_format: None,
|
|
2477
|
-
dimensions: None,
|
|
2478
|
-
user: None,
|
|
2479
|
-
}
|
|
2421
|
+
liter_llm::types::EmbeddingRequest::default().into()
|
|
2480
2422
|
}
|
|
2481
2423
|
}
|
|
2482
2424
|
|
|
@@ -3420,10 +3362,7 @@ unsafe impl TryConvertOwned for ModerationRequest {}
|
|
|
3420
3362
|
|
|
3421
3363
|
impl Default for ModerationRequest {
|
|
3422
3364
|
fn default() -> Self {
|
|
3423
|
-
|
|
3424
|
-
input: Default::default(),
|
|
3425
|
-
model: None,
|
|
3426
|
-
}
|
|
3365
|
+
liter_llm::types::ModerationRequest::default().into()
|
|
3427
3366
|
}
|
|
3428
3367
|
}
|
|
3429
3368
|
|
|
@@ -3946,13 +3885,7 @@ unsafe impl TryConvertOwned for RerankRequest {}
|
|
|
3946
3885
|
|
|
3947
3886
|
impl Default for RerankRequest {
|
|
3948
3887
|
fn default() -> Self {
|
|
3949
|
-
|
|
3950
|
-
model: String::new(),
|
|
3951
|
-
query: String::new(),
|
|
3952
|
-
documents: vec![],
|
|
3953
|
-
top_n: None,
|
|
3954
|
-
return_documents: None,
|
|
3955
|
-
}
|
|
3888
|
+
liter_llm::types::RerankRequest::default().into()
|
|
3956
3889
|
}
|
|
3957
3890
|
}
|
|
3958
3891
|
|
|
@@ -4502,12 +4435,7 @@ unsafe impl TryConvertOwned for OcrRequest {}
|
|
|
4502
4435
|
|
|
4503
4436
|
impl Default for OcrRequest {
|
|
4504
4437
|
fn default() -> Self {
|
|
4505
|
-
|
|
4506
|
-
model: String::new(),
|
|
4507
|
-
document: Default::default(),
|
|
4508
|
-
pages: None,
|
|
4509
|
-
include_image_base64: None,
|
|
4510
|
-
}
|
|
4438
|
+
liter_llm::types::OcrRequest::default().into()
|
|
4511
4439
|
}
|
|
4512
4440
|
}
|
|
4513
4441
|
|
|
@@ -5048,11 +4976,7 @@ unsafe impl TryConvertOwned for CreateFileRequest {}
|
|
|
5048
4976
|
|
|
5049
4977
|
impl Default for CreateFileRequest {
|
|
5050
4978
|
fn default() -> Self {
|
|
5051
|
-
|
|
5052
|
-
file: String::new(),
|
|
5053
|
-
purpose: Default::default(),
|
|
5054
|
-
filename: None,
|
|
5055
|
-
}
|
|
4979
|
+
liter_llm::types::CreateFileRequest::default().into()
|
|
5056
4980
|
}
|
|
5057
4981
|
}
|
|
5058
4982
|
|
|
@@ -5569,22 +5493,7 @@ unsafe impl TryConvertOwned for BatchObject {}
|
|
|
5569
5493
|
|
|
5570
5494
|
impl Default for BatchObject {
|
|
5571
5495
|
fn default() -> Self {
|
|
5572
|
-
|
|
5573
|
-
id: String::new(),
|
|
5574
|
-
object: String::new(),
|
|
5575
|
-
endpoint: String::new(),
|
|
5576
|
-
input_file_id: String::new(),
|
|
5577
|
-
completion_window: String::new(),
|
|
5578
|
-
status: Default::default(),
|
|
5579
|
-
output_file_id: None,
|
|
5580
|
-
error_file_id: None,
|
|
5581
|
-
created_at: 0,
|
|
5582
|
-
completed_at: None,
|
|
5583
|
-
failed_at: None,
|
|
5584
|
-
expired_at: None,
|
|
5585
|
-
request_counts: None,
|
|
5586
|
-
metadata: None,
|
|
5587
|
-
}
|
|
5496
|
+
liter_llm::types::BatchObject::default().into()
|
|
5588
5497
|
}
|
|
5589
5498
|
}
|
|
5590
5499
|
|
|
@@ -7379,11 +7288,7 @@ unsafe impl TryConvertOwned for BudgetConfig {}
|
|
|
7379
7288
|
|
|
7380
7289
|
impl Default for BudgetConfig {
|
|
7381
7290
|
fn default() -> Self {
|
|
7382
|
-
|
|
7383
|
-
global_limit: None,
|
|
7384
|
-
model_limits: Default::default(),
|
|
7385
|
-
enforcement: Enforcement::Hard,
|
|
7386
|
-
}
|
|
7291
|
+
liter_llm::BudgetConfig::default().into()
|
|
7387
7292
|
}
|
|
7388
7293
|
}
|
|
7389
7294
|
|
|
@@ -11133,7 +11038,7 @@ impl From<liter_llm::types::UserContent> for UserContent {
|
|
|
11133
11038
|
impl From<ContentPart> for liter_llm::types::ContentPart {
|
|
11134
11039
|
fn from(val: ContentPart) -> Self {
|
|
11135
11040
|
match val {
|
|
11136
|
-
ContentPart::Text { text } => Self::Text { text },
|
|
11041
|
+
ContentPart::Text { text } => Self::Text { text: text },
|
|
11137
11042
|
ContentPart::ImageUrl { image_url } => Self::ImageUrl {
|
|
11138
11043
|
image_url: image_url.into(),
|
|
11139
11044
|
},
|
|
@@ -11205,8 +11110,8 @@ impl From<liter_llm::types::AssistantContent> for AssistantContent {
|
|
|
11205
11110
|
impl From<AssistantPart> for liter_llm::types::AssistantPart {
|
|
11206
11111
|
fn from(val: AssistantPart) -> Self {
|
|
11207
11112
|
match val {
|
|
11208
|
-
AssistantPart::Text { text } => Self::Text { text },
|
|
11209
|
-
AssistantPart::Refusal { refusal } => Self::Refusal { refusal },
|
|
11113
|
+
AssistantPart::Text { text } => Self::Text { text: text },
|
|
11114
|
+
AssistantPart::Refusal { refusal } => Self::Refusal { refusal: refusal },
|
|
11210
11115
|
AssistantPart::OutputImage { image_url } => Self::OutputImage {
|
|
11211
11116
|
image_url: image_url.into(),
|
|
11212
11117
|
},
|
|
@@ -11450,7 +11355,7 @@ impl From<RerankDocument> for liter_llm::types::RerankDocument {
|
|
|
11450
11355
|
fn from(val: RerankDocument) -> Self {
|
|
11451
11356
|
match val {
|
|
11452
11357
|
RerankDocument::Text(_0) => Self::Text(_0),
|
|
11453
|
-
RerankDocument::Object { text } => Self::Object { text },
|
|
11358
|
+
RerankDocument::Object { text } => Self::Object { text: text },
|
|
11454
11359
|
}
|
|
11455
11360
|
}
|
|
11456
11361
|
}
|
|
@@ -11467,8 +11372,11 @@ impl From<liter_llm::types::RerankDocument> for RerankDocument {
|
|
|
11467
11372
|
impl From<OcrDocument> for liter_llm::types::OcrDocument {
|
|
11468
11373
|
fn from(val: OcrDocument) -> Self {
|
|
11469
11374
|
match val {
|
|
11470
|
-
OcrDocument::Url { url } => Self::Url { url },
|
|
11471
|
-
OcrDocument::Base64 { data, media_type } => Self::Base64 {
|
|
11375
|
+
OcrDocument::Url { url } => Self::Url { url: url },
|
|
11376
|
+
OcrDocument::Base64 { data, media_type } => Self::Base64 {
|
|
11377
|
+
data: data,
|
|
11378
|
+
media_type: media_type,
|
|
11379
|
+
},
|
|
11472
11380
|
}
|
|
11473
11381
|
}
|
|
11474
11382
|
}
|
data/lib/liter_llm/native.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# This file is auto-generated by alef — DO NOT EDIT.
|
|
2
|
-
# alef:hash:
|
|
2
|
+
# alef:hash:b34f5dac0a6af082b71cab3b75e126050fd38402a73d6d3ff06130b6fe7d8875
|
|
3
3
|
# To regenerate: alef generate
|
|
4
4
|
# To verify freshness: alef verify --exit-code
|
|
5
5
|
# frozen_string_literal: true
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
require "json"
|
|
8
8
|
require "sorbet-runtime"
|
|
9
9
|
require "liter_llm_rb"
|
|
10
|
+
|
|
10
11
|
module LiterLlm
|
|
11
12
|
# A chat message in a conversation.
|
|
12
13
|
module Message
|
|
@@ -22,13 +23,20 @@ module LiterLlm
|
|
|
22
23
|
def self.from_hash(hash)
|
|
23
24
|
discriminator = hash[:role] || hash["role"]
|
|
24
25
|
case discriminator
|
|
25
|
-
when "system"
|
|
26
|
-
|
|
27
|
-
when "
|
|
28
|
-
|
|
29
|
-
when "
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
when "system"
|
|
27
|
+
MessageSystem.from_hash(hash)
|
|
28
|
+
when "user"
|
|
29
|
+
MessageUser.from_hash(hash)
|
|
30
|
+
when "assistant"
|
|
31
|
+
MessageAssistant.from_hash(hash)
|
|
32
|
+
when "tool"
|
|
33
|
+
MessageTool.from_hash(hash)
|
|
34
|
+
when "developer"
|
|
35
|
+
MessageDeveloper.from_hash(hash)
|
|
36
|
+
when "function"
|
|
37
|
+
MessageFunction.from_hash(hash)
|
|
38
|
+
else
|
|
39
|
+
raise "Unknown discriminator: #{discriminator}"
|
|
32
40
|
end
|
|
33
41
|
end
|
|
34
42
|
end
|
|
@@ -39,7 +47,8 @@ module LiterLlm
|
|
|
39
47
|
|
|
40
48
|
# @return [SystemMessage]
|
|
41
49
|
sig { returns(SystemMessage) }
|
|
42
|
-
|
|
50
|
+
# rubocop:disable Lint/UselessMethodDefinition
|
|
51
|
+
def value = super
|
|
43
52
|
sig { returns(T::Boolean) }
|
|
44
53
|
def system? = true
|
|
45
54
|
sig { returns(T::Boolean) }
|
|
@@ -66,7 +75,8 @@ module LiterLlm
|
|
|
66
75
|
|
|
67
76
|
# @return [UserMessage]
|
|
68
77
|
sig { returns(UserMessage) }
|
|
69
|
-
|
|
78
|
+
# rubocop:disable Lint/UselessMethodDefinition
|
|
79
|
+
def value = super
|
|
70
80
|
sig { returns(T::Boolean) }
|
|
71
81
|
def system? = false
|
|
72
82
|
sig { returns(T::Boolean) }
|
|
@@ -93,7 +103,8 @@ module LiterLlm
|
|
|
93
103
|
|
|
94
104
|
# @return [AssistantMessage]
|
|
95
105
|
sig { returns(AssistantMessage) }
|
|
96
|
-
|
|
106
|
+
# rubocop:disable Lint/UselessMethodDefinition
|
|
107
|
+
def value = super
|
|
97
108
|
sig { returns(T::Boolean) }
|
|
98
109
|
def system? = false
|
|
99
110
|
sig { returns(T::Boolean) }
|
|
@@ -120,7 +131,8 @@ module LiterLlm
|
|
|
120
131
|
|
|
121
132
|
# @return [ToolMessage]
|
|
122
133
|
sig { returns(ToolMessage) }
|
|
123
|
-
|
|
134
|
+
# rubocop:disable Lint/UselessMethodDefinition
|
|
135
|
+
def value = super
|
|
124
136
|
sig { returns(T::Boolean) }
|
|
125
137
|
def system? = false
|
|
126
138
|
sig { returns(T::Boolean) }
|
|
@@ -147,7 +159,8 @@ module LiterLlm
|
|
|
147
159
|
|
|
148
160
|
# @return [DeveloperMessage]
|
|
149
161
|
sig { returns(DeveloperMessage) }
|
|
150
|
-
|
|
162
|
+
# rubocop:disable Lint/UselessMethodDefinition
|
|
163
|
+
def value = super
|
|
151
164
|
sig { returns(T::Boolean) }
|
|
152
165
|
def system? = false
|
|
153
166
|
sig { returns(T::Boolean) }
|
|
@@ -174,7 +187,8 @@ module LiterLlm
|
|
|
174
187
|
|
|
175
188
|
# @return [FunctionMessage]
|
|
176
189
|
sig { returns(FunctionMessage) }
|
|
177
|
-
|
|
190
|
+
# rubocop:disable Lint/UselessMethodDefinition
|
|
191
|
+
def value = super
|
|
178
192
|
sig { returns(T::Boolean) }
|
|
179
193
|
def system? = false
|
|
180
194
|
sig { returns(T::Boolean) }
|
|
@@ -211,11 +225,16 @@ module LiterLlm
|
|
|
211
225
|
def self.from_hash(hash)
|
|
212
226
|
discriminator = hash[:type] || hash["type"]
|
|
213
227
|
case discriminator
|
|
214
|
-
when "text"
|
|
215
|
-
|
|
216
|
-
when "
|
|
217
|
-
|
|
218
|
-
|
|
228
|
+
when "text"
|
|
229
|
+
ContentPartText.from_hash(hash)
|
|
230
|
+
when "image_url"
|
|
231
|
+
ContentPartImageUrl.from_hash(hash)
|
|
232
|
+
when "document"
|
|
233
|
+
ContentPartDocument.from_hash(hash)
|
|
234
|
+
when "input_audio"
|
|
235
|
+
ContentPartInputAudio.from_hash(hash)
|
|
236
|
+
else
|
|
237
|
+
raise "Unknown discriminator: #{discriminator}"
|
|
219
238
|
end
|
|
220
239
|
end
|
|
221
240
|
end
|
|
@@ -226,7 +245,8 @@ module LiterLlm
|
|
|
226
245
|
|
|
227
246
|
# @return [String]
|
|
228
247
|
sig { returns(String) }
|
|
229
|
-
|
|
248
|
+
# rubocop:disable Lint/UselessMethodDefinition
|
|
249
|
+
def text = super
|
|
230
250
|
sig { returns(T::Boolean) }
|
|
231
251
|
def text? = true
|
|
232
252
|
sig { returns(T::Boolean) }
|
|
@@ -249,7 +269,8 @@ module LiterLlm
|
|
|
249
269
|
|
|
250
270
|
# @return [ImageUrl]
|
|
251
271
|
sig { returns(ImageUrl) }
|
|
252
|
-
|
|
272
|
+
# rubocop:disable Lint/UselessMethodDefinition
|
|
273
|
+
def image_url = super
|
|
253
274
|
sig { returns(T::Boolean) }
|
|
254
275
|
def text? = false
|
|
255
276
|
sig { returns(T::Boolean) }
|
|
@@ -272,7 +293,8 @@ module LiterLlm
|
|
|
272
293
|
|
|
273
294
|
# @return [DocumentContent]
|
|
274
295
|
sig { returns(DocumentContent) }
|
|
275
|
-
|
|
296
|
+
# rubocop:disable Lint/UselessMethodDefinition
|
|
297
|
+
def document = super
|
|
276
298
|
sig { returns(T::Boolean) }
|
|
277
299
|
def text? = false
|
|
278
300
|
sig { returns(T::Boolean) }
|
|
@@ -295,7 +317,8 @@ module LiterLlm
|
|
|
295
317
|
|
|
296
318
|
# @return [AudioContent]
|
|
297
319
|
sig { returns(AudioContent) }
|
|
298
|
-
|
|
320
|
+
# rubocop:disable Lint/UselessMethodDefinition
|
|
321
|
+
def input_audio = super
|
|
299
322
|
sig { returns(T::Boolean) }
|
|
300
323
|
def text? = false
|
|
301
324
|
sig { returns(T::Boolean) }
|
|
@@ -331,11 +354,16 @@ module LiterLlm
|
|
|
331
354
|
def self.from_hash(hash)
|
|
332
355
|
discriminator = hash[:type] || hash["type"]
|
|
333
356
|
case discriminator
|
|
334
|
-
when "text"
|
|
335
|
-
|
|
336
|
-
when "
|
|
337
|
-
|
|
338
|
-
|
|
357
|
+
when "text"
|
|
358
|
+
AssistantPartText.from_hash(hash)
|
|
359
|
+
when "refusal"
|
|
360
|
+
AssistantPartRefusal.from_hash(hash)
|
|
361
|
+
when "output_image"
|
|
362
|
+
AssistantPartOutputImage.from_hash(hash)
|
|
363
|
+
when "output_audio"
|
|
364
|
+
AssistantPartOutputAudio.from_hash(hash)
|
|
365
|
+
else
|
|
366
|
+
raise "Unknown discriminator: #{discriminator}"
|
|
339
367
|
end
|
|
340
368
|
end
|
|
341
369
|
end
|
|
@@ -346,7 +374,8 @@ module LiterLlm
|
|
|
346
374
|
|
|
347
375
|
# The text content of this part.
|
|
348
376
|
sig { returns(String) }
|
|
349
|
-
|
|
377
|
+
# rubocop:disable Lint/UselessMethodDefinition
|
|
378
|
+
def text = super
|
|
350
379
|
sig { returns(T::Boolean) }
|
|
351
380
|
def text? = true
|
|
352
381
|
sig { returns(T::Boolean) }
|
|
@@ -369,7 +398,8 @@ module LiterLlm
|
|
|
369
398
|
|
|
370
399
|
# The refusal reason.
|
|
371
400
|
sig { returns(String) }
|
|
372
|
-
|
|
401
|
+
# rubocop:disable Lint/UselessMethodDefinition
|
|
402
|
+
def refusal = super
|
|
373
403
|
sig { returns(T::Boolean) }
|
|
374
404
|
def text? = false
|
|
375
405
|
sig { returns(T::Boolean) }
|
|
@@ -392,7 +422,8 @@ module LiterLlm
|
|
|
392
422
|
|
|
393
423
|
# Image URL or data URI referencing the generated image.
|
|
394
424
|
sig { returns(ImageUrl) }
|
|
395
|
-
|
|
425
|
+
# rubocop:disable Lint/UselessMethodDefinition
|
|
426
|
+
def image_url = super
|
|
396
427
|
sig { returns(T::Boolean) }
|
|
397
428
|
def text? = false
|
|
398
429
|
sig { returns(T::Boolean) }
|
|
@@ -415,7 +446,8 @@ module LiterLlm
|
|
|
415
446
|
|
|
416
447
|
# Base64-encoded audio data and its format.
|
|
417
448
|
sig { returns(AudioContent) }
|
|
418
|
-
|
|
449
|
+
# rubocop:disable Lint/UselessMethodDefinition
|
|
450
|
+
def audio = super
|
|
419
451
|
sig { returns(T::Boolean) }
|
|
420
452
|
def text? = false
|
|
421
453
|
sig { returns(T::Boolean) }
|
|
@@ -463,10 +495,14 @@ module LiterLlm
|
|
|
463
495
|
def self.from_hash(hash)
|
|
464
496
|
discriminator = hash[:type] || hash["type"]
|
|
465
497
|
case discriminator
|
|
466
|
-
when "text"
|
|
467
|
-
|
|
468
|
-
when "
|
|
469
|
-
|
|
498
|
+
when "text"
|
|
499
|
+
ResponseFormatText.from_hash(hash)
|
|
500
|
+
when "json_object"
|
|
501
|
+
ResponseFormatJsonObject.from_hash(hash)
|
|
502
|
+
when "json_schema"
|
|
503
|
+
ResponseFormatJsonSchema.from_hash(hash)
|
|
504
|
+
else
|
|
505
|
+
raise "Unknown discriminator: #{discriminator}"
|
|
470
506
|
end
|
|
471
507
|
end
|
|
472
508
|
end
|
|
@@ -513,7 +549,8 @@ module LiterLlm
|
|
|
513
549
|
|
|
514
550
|
# @return [JsonSchemaFormat]
|
|
515
551
|
sig { returns(JsonSchemaFormat) }
|
|
516
|
-
|
|
552
|
+
# rubocop:disable Lint/UselessMethodDefinition
|
|
553
|
+
def json_schema = super
|
|
517
554
|
sig { returns(T::Boolean) }
|
|
518
555
|
def text? = false
|
|
519
556
|
sig { returns(T::Boolean) }
|
|
@@ -544,9 +581,12 @@ module LiterLlm
|
|
|
544
581
|
def self.from_hash(hash)
|
|
545
582
|
discriminator = hash[:type] || hash["type"]
|
|
546
583
|
case discriminator
|
|
547
|
-
when "document_url"
|
|
548
|
-
|
|
549
|
-
|
|
584
|
+
when "document_url"
|
|
585
|
+
OcrDocumentUrl.from_hash(hash)
|
|
586
|
+
when "base64"
|
|
587
|
+
OcrDocumentBase64.from_hash(hash)
|
|
588
|
+
else
|
|
589
|
+
raise "Unknown discriminator: #{discriminator}"
|
|
550
590
|
end
|
|
551
591
|
end
|
|
552
592
|
end
|
|
@@ -557,7 +597,8 @@ module LiterLlm
|
|
|
557
597
|
|
|
558
598
|
# The document URL (HTTP/HTTPS).
|
|
559
599
|
sig { returns(String) }
|
|
560
|
-
|
|
600
|
+
# rubocop:disable Lint/UselessMethodDefinition
|
|
601
|
+
def url = super
|
|
561
602
|
sig { returns(T::Boolean) }
|
|
562
603
|
def url? = true
|
|
563
604
|
sig { returns(T::Boolean) }
|
|
@@ -576,10 +617,12 @@ module LiterLlm
|
|
|
576
617
|
|
|
577
618
|
# Base64-encoded document content.
|
|
578
619
|
sig { returns(String) }
|
|
579
|
-
|
|
620
|
+
# rubocop:disable Lint/UselessMethodDefinition
|
|
621
|
+
def data = super
|
|
580
622
|
# MIME type (e.g. `"application/pdf"`, `"image/png"`, `"image/jpeg"`).
|
|
581
623
|
sig { returns(String) }
|
|
582
|
-
|
|
624
|
+
# rubocop:disable Lint/UselessMethodDefinition
|
|
625
|
+
def media_type = super
|
|
583
626
|
sig { returns(T::Boolean) }
|
|
584
627
|
def url? = false
|
|
585
628
|
sig { returns(T::Boolean) }
|
|
@@ -608,9 +651,12 @@ module LiterLlm
|
|
|
608
651
|
def self.from_hash(hash)
|
|
609
652
|
discriminator = hash[:type] || hash["type"]
|
|
610
653
|
case discriminator
|
|
611
|
-
when "memory"
|
|
612
|
-
|
|
613
|
-
|
|
654
|
+
when "memory"
|
|
655
|
+
CacheBackendMemory.from_hash(hash)
|
|
656
|
+
when "open_dal"
|
|
657
|
+
CacheBackendOpenDal.from_hash(hash)
|
|
658
|
+
else
|
|
659
|
+
raise "Unknown discriminator: #{discriminator}"
|
|
614
660
|
end
|
|
615
661
|
end
|
|
616
662
|
end
|
|
@@ -637,10 +683,12 @@ module LiterLlm
|
|
|
637
683
|
|
|
638
684
|
# OpenDAL scheme name (e.g. "s3", "redis", "fs", "gcs", "azblob").
|
|
639
685
|
sig { returns(String) }
|
|
640
|
-
|
|
686
|
+
# rubocop:disable Lint/UselessMethodDefinition
|
|
687
|
+
def scheme = super
|
|
641
688
|
# Backend-specific configuration as key-value pairs passed to OpenDAL.
|
|
642
689
|
sig { returns(T::Hash[String, String]) }
|
|
643
|
-
|
|
690
|
+
# rubocop:disable Lint/UselessMethodDefinition
|
|
691
|
+
def config = super
|
|
644
692
|
sig { returns(T::Boolean) }
|
|
645
693
|
def memory? = false
|
|
646
694
|
sig { returns(T::Boolean) }
|
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:b34f5dac0a6af082b71cab3b75e126050fd38402a73d6d3ff06130b6fe7d8875
|
|
3
3
|
# To regenerate: alef generate
|
|
4
4
|
# To verify freshness: alef verify --exit-code
|
|
5
5
|
# frozen_string_literal: true
|
|
6
6
|
|
|
7
7
|
module LiterLlm
|
|
8
8
|
## The version string for this package.
|
|
9
|
-
VERSION = "1.9.
|
|
9
|
+
VERSION = "1.9.3"
|
|
10
10
|
end
|
data/lib/liter_llm.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# This file is auto-generated by alef — DO NOT EDIT.
|
|
2
|
-
# alef:hash:
|
|
2
|
+
# alef:hash:b34f5dac0a6af082b71cab3b75e126050fd38402a73d6d3ff06130b6fe7d8875
|
|
3
3
|
# To regenerate: alef generate
|
|
4
4
|
# To verify freshness: alef verify --exit-code
|
|
5
5
|
# frozen_string_literal: true
|
|
@@ -16,3 +16,12 @@ require_relative "liter_llm/native"
|
|
|
16
16
|
module LiterLlm
|
|
17
17
|
# Re-export all types and functions from native extension
|
|
18
18
|
end
|
|
19
|
+
|
|
20
|
+
# Bring top-level LiterLlm classes into the global namespace so callers
|
|
21
|
+
# (and the generated e2e suite) can reference them unqualified. The native
|
|
22
|
+
# extension has already been required above, so every type constant is defined
|
|
23
|
+
# under LiterLlm by this point.
|
|
24
|
+
LiterLlm.constants.each do |const_name|
|
|
25
|
+
value = LiterLlm.const_get(const_name)
|
|
26
|
+
::Object.const_set(const_name, value) if value.is_a?(Module) && !::Object.const_defined?(const_name)
|
|
27
|
+
end
|