liter_llm 1.9.3 → 1.10.1
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 +7 -7
- data/ext/liter_llm_rb/native/Cargo.lock +6 -5
- data/ext/liter_llm_rb/native/Cargo.toml +2 -2
- data/ext/liter_llm_rb/src/lib.rs +1155 -33
- data/lib/liter_llm/native.rb +48 -96
- data/lib/liter_llm/version.rb +2 -2
- data/lib/liter_llm.rb +1 -1
- data/sig/types.rbs +645 -586
- metadata +2 -5
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:f2d02d39ed23b63568387f22c991c70fd7b0d5c8f2f92cc028dcbaff825ca583
|
|
3
3
|
// Re-generate with: alef generate
|
|
4
4
|
#![allow(dead_code, unused_imports, unused_variables)]
|
|
5
5
|
#![allow(
|
|
@@ -497,6 +497,7 @@ impl AssistantMessage {
|
|
|
497
497
|
}
|
|
498
498
|
|
|
499
499
|
fn text(&self) -> Option<String> {
|
|
500
|
+
#[allow(clippy::needless_update)]
|
|
500
501
|
let core_self = liter_llm::types::AssistantMessage {
|
|
501
502
|
content: self.content.clone().map(Into::into),
|
|
502
503
|
|
|
@@ -507,11 +508,14 @@ impl AssistantMessage {
|
|
|
507
508
|
refusal: self.refusal.clone(),
|
|
508
509
|
|
|
509
510
|
function_call: self.function_call.clone().map(Into::into),
|
|
511
|
+
|
|
512
|
+
..Default::default()
|
|
510
513
|
};
|
|
511
514
|
core_self.text()
|
|
512
515
|
}
|
|
513
516
|
|
|
514
517
|
fn refusal_text(&self) -> Option<String> {
|
|
518
|
+
#[allow(clippy::needless_update)]
|
|
515
519
|
let core_self = liter_llm::types::AssistantMessage {
|
|
516
520
|
content: self.content.clone().map(Into::into),
|
|
517
521
|
|
|
@@ -522,11 +526,14 @@ impl AssistantMessage {
|
|
|
522
526
|
refusal: self.refusal.clone(),
|
|
523
527
|
|
|
524
528
|
function_call: self.function_call.clone().map(Into::into),
|
|
529
|
+
|
|
530
|
+
..Default::default()
|
|
525
531
|
};
|
|
526
532
|
core_self.refusal_text().map(|v| v.to_owned())
|
|
527
533
|
}
|
|
528
534
|
|
|
529
535
|
fn output_images(&self) -> Vec<ImageUrl> {
|
|
536
|
+
#[allow(clippy::needless_update)]
|
|
530
537
|
let core_self = liter_llm::types::AssistantMessage {
|
|
531
538
|
content: self.content.clone().map(Into::into),
|
|
532
539
|
|
|
@@ -537,11 +544,14 @@ impl AssistantMessage {
|
|
|
537
544
|
refusal: self.refusal.clone(),
|
|
538
545
|
|
|
539
546
|
function_call: self.function_call.clone().map(Into::into),
|
|
547
|
+
|
|
548
|
+
..Default::default()
|
|
540
549
|
};
|
|
541
550
|
core_self.output_images().into_iter().map(Into::into).collect()
|
|
542
551
|
}
|
|
543
552
|
|
|
544
553
|
fn output_audio(&self) -> Vec<AudioContent> {
|
|
554
|
+
#[allow(clippy::needless_update)]
|
|
545
555
|
let core_self = liter_llm::types::AssistantMessage {
|
|
546
556
|
content: self.content.clone().map(Into::into),
|
|
547
557
|
|
|
@@ -552,6 +562,8 @@ impl AssistantMessage {
|
|
|
552
562
|
refusal: self.refusal.clone(),
|
|
553
563
|
|
|
554
564
|
function_call: self.function_call.clone().map(Into::into),
|
|
565
|
+
|
|
566
|
+
..Default::default()
|
|
555
567
|
};
|
|
556
568
|
core_self.output_audio().into_iter().map(Into::into).collect()
|
|
557
569
|
}
|
|
@@ -7249,6 +7261,330 @@ impl AuthConfig {
|
|
|
7249
7261
|
}
|
|
7250
7262
|
}
|
|
7251
7263
|
|
|
7264
|
+
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
7265
|
+
#[serde(default)]
|
|
7266
|
+
#[magnus::wrap(class = "LiterLlm::ModelInfo")]
|
|
7267
|
+
pub struct ModelInfo {
|
|
7268
|
+
input_cost_per_token: f64,
|
|
7269
|
+
output_cost_per_token: f64,
|
|
7270
|
+
cache_read_input_token_cost: Option<f64>,
|
|
7271
|
+
cache_creation_input_token_cost: Option<f64>,
|
|
7272
|
+
input_cost_per_audio_token: Option<f64>,
|
|
7273
|
+
output_cost_per_audio_token: Option<f64>,
|
|
7274
|
+
output_cost_per_reasoning_token: Option<f64>,
|
|
7275
|
+
max_tokens: Option<u64>,
|
|
7276
|
+
max_input_tokens: Option<u64>,
|
|
7277
|
+
max_output_tokens: Option<u64>,
|
|
7278
|
+
mode: Option<String>,
|
|
7279
|
+
supports_vision: Option<bool>,
|
|
7280
|
+
supports_function_calling: Option<bool>,
|
|
7281
|
+
supports_reasoning: Option<bool>,
|
|
7282
|
+
supports_structured_output: Option<bool>,
|
|
7283
|
+
supports_audio_input: Option<bool>,
|
|
7284
|
+
supports_audio_output: Option<bool>,
|
|
7285
|
+
supports_prompt_caching: Option<bool>,
|
|
7286
|
+
tiers: Vec<ModelTier>,
|
|
7287
|
+
}
|
|
7288
|
+
|
|
7289
|
+
unsafe impl IntoValueFromNative for ModelInfo {}
|
|
7290
|
+
|
|
7291
|
+
impl magnus::TryConvert for ModelInfo {
|
|
7292
|
+
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
7293
|
+
if let Ok(r) = <&ModelInfo as magnus::TryConvert>::try_convert(val) {
|
|
7294
|
+
return Ok(r.clone());
|
|
7295
|
+
}
|
|
7296
|
+
let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
|
|
7297
|
+
s
|
|
7298
|
+
} else {
|
|
7299
|
+
val.funcall::<_, _, String>("to_json", ()).map_err(|e| {
|
|
7300
|
+
magnus::Error::new(
|
|
7301
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
7302
|
+
format!("no implicit conversion into ModelInfo: {}", e),
|
|
7303
|
+
)
|
|
7304
|
+
})?
|
|
7305
|
+
};
|
|
7306
|
+
serde_json::from_str::<ModelInfo>(&json_str).map_err(|e| {
|
|
7307
|
+
magnus::Error::new(
|
|
7308
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
7309
|
+
format!("failed to deserialize ModelInfo: {}", e),
|
|
7310
|
+
)
|
|
7311
|
+
})
|
|
7312
|
+
}
|
|
7313
|
+
}
|
|
7314
|
+
|
|
7315
|
+
unsafe impl TryConvertOwned for ModelInfo {}
|
|
7316
|
+
|
|
7317
|
+
impl Default for ModelInfo {
|
|
7318
|
+
fn default() -> Self {
|
|
7319
|
+
liter_llm::ModelInfo::default().into()
|
|
7320
|
+
}
|
|
7321
|
+
}
|
|
7322
|
+
|
|
7323
|
+
impl ModelInfo {
|
|
7324
|
+
fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
|
|
7325
|
+
let ruby = unsafe { magnus::Ruby::get_unchecked() };
|
|
7326
|
+
let args = magnus::scan_args::scan_args::<(), (Option<magnus::RHash>,), (), (), (), ()>(args)?;
|
|
7327
|
+
let (kwargs_opt,) = args.optional;
|
|
7328
|
+
let kwargs = kwargs_opt.unwrap_or_else(|| ruby.hash_new());
|
|
7329
|
+
Ok(Self {
|
|
7330
|
+
input_cost_per_token: kwargs
|
|
7331
|
+
.get(ruby.to_symbol("input_cost_per_token"))
|
|
7332
|
+
.and_then(|v| f64::try_convert(v).ok())
|
|
7333
|
+
.unwrap_or_default(),
|
|
7334
|
+
output_cost_per_token: kwargs
|
|
7335
|
+
.get(ruby.to_symbol("output_cost_per_token"))
|
|
7336
|
+
.and_then(|v| f64::try_convert(v).ok())
|
|
7337
|
+
.unwrap_or_default(),
|
|
7338
|
+
cache_read_input_token_cost: kwargs
|
|
7339
|
+
.get(ruby.to_symbol("cache_read_input_token_cost"))
|
|
7340
|
+
.and_then(|v| f64::try_convert(v).ok()),
|
|
7341
|
+
cache_creation_input_token_cost: kwargs
|
|
7342
|
+
.get(ruby.to_symbol("cache_creation_input_token_cost"))
|
|
7343
|
+
.and_then(|v| f64::try_convert(v).ok()),
|
|
7344
|
+
input_cost_per_audio_token: kwargs
|
|
7345
|
+
.get(ruby.to_symbol("input_cost_per_audio_token"))
|
|
7346
|
+
.and_then(|v| f64::try_convert(v).ok()),
|
|
7347
|
+
output_cost_per_audio_token: kwargs
|
|
7348
|
+
.get(ruby.to_symbol("output_cost_per_audio_token"))
|
|
7349
|
+
.and_then(|v| f64::try_convert(v).ok()),
|
|
7350
|
+
output_cost_per_reasoning_token: kwargs
|
|
7351
|
+
.get(ruby.to_symbol("output_cost_per_reasoning_token"))
|
|
7352
|
+
.and_then(|v| f64::try_convert(v).ok()),
|
|
7353
|
+
max_tokens: kwargs
|
|
7354
|
+
.get(ruby.to_symbol("max_tokens"))
|
|
7355
|
+
.and_then(|v| u64::try_convert(v).ok()),
|
|
7356
|
+
max_input_tokens: kwargs
|
|
7357
|
+
.get(ruby.to_symbol("max_input_tokens"))
|
|
7358
|
+
.and_then(|v| u64::try_convert(v).ok()),
|
|
7359
|
+
max_output_tokens: kwargs
|
|
7360
|
+
.get(ruby.to_symbol("max_output_tokens"))
|
|
7361
|
+
.and_then(|v| u64::try_convert(v).ok()),
|
|
7362
|
+
mode: kwargs
|
|
7363
|
+
.get(ruby.to_symbol("mode"))
|
|
7364
|
+
.and_then(|v| String::try_convert(v).ok()),
|
|
7365
|
+
supports_vision: kwargs
|
|
7366
|
+
.get(ruby.to_symbol("supports_vision"))
|
|
7367
|
+
.and_then(|v| bool::try_convert(v).ok()),
|
|
7368
|
+
supports_function_calling: kwargs
|
|
7369
|
+
.get(ruby.to_symbol("supports_function_calling"))
|
|
7370
|
+
.and_then(|v| bool::try_convert(v).ok()),
|
|
7371
|
+
supports_reasoning: kwargs
|
|
7372
|
+
.get(ruby.to_symbol("supports_reasoning"))
|
|
7373
|
+
.and_then(|v| bool::try_convert(v).ok()),
|
|
7374
|
+
supports_structured_output: kwargs
|
|
7375
|
+
.get(ruby.to_symbol("supports_structured_output"))
|
|
7376
|
+
.and_then(|v| bool::try_convert(v).ok()),
|
|
7377
|
+
supports_audio_input: kwargs
|
|
7378
|
+
.get(ruby.to_symbol("supports_audio_input"))
|
|
7379
|
+
.and_then(|v| bool::try_convert(v).ok()),
|
|
7380
|
+
supports_audio_output: kwargs
|
|
7381
|
+
.get(ruby.to_symbol("supports_audio_output"))
|
|
7382
|
+
.and_then(|v| bool::try_convert(v).ok()),
|
|
7383
|
+
supports_prompt_caching: kwargs
|
|
7384
|
+
.get(ruby.to_symbol("supports_prompt_caching"))
|
|
7385
|
+
.and_then(|v| bool::try_convert(v).ok()),
|
|
7386
|
+
tiers: kwargs
|
|
7387
|
+
.get(ruby.to_symbol("tiers"))
|
|
7388
|
+
.and_then(|v| <Vec<ModelTier>>::try_convert(v).ok())
|
|
7389
|
+
.unwrap_or_default(),
|
|
7390
|
+
})
|
|
7391
|
+
}
|
|
7392
|
+
|
|
7393
|
+
fn input_cost_per_token(&self) -> f64 {
|
|
7394
|
+
self.input_cost_per_token
|
|
7395
|
+
}
|
|
7396
|
+
|
|
7397
|
+
fn output_cost_per_token(&self) -> f64 {
|
|
7398
|
+
self.output_cost_per_token
|
|
7399
|
+
}
|
|
7400
|
+
|
|
7401
|
+
fn cache_read_input_token_cost(&self) -> Option<f64> {
|
|
7402
|
+
self.cache_read_input_token_cost
|
|
7403
|
+
}
|
|
7404
|
+
|
|
7405
|
+
fn cache_creation_input_token_cost(&self) -> Option<f64> {
|
|
7406
|
+
self.cache_creation_input_token_cost
|
|
7407
|
+
}
|
|
7408
|
+
|
|
7409
|
+
fn input_cost_per_audio_token(&self) -> Option<f64> {
|
|
7410
|
+
self.input_cost_per_audio_token
|
|
7411
|
+
}
|
|
7412
|
+
|
|
7413
|
+
fn output_cost_per_audio_token(&self) -> Option<f64> {
|
|
7414
|
+
self.output_cost_per_audio_token
|
|
7415
|
+
}
|
|
7416
|
+
|
|
7417
|
+
fn output_cost_per_reasoning_token(&self) -> Option<f64> {
|
|
7418
|
+
self.output_cost_per_reasoning_token
|
|
7419
|
+
}
|
|
7420
|
+
|
|
7421
|
+
fn max_tokens(&self) -> Option<u64> {
|
|
7422
|
+
self.max_tokens
|
|
7423
|
+
}
|
|
7424
|
+
|
|
7425
|
+
fn max_input_tokens(&self) -> Option<u64> {
|
|
7426
|
+
self.max_input_tokens
|
|
7427
|
+
}
|
|
7428
|
+
|
|
7429
|
+
fn max_output_tokens(&self) -> Option<u64> {
|
|
7430
|
+
self.max_output_tokens
|
|
7431
|
+
}
|
|
7432
|
+
|
|
7433
|
+
fn mode(&self) -> Option<String> {
|
|
7434
|
+
self.mode.clone()
|
|
7435
|
+
}
|
|
7436
|
+
|
|
7437
|
+
fn supports_vision(&self) -> Option<bool> {
|
|
7438
|
+
self.supports_vision
|
|
7439
|
+
}
|
|
7440
|
+
|
|
7441
|
+
fn supports_function_calling(&self) -> Option<bool> {
|
|
7442
|
+
self.supports_function_calling
|
|
7443
|
+
}
|
|
7444
|
+
|
|
7445
|
+
fn supports_reasoning(&self) -> Option<bool> {
|
|
7446
|
+
self.supports_reasoning
|
|
7447
|
+
}
|
|
7448
|
+
|
|
7449
|
+
fn supports_structured_output(&self) -> Option<bool> {
|
|
7450
|
+
self.supports_structured_output
|
|
7451
|
+
}
|
|
7452
|
+
|
|
7453
|
+
fn supports_audio_input(&self) -> Option<bool> {
|
|
7454
|
+
self.supports_audio_input
|
|
7455
|
+
}
|
|
7456
|
+
|
|
7457
|
+
fn supports_audio_output(&self) -> Option<bool> {
|
|
7458
|
+
self.supports_audio_output
|
|
7459
|
+
}
|
|
7460
|
+
|
|
7461
|
+
fn supports_prompt_caching(&self) -> Option<bool> {
|
|
7462
|
+
self.supports_prompt_caching
|
|
7463
|
+
}
|
|
7464
|
+
|
|
7465
|
+
fn tiers(&self) -> Vec<ModelTier> {
|
|
7466
|
+
self.tiers.clone()
|
|
7467
|
+
}
|
|
7468
|
+
}
|
|
7469
|
+
|
|
7470
|
+
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
7471
|
+
#[serde(default)]
|
|
7472
|
+
#[magnus::wrap(class = "LiterLlm::ModelTier")]
|
|
7473
|
+
pub struct ModelTier {
|
|
7474
|
+
min_context_tokens: u64,
|
|
7475
|
+
input_cost_per_token: f64,
|
|
7476
|
+
output_cost_per_token: f64,
|
|
7477
|
+
cache_read_input_token_cost: Option<f64>,
|
|
7478
|
+
cache_creation_input_token_cost: Option<f64>,
|
|
7479
|
+
input_cost_per_audio_token: Option<f64>,
|
|
7480
|
+
output_cost_per_audio_token: Option<f64>,
|
|
7481
|
+
output_cost_per_reasoning_token: Option<f64>,
|
|
7482
|
+
}
|
|
7483
|
+
|
|
7484
|
+
unsafe impl IntoValueFromNative for ModelTier {}
|
|
7485
|
+
|
|
7486
|
+
impl magnus::TryConvert for ModelTier {
|
|
7487
|
+
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
7488
|
+
if let Ok(r) = <&ModelTier as magnus::TryConvert>::try_convert(val) {
|
|
7489
|
+
return Ok(r.clone());
|
|
7490
|
+
}
|
|
7491
|
+
let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
|
|
7492
|
+
s
|
|
7493
|
+
} else {
|
|
7494
|
+
val.funcall::<_, _, String>("to_json", ()).map_err(|e| {
|
|
7495
|
+
magnus::Error::new(
|
|
7496
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
7497
|
+
format!("no implicit conversion into ModelTier: {}", e),
|
|
7498
|
+
)
|
|
7499
|
+
})?
|
|
7500
|
+
};
|
|
7501
|
+
serde_json::from_str::<ModelTier>(&json_str).map_err(|e| {
|
|
7502
|
+
magnus::Error::new(
|
|
7503
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
7504
|
+
format!("failed to deserialize ModelTier: {}", e),
|
|
7505
|
+
)
|
|
7506
|
+
})
|
|
7507
|
+
}
|
|
7508
|
+
}
|
|
7509
|
+
|
|
7510
|
+
unsafe impl TryConvertOwned for ModelTier {}
|
|
7511
|
+
|
|
7512
|
+
impl Default for ModelTier {
|
|
7513
|
+
fn default() -> Self {
|
|
7514
|
+
liter_llm::ModelTier::default().into()
|
|
7515
|
+
}
|
|
7516
|
+
}
|
|
7517
|
+
|
|
7518
|
+
impl ModelTier {
|
|
7519
|
+
fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
|
|
7520
|
+
let ruby = unsafe { magnus::Ruby::get_unchecked() };
|
|
7521
|
+
let args = magnus::scan_args::scan_args::<(), (Option<magnus::RHash>,), (), (), (), ()>(args)?;
|
|
7522
|
+
let (kwargs_opt,) = args.optional;
|
|
7523
|
+
let kwargs = kwargs_opt.unwrap_or_else(|| ruby.hash_new());
|
|
7524
|
+
Ok(Self {
|
|
7525
|
+
min_context_tokens: kwargs
|
|
7526
|
+
.get(ruby.to_symbol("min_context_tokens"))
|
|
7527
|
+
.and_then(|v| u64::try_convert(v).ok())
|
|
7528
|
+
.unwrap_or_default(),
|
|
7529
|
+
input_cost_per_token: kwargs
|
|
7530
|
+
.get(ruby.to_symbol("input_cost_per_token"))
|
|
7531
|
+
.and_then(|v| f64::try_convert(v).ok())
|
|
7532
|
+
.unwrap_or_default(),
|
|
7533
|
+
output_cost_per_token: kwargs
|
|
7534
|
+
.get(ruby.to_symbol("output_cost_per_token"))
|
|
7535
|
+
.and_then(|v| f64::try_convert(v).ok())
|
|
7536
|
+
.unwrap_or_default(),
|
|
7537
|
+
cache_read_input_token_cost: kwargs
|
|
7538
|
+
.get(ruby.to_symbol("cache_read_input_token_cost"))
|
|
7539
|
+
.and_then(|v| f64::try_convert(v).ok()),
|
|
7540
|
+
cache_creation_input_token_cost: kwargs
|
|
7541
|
+
.get(ruby.to_symbol("cache_creation_input_token_cost"))
|
|
7542
|
+
.and_then(|v| f64::try_convert(v).ok()),
|
|
7543
|
+
input_cost_per_audio_token: kwargs
|
|
7544
|
+
.get(ruby.to_symbol("input_cost_per_audio_token"))
|
|
7545
|
+
.and_then(|v| f64::try_convert(v).ok()),
|
|
7546
|
+
output_cost_per_audio_token: kwargs
|
|
7547
|
+
.get(ruby.to_symbol("output_cost_per_audio_token"))
|
|
7548
|
+
.and_then(|v| f64::try_convert(v).ok()),
|
|
7549
|
+
output_cost_per_reasoning_token: kwargs
|
|
7550
|
+
.get(ruby.to_symbol("output_cost_per_reasoning_token"))
|
|
7551
|
+
.and_then(|v| f64::try_convert(v).ok()),
|
|
7552
|
+
})
|
|
7553
|
+
}
|
|
7554
|
+
|
|
7555
|
+
fn min_context_tokens(&self) -> u64 {
|
|
7556
|
+
self.min_context_tokens
|
|
7557
|
+
}
|
|
7558
|
+
|
|
7559
|
+
fn input_cost_per_token(&self) -> f64 {
|
|
7560
|
+
self.input_cost_per_token
|
|
7561
|
+
}
|
|
7562
|
+
|
|
7563
|
+
fn output_cost_per_token(&self) -> f64 {
|
|
7564
|
+
self.output_cost_per_token
|
|
7565
|
+
}
|
|
7566
|
+
|
|
7567
|
+
fn cache_read_input_token_cost(&self) -> Option<f64> {
|
|
7568
|
+
self.cache_read_input_token_cost
|
|
7569
|
+
}
|
|
7570
|
+
|
|
7571
|
+
fn cache_creation_input_token_cost(&self) -> Option<f64> {
|
|
7572
|
+
self.cache_creation_input_token_cost
|
|
7573
|
+
}
|
|
7574
|
+
|
|
7575
|
+
fn input_cost_per_audio_token(&self) -> Option<f64> {
|
|
7576
|
+
self.input_cost_per_audio_token
|
|
7577
|
+
}
|
|
7578
|
+
|
|
7579
|
+
fn output_cost_per_audio_token(&self) -> Option<f64> {
|
|
7580
|
+
self.output_cost_per_audio_token
|
|
7581
|
+
}
|
|
7582
|
+
|
|
7583
|
+
fn output_cost_per_reasoning_token(&self) -> Option<f64> {
|
|
7584
|
+
self.output_cost_per_reasoning_token
|
|
7585
|
+
}
|
|
7586
|
+
}
|
|
7587
|
+
|
|
7252
7588
|
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
7253
7589
|
#[serde(default)]
|
|
7254
7590
|
#[magnus::wrap(class = "LiterLlm::BudgetConfig")]
|
|
@@ -7326,6 +7662,84 @@ impl BudgetConfig {
|
|
|
7326
7662
|
}
|
|
7327
7663
|
}
|
|
7328
7664
|
|
|
7665
|
+
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
7666
|
+
#[serde(default)]
|
|
7667
|
+
#[magnus::wrap(class = "LiterLlm::CacheConfig")]
|
|
7668
|
+
pub struct CacheConfig {
|
|
7669
|
+
max_entries: usize,
|
|
7670
|
+
ttl: u64,
|
|
7671
|
+
backend: CacheBackend,
|
|
7672
|
+
}
|
|
7673
|
+
|
|
7674
|
+
unsafe impl IntoValueFromNative for CacheConfig {}
|
|
7675
|
+
|
|
7676
|
+
impl magnus::TryConvert for CacheConfig {
|
|
7677
|
+
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
7678
|
+
if let Ok(r) = <&CacheConfig as magnus::TryConvert>::try_convert(val) {
|
|
7679
|
+
return Ok(r.clone());
|
|
7680
|
+
}
|
|
7681
|
+
let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
|
|
7682
|
+
s
|
|
7683
|
+
} else {
|
|
7684
|
+
val.funcall::<_, _, String>("to_json", ()).map_err(|e| {
|
|
7685
|
+
magnus::Error::new(
|
|
7686
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
7687
|
+
format!("no implicit conversion into CacheConfig: {}", e),
|
|
7688
|
+
)
|
|
7689
|
+
})?
|
|
7690
|
+
};
|
|
7691
|
+
serde_json::from_str::<CacheConfig>(&json_str).map_err(|e| {
|
|
7692
|
+
magnus::Error::new(
|
|
7693
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
7694
|
+
format!("failed to deserialize CacheConfig: {}", e),
|
|
7695
|
+
)
|
|
7696
|
+
})
|
|
7697
|
+
}
|
|
7698
|
+
}
|
|
7699
|
+
|
|
7700
|
+
unsafe impl TryConvertOwned for CacheConfig {}
|
|
7701
|
+
|
|
7702
|
+
impl Default for CacheConfig {
|
|
7703
|
+
fn default() -> Self {
|
|
7704
|
+
liter_llm::CacheConfig::default().into()
|
|
7705
|
+
}
|
|
7706
|
+
}
|
|
7707
|
+
|
|
7708
|
+
impl CacheConfig {
|
|
7709
|
+
fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
|
|
7710
|
+
let ruby = unsafe { magnus::Ruby::get_unchecked() };
|
|
7711
|
+
let args = magnus::scan_args::scan_args::<(), (Option<magnus::RHash>,), (), (), (), ()>(args)?;
|
|
7712
|
+
let (kwargs_opt,) = args.optional;
|
|
7713
|
+
let kwargs = kwargs_opt.unwrap_or_else(|| ruby.hash_new());
|
|
7714
|
+
Ok(Self {
|
|
7715
|
+
max_entries: kwargs
|
|
7716
|
+
.get(ruby.to_symbol("max_entries"))
|
|
7717
|
+
.and_then(|v| usize::try_convert(v).ok())
|
|
7718
|
+
.unwrap_or(256),
|
|
7719
|
+
ttl: kwargs
|
|
7720
|
+
.get(ruby.to_symbol("ttl"))
|
|
7721
|
+
.and_then(|v| u64::try_convert(v).ok())
|
|
7722
|
+
.unwrap_or(300000),
|
|
7723
|
+
backend: kwargs
|
|
7724
|
+
.get(ruby.to_symbol("backend"))
|
|
7725
|
+
.and_then(|v| CacheBackend::try_convert(v).ok())
|
|
7726
|
+
.unwrap_or(CacheBackend::Memory),
|
|
7727
|
+
})
|
|
7728
|
+
}
|
|
7729
|
+
|
|
7730
|
+
fn max_entries(&self) -> usize {
|
|
7731
|
+
self.max_entries
|
|
7732
|
+
}
|
|
7733
|
+
|
|
7734
|
+
fn ttl(&self) -> u64 {
|
|
7735
|
+
self.ttl.clone()
|
|
7736
|
+
}
|
|
7737
|
+
|
|
7738
|
+
fn backend(&self) -> CacheBackend {
|
|
7739
|
+
self.backend.clone()
|
|
7740
|
+
}
|
|
7741
|
+
}
|
|
7742
|
+
|
|
7329
7743
|
#[derive(Clone)]
|
|
7330
7744
|
#[magnus::wrap(class = "LiterLlm::SingleflightResult")]
|
|
7331
7745
|
pub struct SingleflightResult {
|
|
@@ -7489,41 +7903,127 @@ impl IntentPrototype {
|
|
|
7489
7903
|
}
|
|
7490
7904
|
|
|
7491
7905
|
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
7492
|
-
#[serde(
|
|
7493
|
-
|
|
7494
|
-
|
|
7495
|
-
|
|
7496
|
-
|
|
7497
|
-
|
|
7498
|
-
|
|
7499
|
-
Assistant { _0: AssistantMessage },
|
|
7500
|
-
#[serde(rename = "tool")]
|
|
7501
|
-
Tool { _0: ToolMessage },
|
|
7502
|
-
#[serde(rename = "developer")]
|
|
7503
|
-
Developer { _0: DeveloperMessage },
|
|
7504
|
-
#[serde(rename = "function")]
|
|
7505
|
-
Function { _0: FunctionMessage },
|
|
7506
|
-
}
|
|
7507
|
-
|
|
7508
|
-
impl Default for Message {
|
|
7509
|
-
fn default() -> Self {
|
|
7510
|
-
Self::System { _0: Default::default() }
|
|
7511
|
-
}
|
|
7906
|
+
#[serde(default)]
|
|
7907
|
+
#[magnus::wrap(class = "LiterLlm::CatalogRefreshConfig")]
|
|
7908
|
+
pub struct CatalogRefreshConfig {
|
|
7909
|
+
enabled: bool,
|
|
7910
|
+
source_url: String,
|
|
7911
|
+
ttl_seconds: u64,
|
|
7912
|
+
cache_path: Option<String>,
|
|
7512
7913
|
}
|
|
7513
7914
|
|
|
7514
|
-
impl
|
|
7515
|
-
fn into_value_with(self, handle: &Ruby) -> magnus::Value {
|
|
7516
|
-
match serde_json::to_value(&self) {
|
|
7517
|
-
Ok(v) => json_to_ruby(handle, v),
|
|
7518
|
-
Err(_) => handle.qnil().into_value_with(handle),
|
|
7519
|
-
}
|
|
7520
|
-
}
|
|
7521
|
-
}
|
|
7915
|
+
unsafe impl IntoValueFromNative for CatalogRefreshConfig {}
|
|
7522
7916
|
|
|
7523
|
-
impl magnus::TryConvert for
|
|
7917
|
+
impl magnus::TryConvert for CatalogRefreshConfig {
|
|
7524
7918
|
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
7525
|
-
|
|
7526
|
-
|
|
7919
|
+
if let Ok(r) = <&CatalogRefreshConfig as magnus::TryConvert>::try_convert(val) {
|
|
7920
|
+
return Ok(r.clone());
|
|
7921
|
+
}
|
|
7922
|
+
let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
|
|
7923
|
+
s
|
|
7924
|
+
} else {
|
|
7925
|
+
val.funcall::<_, _, String>("to_json", ()).map_err(|e| {
|
|
7926
|
+
magnus::Error::new(
|
|
7927
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
7928
|
+
format!("no implicit conversion into CatalogRefreshConfig: {}", e),
|
|
7929
|
+
)
|
|
7930
|
+
})?
|
|
7931
|
+
};
|
|
7932
|
+
serde_json::from_str::<CatalogRefreshConfig>(&json_str).map_err(|e| {
|
|
7933
|
+
magnus::Error::new(
|
|
7934
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
7935
|
+
format!("failed to deserialize CatalogRefreshConfig: {}", e),
|
|
7936
|
+
)
|
|
7937
|
+
})
|
|
7938
|
+
}
|
|
7939
|
+
}
|
|
7940
|
+
|
|
7941
|
+
unsafe impl TryConvertOwned for CatalogRefreshConfig {}
|
|
7942
|
+
|
|
7943
|
+
impl Default for CatalogRefreshConfig {
|
|
7944
|
+
fn default() -> Self {
|
|
7945
|
+
liter_llm::cost::refresh::CatalogRefreshConfig::default().into()
|
|
7946
|
+
}
|
|
7947
|
+
}
|
|
7948
|
+
|
|
7949
|
+
impl CatalogRefreshConfig {
|
|
7950
|
+
fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
|
|
7951
|
+
let ruby = unsafe { magnus::Ruby::get_unchecked() };
|
|
7952
|
+
let args = magnus::scan_args::scan_args::<(), (Option<magnus::RHash>,), (), (), (), ()>(args)?;
|
|
7953
|
+
let (kwargs_opt,) = args.optional;
|
|
7954
|
+
let kwargs = kwargs_opt.unwrap_or_else(|| ruby.hash_new());
|
|
7955
|
+
Ok(Self {
|
|
7956
|
+
enabled: kwargs
|
|
7957
|
+
.get(ruby.to_symbol("enabled"))
|
|
7958
|
+
.and_then(|v| bool::try_convert(v).ok())
|
|
7959
|
+
.unwrap_or(false),
|
|
7960
|
+
source_url: kwargs
|
|
7961
|
+
.get(ruby.to_symbol("source_url"))
|
|
7962
|
+
.and_then(|v| String::try_convert(v).ok())
|
|
7963
|
+
.unwrap_or_default(),
|
|
7964
|
+
ttl_seconds: kwargs
|
|
7965
|
+
.get(ruby.to_symbol("ttl_seconds"))
|
|
7966
|
+
.and_then(|v| u64::try_convert(v).ok())
|
|
7967
|
+
.unwrap_or(86400),
|
|
7968
|
+
cache_path: kwargs
|
|
7969
|
+
.get(ruby.to_symbol("cache_path"))
|
|
7970
|
+
.and_then(|v| String::try_convert(v).ok()),
|
|
7971
|
+
})
|
|
7972
|
+
}
|
|
7973
|
+
|
|
7974
|
+
fn enabled(&self) -> bool {
|
|
7975
|
+
self.enabled
|
|
7976
|
+
}
|
|
7977
|
+
|
|
7978
|
+
fn source_url(&self) -> String {
|
|
7979
|
+
self.source_url.clone()
|
|
7980
|
+
}
|
|
7981
|
+
|
|
7982
|
+
fn ttl_seconds(&self) -> u64 {
|
|
7983
|
+
self.ttl_seconds
|
|
7984
|
+
}
|
|
7985
|
+
|
|
7986
|
+
fn cache_path(&self) -> Option<String> {
|
|
7987
|
+
self.cache_path.clone()
|
|
7988
|
+
}
|
|
7989
|
+
}
|
|
7990
|
+
|
|
7991
|
+
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
7992
|
+
#[serde(tag = "role")]
|
|
7993
|
+
pub enum Message {
|
|
7994
|
+
#[serde(rename = "system")]
|
|
7995
|
+
System { _0: SystemMessage },
|
|
7996
|
+
#[serde(rename = "user")]
|
|
7997
|
+
User { _0: UserMessage },
|
|
7998
|
+
#[serde(rename = "assistant")]
|
|
7999
|
+
Assistant { _0: AssistantMessage },
|
|
8000
|
+
#[serde(rename = "tool")]
|
|
8001
|
+
Tool { _0: ToolMessage },
|
|
8002
|
+
#[serde(rename = "developer")]
|
|
8003
|
+
Developer { _0: DeveloperMessage },
|
|
8004
|
+
#[serde(rename = "function")]
|
|
8005
|
+
Function { _0: FunctionMessage },
|
|
8006
|
+
}
|
|
8007
|
+
|
|
8008
|
+
impl Default for Message {
|
|
8009
|
+
fn default() -> Self {
|
|
8010
|
+
Self::System { _0: Default::default() }
|
|
8011
|
+
}
|
|
8012
|
+
}
|
|
8013
|
+
|
|
8014
|
+
impl magnus::IntoValue for Message {
|
|
8015
|
+
fn into_value_with(self, handle: &Ruby) -> magnus::Value {
|
|
8016
|
+
match serde_json::to_value(&self) {
|
|
8017
|
+
Ok(v) => json_to_ruby(handle, v),
|
|
8018
|
+
Err(_) => handle.qnil().into_value_with(handle),
|
|
8019
|
+
}
|
|
8020
|
+
}
|
|
8021
|
+
}
|
|
8022
|
+
|
|
8023
|
+
impl magnus::TryConvert for Message {
|
|
8024
|
+
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
8025
|
+
// For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
|
|
8026
|
+
// For unit enums or when passed as a string, fall back to string-based conversion.
|
|
7527
8027
|
let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
|
|
7528
8028
|
s
|
|
7529
8029
|
} else {
|
|
@@ -8855,6 +9355,65 @@ impl magnus::TryConvert for Enforcement {
|
|
|
8855
9355
|
unsafe impl IntoValueFromNative for Enforcement {}
|
|
8856
9356
|
unsafe impl TryConvertOwned for Enforcement {}
|
|
8857
9357
|
|
|
9358
|
+
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
9359
|
+
#[serde(tag = "type")]
|
|
9360
|
+
#[serde(rename_all = "snake_case")]
|
|
9361
|
+
pub enum CacheBackend {
|
|
9362
|
+
Memory,
|
|
9363
|
+
OpenDal { scheme: String, config: String },
|
|
9364
|
+
}
|
|
9365
|
+
|
|
9366
|
+
impl Default for CacheBackend {
|
|
9367
|
+
fn default() -> Self {
|
|
9368
|
+
Self::Memory
|
|
9369
|
+
}
|
|
9370
|
+
}
|
|
9371
|
+
|
|
9372
|
+
impl magnus::IntoValue for CacheBackend {
|
|
9373
|
+
fn into_value_with(self, handle: &Ruby) -> magnus::Value {
|
|
9374
|
+
match serde_json::to_value(&self) {
|
|
9375
|
+
Ok(v) => json_to_ruby(handle, v),
|
|
9376
|
+
Err(_) => handle.qnil().into_value_with(handle),
|
|
9377
|
+
}
|
|
9378
|
+
}
|
|
9379
|
+
}
|
|
9380
|
+
|
|
9381
|
+
impl magnus::TryConvert for CacheBackend {
|
|
9382
|
+
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
9383
|
+
// For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
|
|
9384
|
+
// For unit enums or when passed as a string, fall back to string-based conversion.
|
|
9385
|
+
let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
|
|
9386
|
+
s
|
|
9387
|
+
} else {
|
|
9388
|
+
val.funcall::<_, _, String>("to_json", ()).map_err(|e| {
|
|
9389
|
+
magnus::Error::new(
|
|
9390
|
+
unsafe { Ruby::get_unchecked() }.exception_type_error(),
|
|
9391
|
+
format!("no implicit conversion into CacheBackend: {}", e),
|
|
9392
|
+
)
|
|
9393
|
+
})?
|
|
9394
|
+
};
|
|
9395
|
+
// Try deserializing as JSON first (handles JSON strings like "\"markdown\"" or "{\"click\":{\"selector\":\"...\"}}\"")
|
|
9396
|
+
// For internally-tagged enums, a bare variant string is wrapped as {"<tag>": value}.
|
|
9397
|
+
// If that fails, try treating it as a plain string value and wrap in quotes
|
|
9398
|
+
// If both fail, try as Custom variant (for untagged enum support)
|
|
9399
|
+
serde_json::from_str(&json_str)
|
|
9400
|
+
.or_else(|_| serde_json::from_value(serde_json::json!({ "type": json_str })))
|
|
9401
|
+
.or_else(|_| serde_json::from_str(&format!("\"{json_str}\"")))
|
|
9402
|
+
.or_else(|_| {
|
|
9403
|
+
// Try as a JSON string for Custom variant (untagged enums accept any remaining value)
|
|
9404
|
+
match serde_json::to_value(&json_str) {
|
|
9405
|
+
Ok(val) => serde_json::from_value(val),
|
|
9406
|
+
Err(e) => Err(e),
|
|
9407
|
+
}
|
|
9408
|
+
})
|
|
9409
|
+
.map_err(|e| magnus::Error::new(unsafe { Ruby::get_unchecked() }.exception_type_error(), e.to_string()))
|
|
9410
|
+
}
|
|
9411
|
+
}
|
|
9412
|
+
|
|
9413
|
+
unsafe impl IntoValueFromNative for CacheBackend {}
|
|
9414
|
+
unsafe impl TryConvertOwned for CacheBackend {}
|
|
9415
|
+
impl CacheBackend {}
|
|
9416
|
+
|
|
8858
9417
|
#[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
|
|
8859
9418
|
pub enum CircuitState {
|
|
8860
9419
|
Closed,
|
|
@@ -8940,6 +9499,50 @@ impl magnus::TryConvert for HealthStatus {
|
|
|
8940
9499
|
unsafe impl IntoValueFromNative for HealthStatus {}
|
|
8941
9500
|
unsafe impl TryConvertOwned for HealthStatus {}
|
|
8942
9501
|
|
|
9502
|
+
#[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
|
|
9503
|
+
pub enum RefreshOutcome {
|
|
9504
|
+
Disabled,
|
|
9505
|
+
FromCache,
|
|
9506
|
+
Fetched,
|
|
9507
|
+
}
|
|
9508
|
+
|
|
9509
|
+
impl Default for RefreshOutcome {
|
|
9510
|
+
fn default() -> Self {
|
|
9511
|
+
Self::Disabled
|
|
9512
|
+
}
|
|
9513
|
+
}
|
|
9514
|
+
|
|
9515
|
+
impl magnus::IntoValue for RefreshOutcome {
|
|
9516
|
+
fn into_value_with(self, handle: &Ruby) -> magnus::Value {
|
|
9517
|
+
let sym = match self {
|
|
9518
|
+
RefreshOutcome::Disabled => "disabled",
|
|
9519
|
+
RefreshOutcome::FromCache => "from_cache",
|
|
9520
|
+
RefreshOutcome::Fetched => "fetched",
|
|
9521
|
+
};
|
|
9522
|
+
handle.to_symbol(sym).into_value_with(handle)
|
|
9523
|
+
}
|
|
9524
|
+
}
|
|
9525
|
+
|
|
9526
|
+
impl magnus::TryConvert for RefreshOutcome {
|
|
9527
|
+
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
9528
|
+
let s: String = magnus::TryConvert::try_convert(val)?;
|
|
9529
|
+
// Accept the serde wire name (snake_case), the PascalCase Rust variant name,
|
|
9530
|
+
// and a lowercase fallback so fixtures written in any of those styles work.
|
|
9531
|
+
match s.as_str() {
|
|
9532
|
+
"disabled" | "Disabled" => Ok(RefreshOutcome::Disabled),
|
|
9533
|
+
"from_cache" | "FromCache" => Ok(RefreshOutcome::FromCache),
|
|
9534
|
+
"fetched" | "Fetched" => Ok(RefreshOutcome::Fetched),
|
|
9535
|
+
other => Err(magnus::Error::new(
|
|
9536
|
+
unsafe { Ruby::get_unchecked() }.exception_arg_error(),
|
|
9537
|
+
format!("invalid RefreshOutcome value: {other}"),
|
|
9538
|
+
)),
|
|
9539
|
+
}
|
|
9540
|
+
}
|
|
9541
|
+
}
|
|
9542
|
+
|
|
9543
|
+
unsafe impl IntoValueFromNative for RefreshOutcome {}
|
|
9544
|
+
unsafe impl TryConvertOwned for RefreshOutcome {}
|
|
9545
|
+
|
|
8943
9546
|
fn create_client(args: &[magnus::Value]) -> Result<DefaultClient, Error> {
|
|
8944
9547
|
let args = magnus::scan_args::scan_args::<
|
|
8945
9548
|
(String,),
|
|
@@ -9075,6 +9678,10 @@ fn completion_cost_with_cache(
|
|
|
9075
9678
|
liter_llm::completion_cost_with_cache(&model, prompt_tokens, cached_tokens, completion_tokens)
|
|
9076
9679
|
}
|
|
9077
9680
|
|
|
9681
|
+
fn model_info(model: String) -> Option<ModelInfo> {
|
|
9682
|
+
liter_llm::model_info(&model).map(Into::into)
|
|
9683
|
+
}
|
|
9684
|
+
|
|
9078
9685
|
fn clear() -> () {
|
|
9079
9686
|
liter_llm::guardrail::registry::clear()
|
|
9080
9687
|
}
|
|
@@ -9134,16 +9741,98 @@ fn ensure_crypto_provider() -> () {
|
|
|
9134
9741
|
liter_llm::ensure_crypto_provider()
|
|
9135
9742
|
}
|
|
9136
9743
|
|
|
9744
|
+
fn install_catalog_overlay_from_str(catalog_json: String) -> Result<(), Error> {
|
|
9745
|
+
let result = liter_llm::cost::refresh::install_catalog_overlay_from_str(&catalog_json).map_err(|e| {
|
|
9746
|
+
magnus::Error::new(
|
|
9747
|
+
unsafe { Ruby::get_unchecked() }.exception_runtime_error(),
|
|
9748
|
+
e.to_string(),
|
|
9749
|
+
)
|
|
9750
|
+
})?;
|
|
9751
|
+
Ok(result)
|
|
9752
|
+
}
|
|
9753
|
+
|
|
9754
|
+
fn clear_catalog_overlay() -> () {
|
|
9755
|
+
liter_llm::cost::refresh::clear_catalog_overlay()
|
|
9756
|
+
}
|
|
9757
|
+
|
|
9758
|
+
fn refresh_catalog(args: &[magnus::Value]) -> Result<RefreshOutcome, Error> {
|
|
9759
|
+
let args = magnus::scan_args::scan_args::<(), (Option<magnus::Value>,), (), (), (), ()>(args)?;
|
|
9760
|
+
let (config,) = args.optional;
|
|
9761
|
+
|
|
9762
|
+
let config_core: liter_llm::CatalogRefreshConfig = match config {
|
|
9763
|
+
Some(_v) if !_v.is_nil() => {
|
|
9764
|
+
let binding_val: CatalogRefreshConfig = CatalogRefreshConfig::try_convert(_v).map_err(|e| {
|
|
9765
|
+
magnus::Error::new(
|
|
9766
|
+
unsafe { Ruby::get_unchecked() }.exception_runtime_error(),
|
|
9767
|
+
e.to_string(),
|
|
9768
|
+
)
|
|
9769
|
+
})?;
|
|
9770
|
+
binding_val.into()
|
|
9771
|
+
}
|
|
9772
|
+
_ => Default::default(),
|
|
9773
|
+
};
|
|
9774
|
+
let rt = tokio::runtime::Runtime::new().map_err(|e| {
|
|
9775
|
+
magnus::Error::new(
|
|
9776
|
+
unsafe { Ruby::get_unchecked() }.exception_runtime_error(),
|
|
9777
|
+
e.to_string(),
|
|
9778
|
+
)
|
|
9779
|
+
})?;
|
|
9780
|
+
let result = rt
|
|
9781
|
+
.block_on(async { liter_llm::cost::refresh::refresh_catalog(&config_core).await })
|
|
9782
|
+
.map_err(|e| {
|
|
9783
|
+
magnus::Error::new(
|
|
9784
|
+
unsafe { Ruby::get_unchecked() }.exception_runtime_error(),
|
|
9785
|
+
e.to_string(),
|
|
9786
|
+
)
|
|
9787
|
+
})?;
|
|
9788
|
+
Ok(result.into())
|
|
9789
|
+
}
|
|
9790
|
+
|
|
9791
|
+
fn refresh_catalog_async(args: &[magnus::Value]) -> Result<RefreshOutcome, Error> {
|
|
9792
|
+
let args = magnus::scan_args::scan_args::<(), (Option<magnus::Value>,), (), (), (), ()>(args)?;
|
|
9793
|
+
let (config,) = args.optional;
|
|
9794
|
+
|
|
9795
|
+
let config_core: liter_llm::CatalogRefreshConfig = match config {
|
|
9796
|
+
Some(_v) if !_v.is_nil() => {
|
|
9797
|
+
let binding_val: CatalogRefreshConfig = CatalogRefreshConfig::try_convert(_v).map_err(|e| {
|
|
9798
|
+
magnus::Error::new(
|
|
9799
|
+
unsafe { Ruby::get_unchecked() }.exception_runtime_error(),
|
|
9800
|
+
e.to_string(),
|
|
9801
|
+
)
|
|
9802
|
+
})?;
|
|
9803
|
+
binding_val.into()
|
|
9804
|
+
}
|
|
9805
|
+
_ => Default::default(),
|
|
9806
|
+
};
|
|
9807
|
+
let rt = tokio::runtime::Runtime::new().map_err(|e| {
|
|
9808
|
+
magnus::Error::new(
|
|
9809
|
+
unsafe { Ruby::get_unchecked() }.exception_runtime_error(),
|
|
9810
|
+
e.to_string(),
|
|
9811
|
+
)
|
|
9812
|
+
})?;
|
|
9813
|
+
let result = rt
|
|
9814
|
+
.block_on(async { liter_llm::cost::refresh::refresh_catalog(&config_core).await })
|
|
9815
|
+
.map_err(|e| {
|
|
9816
|
+
magnus::Error::new(
|
|
9817
|
+
unsafe { Ruby::get_unchecked() }.exception_runtime_error(),
|
|
9818
|
+
e.to_string(),
|
|
9819
|
+
)
|
|
9820
|
+
})?;
|
|
9821
|
+
Ok(result.into())
|
|
9822
|
+
}
|
|
9823
|
+
|
|
9137
9824
|
fn chat_stream(engine: DefaultClient, req: ChatCompletionRequest) -> Result<magnus::Value, Error> {
|
|
9138
9825
|
engine.chat_stream(req)
|
|
9139
9826
|
}
|
|
9140
9827
|
|
|
9828
|
+
#[allow(clippy::needless_update)]
|
|
9141
9829
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
9142
9830
|
impl From<SystemMessage> for liter_llm::types::SystemMessage {
|
|
9143
9831
|
fn from(val: SystemMessage) -> Self {
|
|
9144
9832
|
Self {
|
|
9145
9833
|
content: val.content.into(),
|
|
9146
9834
|
name: val.name,
|
|
9835
|
+
..Default::default()
|
|
9147
9836
|
}
|
|
9148
9837
|
}
|
|
9149
9838
|
}
|
|
@@ -9158,12 +9847,14 @@ impl From<liter_llm::types::SystemMessage> for SystemMessage {
|
|
|
9158
9847
|
}
|
|
9159
9848
|
}
|
|
9160
9849
|
|
|
9850
|
+
#[allow(clippy::needless_update)]
|
|
9161
9851
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
9162
9852
|
impl From<UserMessage> for liter_llm::types::UserMessage {
|
|
9163
9853
|
fn from(val: UserMessage) -> Self {
|
|
9164
9854
|
Self {
|
|
9165
9855
|
content: val.content.into(),
|
|
9166
9856
|
name: val.name,
|
|
9857
|
+
..Default::default()
|
|
9167
9858
|
}
|
|
9168
9859
|
}
|
|
9169
9860
|
}
|
|
@@ -9178,12 +9869,14 @@ impl From<liter_llm::types::UserMessage> for UserMessage {
|
|
|
9178
9869
|
}
|
|
9179
9870
|
}
|
|
9180
9871
|
|
|
9872
|
+
#[allow(clippy::needless_update)]
|
|
9181
9873
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
9182
9874
|
impl From<ImageUrl> for liter_llm::types::ImageUrl {
|
|
9183
9875
|
fn from(val: ImageUrl) -> Self {
|
|
9184
9876
|
Self {
|
|
9185
9877
|
url: val.url,
|
|
9186
9878
|
detail: val.detail.map(Into::into),
|
|
9879
|
+
..Default::default()
|
|
9187
9880
|
}
|
|
9188
9881
|
}
|
|
9189
9882
|
}
|
|
@@ -9198,12 +9891,14 @@ impl From<liter_llm::types::ImageUrl> for ImageUrl {
|
|
|
9198
9891
|
}
|
|
9199
9892
|
}
|
|
9200
9893
|
|
|
9894
|
+
#[allow(clippy::needless_update)]
|
|
9201
9895
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
9202
9896
|
impl From<DocumentContent> for liter_llm::types::DocumentContent {
|
|
9203
9897
|
fn from(val: DocumentContent) -> Self {
|
|
9204
9898
|
Self {
|
|
9205
9899
|
data: val.data,
|
|
9206
9900
|
media_type: val.media_type,
|
|
9901
|
+
..Default::default()
|
|
9207
9902
|
}
|
|
9208
9903
|
}
|
|
9209
9904
|
}
|
|
@@ -9218,12 +9913,14 @@ impl From<liter_llm::types::DocumentContent> for DocumentContent {
|
|
|
9218
9913
|
}
|
|
9219
9914
|
}
|
|
9220
9915
|
|
|
9916
|
+
#[allow(clippy::needless_update)]
|
|
9221
9917
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
9222
9918
|
impl From<AudioContent> for liter_llm::types::AudioContent {
|
|
9223
9919
|
fn from(val: AudioContent) -> Self {
|
|
9224
9920
|
Self {
|
|
9225
9921
|
data: val.data,
|
|
9226
9922
|
format: val.format,
|
|
9923
|
+
..Default::default()
|
|
9227
9924
|
}
|
|
9228
9925
|
}
|
|
9229
9926
|
}
|
|
@@ -9238,6 +9935,7 @@ impl From<liter_llm::types::AudioContent> for AudioContent {
|
|
|
9238
9935
|
}
|
|
9239
9936
|
}
|
|
9240
9937
|
|
|
9938
|
+
#[allow(clippy::needless_update)]
|
|
9241
9939
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
9242
9940
|
impl From<AssistantMessage> for liter_llm::types::AssistantMessage {
|
|
9243
9941
|
fn from(val: AssistantMessage) -> Self {
|
|
@@ -9247,6 +9945,7 @@ impl From<AssistantMessage> for liter_llm::types::AssistantMessage {
|
|
|
9247
9945
|
tool_calls: val.tool_calls.map(|v| v.into_iter().map(Into::into).collect()),
|
|
9248
9946
|
refusal: val.refusal,
|
|
9249
9947
|
function_call: val.function_call.map(Into::into),
|
|
9948
|
+
..Default::default()
|
|
9250
9949
|
}
|
|
9251
9950
|
}
|
|
9252
9951
|
}
|
|
@@ -9264,6 +9963,7 @@ impl From<liter_llm::types::AssistantMessage> for AssistantMessage {
|
|
|
9264
9963
|
}
|
|
9265
9964
|
}
|
|
9266
9965
|
|
|
9966
|
+
#[allow(clippy::needless_update)]
|
|
9267
9967
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
9268
9968
|
impl From<ToolMessage> for liter_llm::types::ToolMessage {
|
|
9269
9969
|
fn from(val: ToolMessage) -> Self {
|
|
@@ -9271,6 +9971,7 @@ impl From<ToolMessage> for liter_llm::types::ToolMessage {
|
|
|
9271
9971
|
content: val.content,
|
|
9272
9972
|
tool_call_id: val.tool_call_id,
|
|
9273
9973
|
name: val.name,
|
|
9974
|
+
..Default::default()
|
|
9274
9975
|
}
|
|
9275
9976
|
}
|
|
9276
9977
|
}
|
|
@@ -9286,12 +9987,14 @@ impl From<liter_llm::types::ToolMessage> for ToolMessage {
|
|
|
9286
9987
|
}
|
|
9287
9988
|
}
|
|
9288
9989
|
|
|
9990
|
+
#[allow(clippy::needless_update)]
|
|
9289
9991
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
9290
9992
|
impl From<DeveloperMessage> for liter_llm::types::DeveloperMessage {
|
|
9291
9993
|
fn from(val: DeveloperMessage) -> Self {
|
|
9292
9994
|
Self {
|
|
9293
9995
|
content: val.content,
|
|
9294
9996
|
name: val.name,
|
|
9997
|
+
..Default::default()
|
|
9295
9998
|
}
|
|
9296
9999
|
}
|
|
9297
10000
|
}
|
|
@@ -9306,12 +10009,14 @@ impl From<liter_llm::types::DeveloperMessage> for DeveloperMessage {
|
|
|
9306
10009
|
}
|
|
9307
10010
|
}
|
|
9308
10011
|
|
|
10012
|
+
#[allow(clippy::needless_update)]
|
|
9309
10013
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
9310
10014
|
impl From<FunctionMessage> for liter_llm::types::FunctionMessage {
|
|
9311
10015
|
fn from(val: FunctionMessage) -> Self {
|
|
9312
10016
|
Self {
|
|
9313
10017
|
content: val.content,
|
|
9314
10018
|
name: val.name,
|
|
10019
|
+
..Default::default()
|
|
9315
10020
|
}
|
|
9316
10021
|
}
|
|
9317
10022
|
}
|
|
@@ -9412,12 +10117,14 @@ impl From<liter_llm::types::FunctionCall> for FunctionCall {
|
|
|
9412
10117
|
}
|
|
9413
10118
|
}
|
|
9414
10119
|
|
|
10120
|
+
#[allow(clippy::needless_update)]
|
|
9415
10121
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
9416
10122
|
impl From<SpecificToolChoice> for liter_llm::types::SpecificToolChoice {
|
|
9417
10123
|
fn from(val: SpecificToolChoice) -> Self {
|
|
9418
10124
|
Self {
|
|
9419
10125
|
choice_type: val.choice_type.into(),
|
|
9420
10126
|
function: val.function.into(),
|
|
10127
|
+
..Default::default()
|
|
9421
10128
|
}
|
|
9422
10129
|
}
|
|
9423
10130
|
}
|
|
@@ -9432,10 +10139,14 @@ impl From<liter_llm::types::SpecificToolChoice> for SpecificToolChoice {
|
|
|
9432
10139
|
}
|
|
9433
10140
|
}
|
|
9434
10141
|
|
|
10142
|
+
#[allow(clippy::needless_update)]
|
|
9435
10143
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
9436
10144
|
impl From<SpecificFunction> for liter_llm::types::SpecificFunction {
|
|
9437
10145
|
fn from(val: SpecificFunction) -> Self {
|
|
9438
|
-
Self {
|
|
10146
|
+
Self {
|
|
10147
|
+
name: val.name,
|
|
10148
|
+
..Default::default()
|
|
10149
|
+
}
|
|
9439
10150
|
}
|
|
9440
10151
|
}
|
|
9441
10152
|
|
|
@@ -9448,6 +10159,7 @@ impl From<liter_llm::types::SpecificFunction> for SpecificFunction {
|
|
|
9448
10159
|
}
|
|
9449
10160
|
}
|
|
9450
10161
|
|
|
10162
|
+
#[allow(clippy::needless_update)]
|
|
9451
10163
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
9452
10164
|
impl From<JsonSchemaFormat> for liter_llm::types::JsonSchemaFormat {
|
|
9453
10165
|
fn from(val: JsonSchemaFormat) -> Self {
|
|
@@ -9456,6 +10168,7 @@ impl From<JsonSchemaFormat> for liter_llm::types::JsonSchemaFormat {
|
|
|
9456
10168
|
description: val.description,
|
|
9457
10169
|
schema: serde_json::from_str(&val.schema).unwrap_or_default(),
|
|
9458
10170
|
strict: val.strict,
|
|
10171
|
+
..Default::default()
|
|
9459
10172
|
}
|
|
9460
10173
|
}
|
|
9461
10174
|
}
|
|
@@ -9472,6 +10185,7 @@ impl From<liter_llm::types::JsonSchemaFormat> for JsonSchemaFormat {
|
|
|
9472
10185
|
}
|
|
9473
10186
|
}
|
|
9474
10187
|
|
|
10188
|
+
#[allow(clippy::needless_update)]
|
|
9475
10189
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
9476
10190
|
impl From<Usage> for liter_llm::types::Usage {
|
|
9477
10191
|
fn from(val: Usage) -> Self {
|
|
@@ -9480,6 +10194,7 @@ impl From<Usage> for liter_llm::types::Usage {
|
|
|
9480
10194
|
completion_tokens: val.completion_tokens,
|
|
9481
10195
|
total_tokens: val.total_tokens,
|
|
9482
10196
|
prompt_tokens_details: val.prompt_tokens_details.map(Into::into),
|
|
10197
|
+
..Default::default()
|
|
9483
10198
|
}
|
|
9484
10199
|
}
|
|
9485
10200
|
}
|
|
@@ -9496,12 +10211,14 @@ impl From<liter_llm::types::Usage> for Usage {
|
|
|
9496
10211
|
}
|
|
9497
10212
|
}
|
|
9498
10213
|
|
|
10214
|
+
#[allow(clippy::needless_update)]
|
|
9499
10215
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
9500
10216
|
impl From<PromptTokensDetails> for liter_llm::types::PromptTokensDetails {
|
|
9501
10217
|
fn from(val: PromptTokensDetails) -> Self {
|
|
9502
10218
|
Self {
|
|
9503
10219
|
cached_tokens: val.cached_tokens,
|
|
9504
10220
|
audio_tokens: val.audio_tokens,
|
|
10221
|
+
..Default::default()
|
|
9505
10222
|
}
|
|
9506
10223
|
}
|
|
9507
10224
|
}
|
|
@@ -9516,6 +10233,7 @@ impl From<liter_llm::types::PromptTokensDetails> for PromptTokensDetails {
|
|
|
9516
10233
|
}
|
|
9517
10234
|
}
|
|
9518
10235
|
|
|
10236
|
+
#[allow(clippy::needless_update)]
|
|
9519
10237
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
9520
10238
|
impl From<ChatCompletionRequest> for liter_llm::types::ChatCompletionRequest {
|
|
9521
10239
|
fn from(val: ChatCompletionRequest) -> Self {
|
|
@@ -9541,6 +10259,7 @@ impl From<ChatCompletionRequest> for liter_llm::types::ChatCompletionRequest {
|
|
|
9541
10259
|
reasoning_effort: val.reasoning_effort.map(Into::into),
|
|
9542
10260
|
modalities: val.modalities.map(|v| v.into_iter().map(Into::into).collect()),
|
|
9543
10261
|
extra_body: val.extra_body.as_ref().and_then(|s| serde_json::from_str(s).ok()),
|
|
10262
|
+
..Default::default()
|
|
9544
10263
|
}
|
|
9545
10264
|
}
|
|
9546
10265
|
}
|
|
@@ -9574,11 +10293,13 @@ impl From<liter_llm::types::ChatCompletionRequest> for ChatCompletionRequest {
|
|
|
9574
10293
|
}
|
|
9575
10294
|
}
|
|
9576
10295
|
|
|
10296
|
+
#[allow(clippy::needless_update)]
|
|
9577
10297
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
9578
10298
|
impl From<StreamOptions> for liter_llm::types::StreamOptions {
|
|
9579
10299
|
fn from(val: StreamOptions) -> Self {
|
|
9580
10300
|
Self {
|
|
9581
10301
|
include_usage: val.include_usage,
|
|
10302
|
+
..Default::default()
|
|
9582
10303
|
}
|
|
9583
10304
|
}
|
|
9584
10305
|
}
|
|
@@ -9592,6 +10313,7 @@ impl From<liter_llm::types::StreamOptions> for StreamOptions {
|
|
|
9592
10313
|
}
|
|
9593
10314
|
}
|
|
9594
10315
|
|
|
10316
|
+
#[allow(clippy::needless_update)]
|
|
9595
10317
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
9596
10318
|
impl From<ChatCompletionResponse> for liter_llm::types::ChatCompletionResponse {
|
|
9597
10319
|
fn from(val: ChatCompletionResponse) -> Self {
|
|
@@ -9604,6 +10326,7 @@ impl From<ChatCompletionResponse> for liter_llm::types::ChatCompletionResponse {
|
|
|
9604
10326
|
usage: val.usage.map(Into::into),
|
|
9605
10327
|
system_fingerprint: val.system_fingerprint,
|
|
9606
10328
|
service_tier: val.service_tier,
|
|
10329
|
+
..Default::default()
|
|
9607
10330
|
}
|
|
9608
10331
|
}
|
|
9609
10332
|
}
|
|
@@ -9624,6 +10347,7 @@ impl From<liter_llm::types::ChatCompletionResponse> for ChatCompletionResponse {
|
|
|
9624
10347
|
}
|
|
9625
10348
|
}
|
|
9626
10349
|
|
|
10350
|
+
#[allow(clippy::needless_update)]
|
|
9627
10351
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
9628
10352
|
impl From<Choice> for liter_llm::types::Choice {
|
|
9629
10353
|
fn from(val: Choice) -> Self {
|
|
@@ -9631,6 +10355,7 @@ impl From<Choice> for liter_llm::types::Choice {
|
|
|
9631
10355
|
index: val.index,
|
|
9632
10356
|
message: val.message.into(),
|
|
9633
10357
|
finish_reason: val.finish_reason.map(Into::into),
|
|
10358
|
+
..Default::default()
|
|
9634
10359
|
}
|
|
9635
10360
|
}
|
|
9636
10361
|
}
|
|
@@ -9708,6 +10433,7 @@ impl From<liter_llm::types::StreamFunctionCall> for StreamFunctionCall {
|
|
|
9708
10433
|
}
|
|
9709
10434
|
}
|
|
9710
10435
|
|
|
10436
|
+
#[allow(clippy::needless_update)]
|
|
9711
10437
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
9712
10438
|
impl From<EmbeddingRequest> for liter_llm::types::EmbeddingRequest {
|
|
9713
10439
|
fn from(val: EmbeddingRequest) -> Self {
|
|
@@ -9717,6 +10443,7 @@ impl From<EmbeddingRequest> for liter_llm::types::EmbeddingRequest {
|
|
|
9717
10443
|
encoding_format: val.encoding_format.map(Into::into),
|
|
9718
10444
|
dimensions: val.dimensions,
|
|
9719
10445
|
user: val.user,
|
|
10446
|
+
..Default::default()
|
|
9720
10447
|
}
|
|
9721
10448
|
}
|
|
9722
10449
|
}
|
|
@@ -9780,6 +10507,7 @@ impl From<liter_llm::types::EmbeddingObject> for EmbeddingObject {
|
|
|
9780
10507
|
}
|
|
9781
10508
|
}
|
|
9782
10509
|
|
|
10510
|
+
#[allow(clippy::needless_update)]
|
|
9783
10511
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
9784
10512
|
impl From<CreateImageRequest> for liter_llm::types::CreateImageRequest {
|
|
9785
10513
|
fn from(val: CreateImageRequest) -> Self {
|
|
@@ -9792,6 +10520,7 @@ impl From<CreateImageRequest> for liter_llm::types::CreateImageRequest {
|
|
|
9792
10520
|
style: val.style,
|
|
9793
10521
|
response_format: val.response_format,
|
|
9794
10522
|
user: val.user,
|
|
10523
|
+
..Default::default()
|
|
9795
10524
|
}
|
|
9796
10525
|
}
|
|
9797
10526
|
}
|
|
@@ -9812,12 +10541,14 @@ impl From<liter_llm::types::CreateImageRequest> for CreateImageRequest {
|
|
|
9812
10541
|
}
|
|
9813
10542
|
}
|
|
9814
10543
|
|
|
10544
|
+
#[allow(clippy::needless_update)]
|
|
9815
10545
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
9816
10546
|
impl From<ImagesResponse> for liter_llm::types::ImagesResponse {
|
|
9817
10547
|
fn from(val: ImagesResponse) -> Self {
|
|
9818
10548
|
Self {
|
|
9819
10549
|
created: val.created,
|
|
9820
10550
|
data: val.data.into_iter().map(Into::into).collect(),
|
|
10551
|
+
..Default::default()
|
|
9821
10552
|
}
|
|
9822
10553
|
}
|
|
9823
10554
|
}
|
|
@@ -9832,6 +10563,7 @@ impl From<liter_llm::types::ImagesResponse> for ImagesResponse {
|
|
|
9832
10563
|
}
|
|
9833
10564
|
}
|
|
9834
10565
|
|
|
10566
|
+
#[allow(clippy::needless_update)]
|
|
9835
10567
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
9836
10568
|
impl From<Image> for liter_llm::types::Image {
|
|
9837
10569
|
fn from(val: Image) -> Self {
|
|
@@ -9839,6 +10571,7 @@ impl From<Image> for liter_llm::types::Image {
|
|
|
9839
10571
|
url: val.url,
|
|
9840
10572
|
b64_json: val.b64_json,
|
|
9841
10573
|
revised_prompt: val.revised_prompt,
|
|
10574
|
+
..Default::default()
|
|
9842
10575
|
}
|
|
9843
10576
|
}
|
|
9844
10577
|
}
|
|
@@ -9854,12 +10587,14 @@ impl From<liter_llm::types::Image> for Image {
|
|
|
9854
10587
|
}
|
|
9855
10588
|
}
|
|
9856
10589
|
|
|
10590
|
+
#[allow(clippy::needless_update)]
|
|
9857
10591
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
9858
10592
|
impl From<DecodedDataUrl> for liter_llm::image::DecodedDataUrl {
|
|
9859
10593
|
fn from(val: DecodedDataUrl) -> Self {
|
|
9860
10594
|
Self {
|
|
9861
10595
|
mime: val.mime,
|
|
9862
10596
|
data: val.data.to_vec().into(),
|
|
10597
|
+
..Default::default()
|
|
9863
10598
|
}
|
|
9864
10599
|
}
|
|
9865
10600
|
}
|
|
@@ -9874,6 +10609,7 @@ impl From<liter_llm::image::DecodedDataUrl> for DecodedDataUrl {
|
|
|
9874
10609
|
}
|
|
9875
10610
|
}
|
|
9876
10611
|
|
|
10612
|
+
#[allow(clippy::needless_update)]
|
|
9877
10613
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
9878
10614
|
impl From<CreateSpeechRequest> for liter_llm::types::CreateSpeechRequest {
|
|
9879
10615
|
fn from(val: CreateSpeechRequest) -> Self {
|
|
@@ -9883,6 +10619,7 @@ impl From<CreateSpeechRequest> for liter_llm::types::CreateSpeechRequest {
|
|
|
9883
10619
|
voice: val.voice,
|
|
9884
10620
|
response_format: val.response_format,
|
|
9885
10621
|
speed: val.speed,
|
|
10622
|
+
..Default::default()
|
|
9886
10623
|
}
|
|
9887
10624
|
}
|
|
9888
10625
|
}
|
|
@@ -9900,6 +10637,7 @@ impl From<liter_llm::types::CreateSpeechRequest> for CreateSpeechRequest {
|
|
|
9900
10637
|
}
|
|
9901
10638
|
}
|
|
9902
10639
|
|
|
10640
|
+
#[allow(clippy::needless_update)]
|
|
9903
10641
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
9904
10642
|
impl From<CreateTranscriptionRequest> for liter_llm::types::CreateTranscriptionRequest {
|
|
9905
10643
|
fn from(val: CreateTranscriptionRequest) -> Self {
|
|
@@ -9910,6 +10648,7 @@ impl From<CreateTranscriptionRequest> for liter_llm::types::CreateTranscriptionR
|
|
|
9910
10648
|
prompt: val.prompt,
|
|
9911
10649
|
response_format: val.response_format,
|
|
9912
10650
|
temperature: val.temperature,
|
|
10651
|
+
..Default::default()
|
|
9913
10652
|
}
|
|
9914
10653
|
}
|
|
9915
10654
|
}
|
|
@@ -9928,6 +10667,7 @@ impl From<liter_llm::types::CreateTranscriptionRequest> for CreateTranscriptionR
|
|
|
9928
10667
|
}
|
|
9929
10668
|
}
|
|
9930
10669
|
|
|
10670
|
+
#[allow(clippy::needless_update)]
|
|
9931
10671
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
9932
10672
|
impl From<TranscriptionResponse> for liter_llm::types::TranscriptionResponse {
|
|
9933
10673
|
fn from(val: TranscriptionResponse) -> Self {
|
|
@@ -9936,6 +10676,7 @@ impl From<TranscriptionResponse> for liter_llm::types::TranscriptionResponse {
|
|
|
9936
10676
|
language: val.language,
|
|
9937
10677
|
duration: val.duration,
|
|
9938
10678
|
segments: val.segments.map(|v| v.into_iter().map(Into::into).collect()),
|
|
10679
|
+
..Default::default()
|
|
9939
10680
|
}
|
|
9940
10681
|
}
|
|
9941
10682
|
}
|
|
@@ -9952,6 +10693,7 @@ impl From<liter_llm::types::TranscriptionResponse> for TranscriptionResponse {
|
|
|
9952
10693
|
}
|
|
9953
10694
|
}
|
|
9954
10695
|
|
|
10696
|
+
#[allow(clippy::needless_update)]
|
|
9955
10697
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
9956
10698
|
impl From<TranscriptionSegment> for liter_llm::types::TranscriptionSegment {
|
|
9957
10699
|
fn from(val: TranscriptionSegment) -> Self {
|
|
@@ -9960,6 +10702,7 @@ impl From<TranscriptionSegment> for liter_llm::types::TranscriptionSegment {
|
|
|
9960
10702
|
start: val.start,
|
|
9961
10703
|
end: val.end,
|
|
9962
10704
|
text: val.text,
|
|
10705
|
+
..Default::default()
|
|
9963
10706
|
}
|
|
9964
10707
|
}
|
|
9965
10708
|
}
|
|
@@ -9976,12 +10719,14 @@ impl From<liter_llm::types::TranscriptionSegment> for TranscriptionSegment {
|
|
|
9976
10719
|
}
|
|
9977
10720
|
}
|
|
9978
10721
|
|
|
10722
|
+
#[allow(clippy::needless_update)]
|
|
9979
10723
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
9980
10724
|
impl From<ModerationRequest> for liter_llm::types::ModerationRequest {
|
|
9981
10725
|
fn from(val: ModerationRequest) -> Self {
|
|
9982
10726
|
Self {
|
|
9983
10727
|
input: val.input.into(),
|
|
9984
10728
|
model: val.model,
|
|
10729
|
+
..Default::default()
|
|
9985
10730
|
}
|
|
9986
10731
|
}
|
|
9987
10732
|
}
|
|
@@ -10040,6 +10785,7 @@ impl From<liter_llm::types::ModerationResult> for ModerationResult {
|
|
|
10040
10785
|
}
|
|
10041
10786
|
}
|
|
10042
10787
|
|
|
10788
|
+
#[allow(clippy::needless_update)]
|
|
10043
10789
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
10044
10790
|
impl From<ModerationCategories> for liter_llm::types::ModerationCategories {
|
|
10045
10791
|
fn from(val: ModerationCategories) -> Self {
|
|
@@ -10055,6 +10801,7 @@ impl From<ModerationCategories> for liter_llm::types::ModerationCategories {
|
|
|
10055
10801
|
self_harm_instructions: val.self_harm_instructions,
|
|
10056
10802
|
harassment_threatening: val.harassment_threatening,
|
|
10057
10803
|
violence: val.violence,
|
|
10804
|
+
..Default::default()
|
|
10058
10805
|
}
|
|
10059
10806
|
}
|
|
10060
10807
|
}
|
|
@@ -10078,6 +10825,7 @@ impl From<liter_llm::types::ModerationCategories> for ModerationCategories {
|
|
|
10078
10825
|
}
|
|
10079
10826
|
}
|
|
10080
10827
|
|
|
10828
|
+
#[allow(clippy::needless_update)]
|
|
10081
10829
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
10082
10830
|
impl From<ModerationCategoryScores> for liter_llm::types::ModerationCategoryScores {
|
|
10083
10831
|
fn from(val: ModerationCategoryScores) -> Self {
|
|
@@ -10093,6 +10841,7 @@ impl From<ModerationCategoryScores> for liter_llm::types::ModerationCategoryScor
|
|
|
10093
10841
|
self_harm_instructions: val.self_harm_instructions,
|
|
10094
10842
|
harassment_threatening: val.harassment_threatening,
|
|
10095
10843
|
violence: val.violence,
|
|
10844
|
+
..Default::default()
|
|
10096
10845
|
}
|
|
10097
10846
|
}
|
|
10098
10847
|
}
|
|
@@ -10116,6 +10865,7 @@ impl From<liter_llm::types::ModerationCategoryScores> for ModerationCategoryScor
|
|
|
10116
10865
|
}
|
|
10117
10866
|
}
|
|
10118
10867
|
|
|
10868
|
+
#[allow(clippy::needless_update)]
|
|
10119
10869
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
10120
10870
|
impl From<RerankRequest> for liter_llm::types::RerankRequest {
|
|
10121
10871
|
fn from(val: RerankRequest) -> Self {
|
|
@@ -10125,6 +10875,7 @@ impl From<RerankRequest> for liter_llm::types::RerankRequest {
|
|
|
10125
10875
|
documents: val.documents.into_iter().map(Into::into).collect(),
|
|
10126
10876
|
top_n: val.top_n,
|
|
10127
10877
|
return_documents: val.return_documents,
|
|
10878
|
+
..Default::default()
|
|
10128
10879
|
}
|
|
10129
10880
|
}
|
|
10130
10881
|
}
|
|
@@ -10202,6 +10953,7 @@ impl From<liter_llm::types::RerankResultDocument> for RerankResultDocument {
|
|
|
10202
10953
|
}
|
|
10203
10954
|
}
|
|
10204
10955
|
|
|
10956
|
+
#[allow(clippy::needless_update)]
|
|
10205
10957
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
10206
10958
|
impl From<SearchRequest> for liter_llm::types::SearchRequest {
|
|
10207
10959
|
fn from(val: SearchRequest) -> Self {
|
|
@@ -10211,6 +10963,7 @@ impl From<SearchRequest> for liter_llm::types::SearchRequest {
|
|
|
10211
10963
|
max_results: val.max_results,
|
|
10212
10964
|
search_domain_filter: val.search_domain_filter.map(|v| v.into_iter().collect()),
|
|
10213
10965
|
country: val.country,
|
|
10966
|
+
..Default::default()
|
|
10214
10967
|
}
|
|
10215
10968
|
}
|
|
10216
10969
|
}
|
|
@@ -10272,6 +11025,7 @@ impl From<liter_llm::types::SearchResult> for SearchResult {
|
|
|
10272
11025
|
}
|
|
10273
11026
|
}
|
|
10274
11027
|
|
|
11028
|
+
#[allow(clippy::needless_update)]
|
|
10275
11029
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
10276
11030
|
impl From<OcrRequest> for liter_llm::types::OcrRequest {
|
|
10277
11031
|
fn from(val: OcrRequest) -> Self {
|
|
@@ -10280,6 +11034,7 @@ impl From<OcrRequest> for liter_llm::types::OcrRequest {
|
|
|
10280
11034
|
document: val.document.into(),
|
|
10281
11035
|
pages: val.pages.map(|v| v.into_iter().collect()),
|
|
10282
11036
|
include_image_base64: val.include_image_base64,
|
|
11037
|
+
..Default::default()
|
|
10283
11038
|
}
|
|
10284
11039
|
}
|
|
10285
11040
|
}
|
|
@@ -10382,12 +11137,14 @@ impl From<liter_llm::types::PageDimensions> for PageDimensions {
|
|
|
10382
11137
|
}
|
|
10383
11138
|
}
|
|
10384
11139
|
|
|
11140
|
+
#[allow(clippy::needless_update)]
|
|
10385
11141
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
10386
11142
|
impl From<ModelsListResponse> for liter_llm::types::ModelsListResponse {
|
|
10387
11143
|
fn from(val: ModelsListResponse) -> Self {
|
|
10388
11144
|
Self {
|
|
10389
11145
|
object: val.object,
|
|
10390
11146
|
data: val.data.into_iter().map(Into::into).collect(),
|
|
11147
|
+
..Default::default()
|
|
10391
11148
|
}
|
|
10392
11149
|
}
|
|
10393
11150
|
}
|
|
@@ -10402,6 +11159,7 @@ impl From<liter_llm::types::ModelsListResponse> for ModelsListResponse {
|
|
|
10402
11159
|
}
|
|
10403
11160
|
}
|
|
10404
11161
|
|
|
11162
|
+
#[allow(clippy::needless_update)]
|
|
10405
11163
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
10406
11164
|
impl From<ModelObject> for liter_llm::types::ModelObject {
|
|
10407
11165
|
fn from(val: ModelObject) -> Self {
|
|
@@ -10410,6 +11168,7 @@ impl From<ModelObject> for liter_llm::types::ModelObject {
|
|
|
10410
11168
|
object: val.object,
|
|
10411
11169
|
created: val.created,
|
|
10412
11170
|
owned_by: val.owned_by,
|
|
11171
|
+
..Default::default()
|
|
10413
11172
|
}
|
|
10414
11173
|
}
|
|
10415
11174
|
}
|
|
@@ -10426,6 +11185,7 @@ impl From<liter_llm::types::ModelObject> for ModelObject {
|
|
|
10426
11185
|
}
|
|
10427
11186
|
}
|
|
10428
11187
|
|
|
11188
|
+
#[allow(clippy::needless_update)]
|
|
10429
11189
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
10430
11190
|
impl From<CreateFileRequest> for liter_llm::types::CreateFileRequest {
|
|
10431
11191
|
fn from(val: CreateFileRequest) -> Self {
|
|
@@ -10433,6 +11193,7 @@ impl From<CreateFileRequest> for liter_llm::types::CreateFileRequest {
|
|
|
10433
11193
|
file: val.file,
|
|
10434
11194
|
purpose: val.purpose.into(),
|
|
10435
11195
|
filename: val.filename,
|
|
11196
|
+
..Default::default()
|
|
10436
11197
|
}
|
|
10437
11198
|
}
|
|
10438
11199
|
}
|
|
@@ -10448,6 +11209,7 @@ impl From<liter_llm::types::CreateFileRequest> for CreateFileRequest {
|
|
|
10448
11209
|
}
|
|
10449
11210
|
}
|
|
10450
11211
|
|
|
11212
|
+
#[allow(clippy::needless_update)]
|
|
10451
11213
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
10452
11214
|
impl From<FileObject> for liter_llm::types::FileObject {
|
|
10453
11215
|
fn from(val: FileObject) -> Self {
|
|
@@ -10459,6 +11221,7 @@ impl From<FileObject> for liter_llm::types::FileObject {
|
|
|
10459
11221
|
filename: val.filename,
|
|
10460
11222
|
purpose: val.purpose,
|
|
10461
11223
|
status: val.status,
|
|
11224
|
+
..Default::default()
|
|
10462
11225
|
}
|
|
10463
11226
|
}
|
|
10464
11227
|
}
|
|
@@ -10478,6 +11241,7 @@ impl From<liter_llm::types::FileObject> for FileObject {
|
|
|
10478
11241
|
}
|
|
10479
11242
|
}
|
|
10480
11243
|
|
|
11244
|
+
#[allow(clippy::needless_update)]
|
|
10481
11245
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
10482
11246
|
impl From<FileListResponse> for liter_llm::types::FileListResponse {
|
|
10483
11247
|
fn from(val: FileListResponse) -> Self {
|
|
@@ -10485,6 +11249,7 @@ impl From<FileListResponse> for liter_llm::types::FileListResponse {
|
|
|
10485
11249
|
object: val.object,
|
|
10486
11250
|
data: val.data.into_iter().map(Into::into).collect(),
|
|
10487
11251
|
has_more: val.has_more,
|
|
11252
|
+
..Default::default()
|
|
10488
11253
|
}
|
|
10489
11254
|
}
|
|
10490
11255
|
}
|
|
@@ -10500,6 +11265,7 @@ impl From<liter_llm::types::FileListResponse> for FileListResponse {
|
|
|
10500
11265
|
}
|
|
10501
11266
|
}
|
|
10502
11267
|
|
|
11268
|
+
#[allow(clippy::needless_update)]
|
|
10503
11269
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
10504
11270
|
impl From<FileListQuery> for liter_llm::types::FileListQuery {
|
|
10505
11271
|
fn from(val: FileListQuery) -> Self {
|
|
@@ -10507,6 +11273,7 @@ impl From<FileListQuery> for liter_llm::types::FileListQuery {
|
|
|
10507
11273
|
purpose: val.purpose,
|
|
10508
11274
|
limit: val.limit,
|
|
10509
11275
|
after: val.after,
|
|
11276
|
+
..Default::default()
|
|
10510
11277
|
}
|
|
10511
11278
|
}
|
|
10512
11279
|
}
|
|
@@ -10522,6 +11289,7 @@ impl From<liter_llm::types::FileListQuery> for FileListQuery {
|
|
|
10522
11289
|
}
|
|
10523
11290
|
}
|
|
10524
11291
|
|
|
11292
|
+
#[allow(clippy::needless_update)]
|
|
10525
11293
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
10526
11294
|
impl From<DeleteResponse> for liter_llm::types::DeleteResponse {
|
|
10527
11295
|
fn from(val: DeleteResponse) -> Self {
|
|
@@ -10529,6 +11297,7 @@ impl From<DeleteResponse> for liter_llm::types::DeleteResponse {
|
|
|
10529
11297
|
id: val.id,
|
|
10530
11298
|
object: val.object,
|
|
10531
11299
|
deleted: val.deleted,
|
|
11300
|
+
..Default::default()
|
|
10532
11301
|
}
|
|
10533
11302
|
}
|
|
10534
11303
|
}
|
|
@@ -10544,6 +11313,7 @@ impl From<liter_llm::types::DeleteResponse> for DeleteResponse {
|
|
|
10544
11313
|
}
|
|
10545
11314
|
}
|
|
10546
11315
|
|
|
11316
|
+
#[allow(clippy::needless_update)]
|
|
10547
11317
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
10548
11318
|
impl From<CreateBatchRequest> for liter_llm::types::CreateBatchRequest {
|
|
10549
11319
|
fn from(val: CreateBatchRequest) -> Self {
|
|
@@ -10552,6 +11322,7 @@ impl From<CreateBatchRequest> for liter_llm::types::CreateBatchRequest {
|
|
|
10552
11322
|
endpoint: val.endpoint,
|
|
10553
11323
|
completion_window: val.completion_window,
|
|
10554
11324
|
metadata: val.metadata.as_ref().and_then(|s| serde_json::from_str(s).ok()),
|
|
11325
|
+
..Default::default()
|
|
10555
11326
|
}
|
|
10556
11327
|
}
|
|
10557
11328
|
}
|
|
@@ -10568,6 +11339,7 @@ impl From<liter_llm::types::CreateBatchRequest> for CreateBatchRequest {
|
|
|
10568
11339
|
}
|
|
10569
11340
|
}
|
|
10570
11341
|
|
|
11342
|
+
#[allow(clippy::needless_update)]
|
|
10571
11343
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
10572
11344
|
impl From<BatchObject> for liter_llm::types::BatchObject {
|
|
10573
11345
|
fn from(val: BatchObject) -> Self {
|
|
@@ -10586,6 +11358,7 @@ impl From<BatchObject> for liter_llm::types::BatchObject {
|
|
|
10586
11358
|
expired_at: val.expired_at,
|
|
10587
11359
|
request_counts: val.request_counts.map(Into::into),
|
|
10588
11360
|
metadata: val.metadata.as_ref().and_then(|s| serde_json::from_str(s).ok()),
|
|
11361
|
+
..Default::default()
|
|
10589
11362
|
}
|
|
10590
11363
|
}
|
|
10591
11364
|
}
|
|
@@ -10612,6 +11385,7 @@ impl From<liter_llm::types::BatchObject> for BatchObject {
|
|
|
10612
11385
|
}
|
|
10613
11386
|
}
|
|
10614
11387
|
|
|
11388
|
+
#[allow(clippy::needless_update)]
|
|
10615
11389
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
10616
11390
|
impl From<BatchRequestCounts> for liter_llm::types::BatchRequestCounts {
|
|
10617
11391
|
fn from(val: BatchRequestCounts) -> Self {
|
|
@@ -10619,6 +11393,7 @@ impl From<BatchRequestCounts> for liter_llm::types::BatchRequestCounts {
|
|
|
10619
11393
|
total: val.total,
|
|
10620
11394
|
completed: val.completed,
|
|
10621
11395
|
failed: val.failed,
|
|
11396
|
+
..Default::default()
|
|
10622
11397
|
}
|
|
10623
11398
|
}
|
|
10624
11399
|
}
|
|
@@ -10634,6 +11409,7 @@ impl From<liter_llm::types::BatchRequestCounts> for BatchRequestCounts {
|
|
|
10634
11409
|
}
|
|
10635
11410
|
}
|
|
10636
11411
|
|
|
11412
|
+
#[allow(clippy::needless_update)]
|
|
10637
11413
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
10638
11414
|
impl From<BatchListResponse> for liter_llm::types::BatchListResponse {
|
|
10639
11415
|
fn from(val: BatchListResponse) -> Self {
|
|
@@ -10643,6 +11419,7 @@ impl From<BatchListResponse> for liter_llm::types::BatchListResponse {
|
|
|
10643
11419
|
has_more: val.has_more,
|
|
10644
11420
|
first_id: val.first_id,
|
|
10645
11421
|
last_id: val.last_id,
|
|
11422
|
+
..Default::default()
|
|
10646
11423
|
}
|
|
10647
11424
|
}
|
|
10648
11425
|
}
|
|
@@ -10660,12 +11437,14 @@ impl From<liter_llm::types::BatchListResponse> for BatchListResponse {
|
|
|
10660
11437
|
}
|
|
10661
11438
|
}
|
|
10662
11439
|
|
|
11440
|
+
#[allow(clippy::needless_update)]
|
|
10663
11441
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
10664
11442
|
impl From<BatchListQuery> for liter_llm::types::BatchListQuery {
|
|
10665
11443
|
fn from(val: BatchListQuery) -> Self {
|
|
10666
11444
|
Self {
|
|
10667
11445
|
limit: val.limit,
|
|
10668
11446
|
after: val.after,
|
|
11447
|
+
..Default::default()
|
|
10669
11448
|
}
|
|
10670
11449
|
}
|
|
10671
11450
|
}
|
|
@@ -10680,6 +11459,7 @@ impl From<liter_llm::types::BatchListQuery> for BatchListQuery {
|
|
|
10680
11459
|
}
|
|
10681
11460
|
}
|
|
10682
11461
|
|
|
11462
|
+
#[allow(clippy::needless_update)]
|
|
10683
11463
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
10684
11464
|
impl From<CreateResponseRequest> for liter_llm::types::CreateResponseRequest {
|
|
10685
11465
|
fn from(val: CreateResponseRequest) -> Self {
|
|
@@ -10691,6 +11471,7 @@ impl From<CreateResponseRequest> for liter_llm::types::CreateResponseRequest {
|
|
|
10691
11471
|
temperature: val.temperature,
|
|
10692
11472
|
max_output_tokens: val.max_output_tokens,
|
|
10693
11473
|
metadata: val.metadata.as_ref().and_then(|s| serde_json::from_str(s).ok()),
|
|
11474
|
+
..Default::default()
|
|
10694
11475
|
}
|
|
10695
11476
|
}
|
|
10696
11477
|
}
|
|
@@ -10710,12 +11491,14 @@ impl From<liter_llm::types::CreateResponseRequest> for CreateResponseRequest {
|
|
|
10710
11491
|
}
|
|
10711
11492
|
}
|
|
10712
11493
|
|
|
11494
|
+
#[allow(clippy::needless_update)]
|
|
10713
11495
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
10714
11496
|
impl From<ResponseTool> for liter_llm::types::ResponseTool {
|
|
10715
11497
|
fn from(val: ResponseTool) -> Self {
|
|
10716
11498
|
Self {
|
|
10717
11499
|
tool_type: val.tool_type,
|
|
10718
11500
|
config: serde_json::from_str(&val.config).unwrap_or_default(),
|
|
11501
|
+
..Default::default()
|
|
10719
11502
|
}
|
|
10720
11503
|
}
|
|
10721
11504
|
}
|
|
@@ -10730,6 +11513,7 @@ impl From<liter_llm::types::ResponseTool> for ResponseTool {
|
|
|
10730
11513
|
}
|
|
10731
11514
|
}
|
|
10732
11515
|
|
|
11516
|
+
#[allow(clippy::needless_update)]
|
|
10733
11517
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
10734
11518
|
impl From<ResponseObject> for liter_llm::types::ResponseObject {
|
|
10735
11519
|
fn from(val: ResponseObject) -> Self {
|
|
@@ -10742,6 +11526,7 @@ impl From<ResponseObject> for liter_llm::types::ResponseObject {
|
|
|
10742
11526
|
output: val.output.into_iter().map(Into::into).collect(),
|
|
10743
11527
|
usage: val.usage.map(Into::into),
|
|
10744
11528
|
error: val.error.as_ref().and_then(|s| serde_json::from_str(s).ok()),
|
|
11529
|
+
..Default::default()
|
|
10745
11530
|
}
|
|
10746
11531
|
}
|
|
10747
11532
|
}
|
|
@@ -10762,12 +11547,14 @@ impl From<liter_llm::types::ResponseObject> for ResponseObject {
|
|
|
10762
11547
|
}
|
|
10763
11548
|
}
|
|
10764
11549
|
|
|
11550
|
+
#[allow(clippy::needless_update)]
|
|
10765
11551
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
10766
11552
|
impl From<ResponseOutputItem> for liter_llm::types::ResponseOutputItem {
|
|
10767
11553
|
fn from(val: ResponseOutputItem) -> Self {
|
|
10768
11554
|
Self {
|
|
10769
11555
|
item_type: val.item_type,
|
|
10770
11556
|
content: serde_json::from_str(&val.content).unwrap_or_default(),
|
|
11557
|
+
..Default::default()
|
|
10771
11558
|
}
|
|
10772
11559
|
}
|
|
10773
11560
|
}
|
|
@@ -10782,6 +11569,7 @@ impl From<liter_llm::types::ResponseOutputItem> for ResponseOutputItem {
|
|
|
10782
11569
|
}
|
|
10783
11570
|
}
|
|
10784
11571
|
|
|
11572
|
+
#[allow(clippy::needless_update)]
|
|
10785
11573
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
10786
11574
|
impl From<ResponseUsage> for liter_llm::types::ResponseUsage {
|
|
10787
11575
|
fn from(val: ResponseUsage) -> Self {
|
|
@@ -10789,6 +11577,7 @@ impl From<ResponseUsage> for liter_llm::types::ResponseUsage {
|
|
|
10789
11577
|
input_tokens: val.input_tokens,
|
|
10790
11578
|
output_tokens: val.output_tokens,
|
|
10791
11579
|
total_tokens: val.total_tokens,
|
|
11580
|
+
..Default::default()
|
|
10792
11581
|
}
|
|
10793
11582
|
}
|
|
10794
11583
|
}
|
|
@@ -10804,6 +11593,7 @@ impl From<liter_llm::types::ResponseUsage> for ResponseUsage {
|
|
|
10804
11593
|
}
|
|
10805
11594
|
}
|
|
10806
11595
|
|
|
11596
|
+
#[allow(clippy::needless_update)]
|
|
10807
11597
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
10808
11598
|
impl From<WaitForBatchConfig> for liter_llm::client::WaitForBatchConfig {
|
|
10809
11599
|
fn from(val: WaitForBatchConfig) -> Self {
|
|
@@ -10812,6 +11602,7 @@ impl From<WaitForBatchConfig> for liter_llm::client::WaitForBatchConfig {
|
|
|
10812
11602
|
max_interval_secs: val.max_interval_secs,
|
|
10813
11603
|
backoff_multiplier: val.backoff_multiplier,
|
|
10814
11604
|
timeout_secs: val.timeout_secs,
|
|
11605
|
+
..Default::default()
|
|
10815
11606
|
}
|
|
10816
11607
|
}
|
|
10817
11608
|
}
|
|
@@ -10852,6 +11643,7 @@ impl From<liter_llm::provider::custom::CustomProviderConfig> for CustomProviderC
|
|
|
10852
11643
|
}
|
|
10853
11644
|
}
|
|
10854
11645
|
|
|
11646
|
+
#[allow(clippy::needless_update)]
|
|
10855
11647
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
10856
11648
|
impl From<ProviderCapabilities> for liter_llm::provider::ProviderCapabilities {
|
|
10857
11649
|
fn from(val: ProviderCapabilities) -> Self {
|
|
@@ -10863,6 +11655,7 @@ impl From<ProviderCapabilities> for liter_llm::provider::ProviderCapabilities {
|
|
|
10863
11655
|
audio_in: val.audio_in,
|
|
10864
11656
|
audio_out: val.audio_out,
|
|
10865
11657
|
video_in: val.video_in,
|
|
11658
|
+
..Default::default()
|
|
10866
11659
|
}
|
|
10867
11660
|
}
|
|
10868
11661
|
}
|
|
@@ -10936,6 +11729,97 @@ impl From<liter_llm::provider::AuthConfig> for AuthConfig {
|
|
|
10936
11729
|
}
|
|
10937
11730
|
}
|
|
10938
11731
|
|
|
11732
|
+
#[allow(clippy::needless_update)]
|
|
11733
|
+
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
11734
|
+
impl From<ModelInfo> for liter_llm::ModelInfo {
|
|
11735
|
+
fn from(val: ModelInfo) -> Self {
|
|
11736
|
+
Self {
|
|
11737
|
+
input_cost_per_token: val.input_cost_per_token,
|
|
11738
|
+
output_cost_per_token: val.output_cost_per_token,
|
|
11739
|
+
cache_read_input_token_cost: val.cache_read_input_token_cost,
|
|
11740
|
+
cache_creation_input_token_cost: val.cache_creation_input_token_cost,
|
|
11741
|
+
input_cost_per_audio_token: val.input_cost_per_audio_token,
|
|
11742
|
+
output_cost_per_audio_token: val.output_cost_per_audio_token,
|
|
11743
|
+
output_cost_per_reasoning_token: val.output_cost_per_reasoning_token,
|
|
11744
|
+
max_tokens: val.max_tokens,
|
|
11745
|
+
max_input_tokens: val.max_input_tokens,
|
|
11746
|
+
max_output_tokens: val.max_output_tokens,
|
|
11747
|
+
mode: val.mode,
|
|
11748
|
+
supports_vision: val.supports_vision,
|
|
11749
|
+
supports_function_calling: val.supports_function_calling,
|
|
11750
|
+
supports_reasoning: val.supports_reasoning,
|
|
11751
|
+
supports_structured_output: val.supports_structured_output,
|
|
11752
|
+
supports_audio_input: val.supports_audio_input,
|
|
11753
|
+
supports_audio_output: val.supports_audio_output,
|
|
11754
|
+
supports_prompt_caching: val.supports_prompt_caching,
|
|
11755
|
+
tiers: val.tiers.into_iter().map(Into::into).collect(),
|
|
11756
|
+
..Default::default()
|
|
11757
|
+
}
|
|
11758
|
+
}
|
|
11759
|
+
}
|
|
11760
|
+
|
|
11761
|
+
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
11762
|
+
impl From<liter_llm::ModelInfo> for ModelInfo {
|
|
11763
|
+
fn from(val: liter_llm::ModelInfo) -> Self {
|
|
11764
|
+
Self {
|
|
11765
|
+
input_cost_per_token: val.input_cost_per_token,
|
|
11766
|
+
output_cost_per_token: val.output_cost_per_token,
|
|
11767
|
+
cache_read_input_token_cost: val.cache_read_input_token_cost,
|
|
11768
|
+
cache_creation_input_token_cost: val.cache_creation_input_token_cost,
|
|
11769
|
+
input_cost_per_audio_token: val.input_cost_per_audio_token,
|
|
11770
|
+
output_cost_per_audio_token: val.output_cost_per_audio_token,
|
|
11771
|
+
output_cost_per_reasoning_token: val.output_cost_per_reasoning_token,
|
|
11772
|
+
max_tokens: val.max_tokens,
|
|
11773
|
+
max_input_tokens: val.max_input_tokens,
|
|
11774
|
+
max_output_tokens: val.max_output_tokens,
|
|
11775
|
+
mode: val.mode.map(|v| v.to_string()),
|
|
11776
|
+
supports_vision: val.supports_vision,
|
|
11777
|
+
supports_function_calling: val.supports_function_calling,
|
|
11778
|
+
supports_reasoning: val.supports_reasoning,
|
|
11779
|
+
supports_structured_output: val.supports_structured_output,
|
|
11780
|
+
supports_audio_input: val.supports_audio_input,
|
|
11781
|
+
supports_audio_output: val.supports_audio_output,
|
|
11782
|
+
supports_prompt_caching: val.supports_prompt_caching,
|
|
11783
|
+
tiers: val.tiers.into_iter().map(Into::into).collect(),
|
|
11784
|
+
}
|
|
11785
|
+
}
|
|
11786
|
+
}
|
|
11787
|
+
|
|
11788
|
+
#[allow(clippy::needless_update)]
|
|
11789
|
+
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
11790
|
+
impl From<ModelTier> for liter_llm::ModelTier {
|
|
11791
|
+
fn from(val: ModelTier) -> Self {
|
|
11792
|
+
Self {
|
|
11793
|
+
min_context_tokens: val.min_context_tokens,
|
|
11794
|
+
input_cost_per_token: val.input_cost_per_token,
|
|
11795
|
+
output_cost_per_token: val.output_cost_per_token,
|
|
11796
|
+
cache_read_input_token_cost: val.cache_read_input_token_cost,
|
|
11797
|
+
cache_creation_input_token_cost: val.cache_creation_input_token_cost,
|
|
11798
|
+
input_cost_per_audio_token: val.input_cost_per_audio_token,
|
|
11799
|
+
output_cost_per_audio_token: val.output_cost_per_audio_token,
|
|
11800
|
+
output_cost_per_reasoning_token: val.output_cost_per_reasoning_token,
|
|
11801
|
+
..Default::default()
|
|
11802
|
+
}
|
|
11803
|
+
}
|
|
11804
|
+
}
|
|
11805
|
+
|
|
11806
|
+
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
11807
|
+
impl From<liter_llm::ModelTier> for ModelTier {
|
|
11808
|
+
fn from(val: liter_llm::ModelTier) -> Self {
|
|
11809
|
+
Self {
|
|
11810
|
+
min_context_tokens: val.min_context_tokens,
|
|
11811
|
+
input_cost_per_token: val.input_cost_per_token,
|
|
11812
|
+
output_cost_per_token: val.output_cost_per_token,
|
|
11813
|
+
cache_read_input_token_cost: val.cache_read_input_token_cost,
|
|
11814
|
+
cache_creation_input_token_cost: val.cache_creation_input_token_cost,
|
|
11815
|
+
input_cost_per_audio_token: val.input_cost_per_audio_token,
|
|
11816
|
+
output_cost_per_audio_token: val.output_cost_per_audio_token,
|
|
11817
|
+
output_cost_per_reasoning_token: val.output_cost_per_reasoning_token,
|
|
11818
|
+
}
|
|
11819
|
+
}
|
|
11820
|
+
}
|
|
11821
|
+
|
|
11822
|
+
#[allow(clippy::needless_update)]
|
|
10939
11823
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
10940
11824
|
impl From<BudgetConfig> for liter_llm::BudgetConfig {
|
|
10941
11825
|
fn from(val: BudgetConfig) -> Self {
|
|
@@ -10943,6 +11827,7 @@ impl From<BudgetConfig> for liter_llm::BudgetConfig {
|
|
|
10943
11827
|
global_limit: val.global_limit,
|
|
10944
11828
|
model_limits: val.model_limits.into_iter().collect(),
|
|
10945
11829
|
enforcement: val.enforcement.into(),
|
|
11830
|
+
..Default::default()
|
|
10946
11831
|
}
|
|
10947
11832
|
}
|
|
10948
11833
|
}
|
|
@@ -10958,6 +11843,31 @@ impl From<liter_llm::BudgetConfig> for BudgetConfig {
|
|
|
10958
11843
|
}
|
|
10959
11844
|
}
|
|
10960
11845
|
|
|
11846
|
+
#[allow(clippy::needless_update)]
|
|
11847
|
+
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
11848
|
+
impl From<CacheConfig> for liter_llm::CacheConfig {
|
|
11849
|
+
fn from(val: CacheConfig) -> Self {
|
|
11850
|
+
Self {
|
|
11851
|
+
max_entries: val.max_entries,
|
|
11852
|
+
ttl: std::time::Duration::from_millis(val.ttl),
|
|
11853
|
+
backend: val.backend.into(),
|
|
11854
|
+
..Default::default()
|
|
11855
|
+
}
|
|
11856
|
+
}
|
|
11857
|
+
}
|
|
11858
|
+
|
|
11859
|
+
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
11860
|
+
impl From<liter_llm::CacheConfig> for CacheConfig {
|
|
11861
|
+
fn from(val: liter_llm::CacheConfig) -> Self {
|
|
11862
|
+
Self {
|
|
11863
|
+
max_entries: val.max_entries,
|
|
11864
|
+
ttl: val.ttl.as_millis() as u64,
|
|
11865
|
+
backend: val.backend.into(),
|
|
11866
|
+
}
|
|
11867
|
+
}
|
|
11868
|
+
}
|
|
11869
|
+
|
|
11870
|
+
#[allow(clippy::needless_update)]
|
|
10961
11871
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
10962
11872
|
impl From<RateLimitConfig> for liter_llm::RateLimitConfig {
|
|
10963
11873
|
fn from(val: RateLimitConfig) -> Self {
|
|
@@ -10965,6 +11875,7 @@ impl From<RateLimitConfig> for liter_llm::RateLimitConfig {
|
|
|
10965
11875
|
rpm: val.rpm,
|
|
10966
11876
|
tpm: val.tpm,
|
|
10967
11877
|
window: std::time::Duration::from_millis(val.window),
|
|
11878
|
+
..Default::default()
|
|
10968
11879
|
}
|
|
10969
11880
|
}
|
|
10970
11881
|
}
|
|
@@ -10991,6 +11902,32 @@ impl From<liter_llm::tower::IntentPrototype> for IntentPrototype {
|
|
|
10991
11902
|
}
|
|
10992
11903
|
}
|
|
10993
11904
|
|
|
11905
|
+
#[allow(clippy::needless_update)]
|
|
11906
|
+
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
11907
|
+
impl From<CatalogRefreshConfig> for liter_llm::cost::refresh::CatalogRefreshConfig {
|
|
11908
|
+
fn from(val: CatalogRefreshConfig) -> Self {
|
|
11909
|
+
Self {
|
|
11910
|
+
enabled: val.enabled,
|
|
11911
|
+
source_url: val.source_url,
|
|
11912
|
+
ttl_seconds: val.ttl_seconds,
|
|
11913
|
+
cache_path: val.cache_path,
|
|
11914
|
+
..Default::default()
|
|
11915
|
+
}
|
|
11916
|
+
}
|
|
11917
|
+
}
|
|
11918
|
+
|
|
11919
|
+
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
11920
|
+
impl From<liter_llm::cost::refresh::CatalogRefreshConfig> for CatalogRefreshConfig {
|
|
11921
|
+
fn from(val: liter_llm::cost::refresh::CatalogRefreshConfig) -> Self {
|
|
11922
|
+
Self {
|
|
11923
|
+
enabled: val.enabled,
|
|
11924
|
+
source_url: val.source_url.to_string(),
|
|
11925
|
+
ttl_seconds: val.ttl_seconds,
|
|
11926
|
+
cache_path: val.cache_path.map(|v| v.to_string()),
|
|
11927
|
+
}
|
|
11928
|
+
}
|
|
11929
|
+
}
|
|
11930
|
+
|
|
10994
11931
|
impl From<Message> for liter_llm::types::Message {
|
|
10995
11932
|
fn from(val: Message) -> Self {
|
|
10996
11933
|
match val {
|
|
@@ -11514,6 +12451,30 @@ impl From<liter_llm::Enforcement> for Enforcement {
|
|
|
11514
12451
|
}
|
|
11515
12452
|
}
|
|
11516
12453
|
|
|
12454
|
+
impl From<CacheBackend> for liter_llm::CacheBackend {
|
|
12455
|
+
fn from(val: CacheBackend) -> Self {
|
|
12456
|
+
match val {
|
|
12457
|
+
CacheBackend::Memory => Self::Memory,
|
|
12458
|
+
CacheBackend::OpenDal { scheme, config } => Self::OpenDal {
|
|
12459
|
+
scheme: scheme,
|
|
12460
|
+
config: serde_json::from_str(&config).unwrap_or_default(),
|
|
12461
|
+
},
|
|
12462
|
+
}
|
|
12463
|
+
}
|
|
12464
|
+
}
|
|
12465
|
+
|
|
12466
|
+
impl From<liter_llm::CacheBackend> for CacheBackend {
|
|
12467
|
+
fn from(val: liter_llm::CacheBackend) -> Self {
|
|
12468
|
+
match val {
|
|
12469
|
+
liter_llm::CacheBackend::Memory => Self::Memory,
|
|
12470
|
+
liter_llm::CacheBackend::OpenDal { scheme, config } => Self::OpenDal {
|
|
12471
|
+
scheme: scheme.to_string(),
|
|
12472
|
+
config: serde_json::to_string(&config).unwrap_or_default(),
|
|
12473
|
+
},
|
|
12474
|
+
}
|
|
12475
|
+
}
|
|
12476
|
+
}
|
|
12477
|
+
|
|
11517
12478
|
impl From<liter_llm::tower::CircuitState> for CircuitState {
|
|
11518
12479
|
fn from(val: liter_llm::tower::CircuitState) -> Self {
|
|
11519
12480
|
match val {
|
|
@@ -11533,6 +12494,26 @@ impl From<liter_llm::tower::HealthStatus> for HealthStatus {
|
|
|
11533
12494
|
}
|
|
11534
12495
|
}
|
|
11535
12496
|
|
|
12497
|
+
impl From<RefreshOutcome> for liter_llm::cost::refresh::RefreshOutcome {
|
|
12498
|
+
fn from(val: RefreshOutcome) -> Self {
|
|
12499
|
+
match val {
|
|
12500
|
+
RefreshOutcome::Disabled => Self::Disabled,
|
|
12501
|
+
RefreshOutcome::FromCache => Self::FromCache,
|
|
12502
|
+
RefreshOutcome::Fetched => Self::Fetched,
|
|
12503
|
+
}
|
|
12504
|
+
}
|
|
12505
|
+
}
|
|
12506
|
+
|
|
12507
|
+
impl From<liter_llm::cost::refresh::RefreshOutcome> for RefreshOutcome {
|
|
12508
|
+
fn from(val: liter_llm::cost::refresh::RefreshOutcome) -> Self {
|
|
12509
|
+
match val {
|
|
12510
|
+
liter_llm::cost::refresh::RefreshOutcome::Disabled => Self::Disabled,
|
|
12511
|
+
liter_llm::cost::refresh::RefreshOutcome::FromCache => Self::FromCache,
|
|
12512
|
+
liter_llm::cost::refresh::RefreshOutcome::Fetched => Self::Fetched,
|
|
12513
|
+
}
|
|
12514
|
+
}
|
|
12515
|
+
}
|
|
12516
|
+
|
|
11536
12517
|
/// Convert a `liter_llm::error::LiterLlmError` error to a Magnus runtime error.
|
|
11537
12518
|
#[allow(dead_code)]
|
|
11538
12519
|
fn liter_llm_error_to_magnus_err(e: liter_llm::error::LiterLlmError) -> magnus::Error {
|
|
@@ -11573,6 +12554,13 @@ impl LiterLlmErrorInfo {
|
|
|
11573
12554
|
}
|
|
11574
12555
|
}
|
|
11575
12556
|
|
|
12557
|
+
/// Convert a `liter_llm::cost::refresh::CatalogRefreshError` error to a Magnus runtime error.
|
|
12558
|
+
#[allow(dead_code)]
|
|
12559
|
+
fn catalog_refresh_error_to_magnus_err(e: liter_llm::cost::refresh::CatalogRefreshError) -> magnus::Error {
|
|
12560
|
+
let msg = e.to_string();
|
|
12561
|
+
magnus::Error::new(unsafe { magnus::Ruby::get_unchecked() }.exception_runtime_error(), msg)
|
|
12562
|
+
}
|
|
12563
|
+
|
|
11576
12564
|
#[derive(Clone)]
|
|
11577
12565
|
#[magnus::wrap(class = "LiterLlm::ChatStreamIterator")]
|
|
11578
12566
|
pub struct ChatStreamIterator {
|
|
@@ -12723,6 +13711,107 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
12723
13711
|
|
|
12724
13712
|
class.define_method("env_var", method!(AuthConfig::env_var, 0))?;
|
|
12725
13713
|
|
|
13714
|
+
let class = module.define_class("ModelInfo", ruby.class_object())?;
|
|
13715
|
+
|
|
13716
|
+
class.define_singleton_method("new", function!(ModelInfo::new, -1))?;
|
|
13717
|
+
|
|
13718
|
+
class.define_method("input_cost_per_token", method!(ModelInfo::input_cost_per_token, 0))?;
|
|
13719
|
+
|
|
13720
|
+
class.define_method("output_cost_per_token", method!(ModelInfo::output_cost_per_token, 0))?;
|
|
13721
|
+
|
|
13722
|
+
class.define_method(
|
|
13723
|
+
"cache_read_input_token_cost",
|
|
13724
|
+
method!(ModelInfo::cache_read_input_token_cost, 0),
|
|
13725
|
+
)?;
|
|
13726
|
+
|
|
13727
|
+
class.define_method(
|
|
13728
|
+
"cache_creation_input_token_cost",
|
|
13729
|
+
method!(ModelInfo::cache_creation_input_token_cost, 0),
|
|
13730
|
+
)?;
|
|
13731
|
+
|
|
13732
|
+
class.define_method(
|
|
13733
|
+
"input_cost_per_audio_token",
|
|
13734
|
+
method!(ModelInfo::input_cost_per_audio_token, 0),
|
|
13735
|
+
)?;
|
|
13736
|
+
|
|
13737
|
+
class.define_method(
|
|
13738
|
+
"output_cost_per_audio_token",
|
|
13739
|
+
method!(ModelInfo::output_cost_per_audio_token, 0),
|
|
13740
|
+
)?;
|
|
13741
|
+
|
|
13742
|
+
class.define_method(
|
|
13743
|
+
"output_cost_per_reasoning_token",
|
|
13744
|
+
method!(ModelInfo::output_cost_per_reasoning_token, 0),
|
|
13745
|
+
)?;
|
|
13746
|
+
|
|
13747
|
+
class.define_method("max_tokens", method!(ModelInfo::max_tokens, 0))?;
|
|
13748
|
+
|
|
13749
|
+
class.define_method("max_input_tokens", method!(ModelInfo::max_input_tokens, 0))?;
|
|
13750
|
+
|
|
13751
|
+
class.define_method("max_output_tokens", method!(ModelInfo::max_output_tokens, 0))?;
|
|
13752
|
+
|
|
13753
|
+
class.define_method("mode", method!(ModelInfo::mode, 0))?;
|
|
13754
|
+
|
|
13755
|
+
class.define_method("supports_vision", method!(ModelInfo::supports_vision, 0))?;
|
|
13756
|
+
|
|
13757
|
+
class.define_method(
|
|
13758
|
+
"supports_function_calling",
|
|
13759
|
+
method!(ModelInfo::supports_function_calling, 0),
|
|
13760
|
+
)?;
|
|
13761
|
+
|
|
13762
|
+
class.define_method("supports_reasoning", method!(ModelInfo::supports_reasoning, 0))?;
|
|
13763
|
+
|
|
13764
|
+
class.define_method(
|
|
13765
|
+
"supports_structured_output",
|
|
13766
|
+
method!(ModelInfo::supports_structured_output, 0),
|
|
13767
|
+
)?;
|
|
13768
|
+
|
|
13769
|
+
class.define_method("supports_audio_input", method!(ModelInfo::supports_audio_input, 0))?;
|
|
13770
|
+
|
|
13771
|
+
class.define_method("supports_audio_output", method!(ModelInfo::supports_audio_output, 0))?;
|
|
13772
|
+
|
|
13773
|
+
class.define_method(
|
|
13774
|
+
"supports_prompt_caching",
|
|
13775
|
+
method!(ModelInfo::supports_prompt_caching, 0),
|
|
13776
|
+
)?;
|
|
13777
|
+
|
|
13778
|
+
class.define_method("tiers", method!(ModelInfo::tiers, 0))?;
|
|
13779
|
+
|
|
13780
|
+
let class = module.define_class("ModelTier", ruby.class_object())?;
|
|
13781
|
+
|
|
13782
|
+
class.define_singleton_method("new", function!(ModelTier::new, -1))?;
|
|
13783
|
+
|
|
13784
|
+
class.define_method("min_context_tokens", method!(ModelTier::min_context_tokens, 0))?;
|
|
13785
|
+
|
|
13786
|
+
class.define_method("input_cost_per_token", method!(ModelTier::input_cost_per_token, 0))?;
|
|
13787
|
+
|
|
13788
|
+
class.define_method("output_cost_per_token", method!(ModelTier::output_cost_per_token, 0))?;
|
|
13789
|
+
|
|
13790
|
+
class.define_method(
|
|
13791
|
+
"cache_read_input_token_cost",
|
|
13792
|
+
method!(ModelTier::cache_read_input_token_cost, 0),
|
|
13793
|
+
)?;
|
|
13794
|
+
|
|
13795
|
+
class.define_method(
|
|
13796
|
+
"cache_creation_input_token_cost",
|
|
13797
|
+
method!(ModelTier::cache_creation_input_token_cost, 0),
|
|
13798
|
+
)?;
|
|
13799
|
+
|
|
13800
|
+
class.define_method(
|
|
13801
|
+
"input_cost_per_audio_token",
|
|
13802
|
+
method!(ModelTier::input_cost_per_audio_token, 0),
|
|
13803
|
+
)?;
|
|
13804
|
+
|
|
13805
|
+
class.define_method(
|
|
13806
|
+
"output_cost_per_audio_token",
|
|
13807
|
+
method!(ModelTier::output_cost_per_audio_token, 0),
|
|
13808
|
+
)?;
|
|
13809
|
+
|
|
13810
|
+
class.define_method(
|
|
13811
|
+
"output_cost_per_reasoning_token",
|
|
13812
|
+
method!(ModelTier::output_cost_per_reasoning_token, 0),
|
|
13813
|
+
)?;
|
|
13814
|
+
|
|
12726
13815
|
let class = module.define_class("BudgetConfig", ruby.class_object())?;
|
|
12727
13816
|
|
|
12728
13817
|
class.define_singleton_method("new", function!(BudgetConfig::new, -1))?;
|
|
@@ -12733,6 +13822,16 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
12733
13822
|
|
|
12734
13823
|
class.define_method("enforcement", method!(BudgetConfig::enforcement, 0))?;
|
|
12735
13824
|
|
|
13825
|
+
let class = module.define_class("CacheConfig", ruby.class_object())?;
|
|
13826
|
+
|
|
13827
|
+
class.define_singleton_method("new", function!(CacheConfig::new, -1))?;
|
|
13828
|
+
|
|
13829
|
+
class.define_method("max_entries", method!(CacheConfig::max_entries, 0))?;
|
|
13830
|
+
|
|
13831
|
+
class.define_method("ttl", method!(CacheConfig::ttl, 0))?;
|
|
13832
|
+
|
|
13833
|
+
class.define_method("backend", method!(CacheConfig::backend, 0))?;
|
|
13834
|
+
|
|
12736
13835
|
let class = module.define_class("SingleflightResult", ruby.class_object())?;
|
|
12737
13836
|
|
|
12738
13837
|
let class = module.define_class("RateLimitConfig", ruby.class_object())?;
|
|
@@ -12755,6 +13854,18 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
12755
13854
|
|
|
12756
13855
|
class.define_method("model", method!(IntentPrototype::model, 0))?;
|
|
12757
13856
|
|
|
13857
|
+
let class = module.define_class("CatalogRefreshConfig", ruby.class_object())?;
|
|
13858
|
+
|
|
13859
|
+
class.define_singleton_method("new", function!(CatalogRefreshConfig::new, -1))?;
|
|
13860
|
+
|
|
13861
|
+
class.define_method("enabled", method!(CatalogRefreshConfig::enabled, 0))?;
|
|
13862
|
+
|
|
13863
|
+
class.define_method("source_url", method!(CatalogRefreshConfig::source_url, 0))?;
|
|
13864
|
+
|
|
13865
|
+
class.define_method("ttl_seconds", method!(CatalogRefreshConfig::ttl_seconds, 0))?;
|
|
13866
|
+
|
|
13867
|
+
class.define_method("cache_path", method!(CatalogRefreshConfig::cache_path, 0))?;
|
|
13868
|
+
|
|
12758
13869
|
let class = module.define_class("RerankDocument", ruby.class_object())?;
|
|
12759
13870
|
|
|
12760
13871
|
class.define_singleton_method("object", function!(RerankDocument::_factory_object, 1))?;
|
|
@@ -12786,6 +13897,8 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
12786
13897
|
|
|
12787
13898
|
module.define_module_function("completion_cost_with_cache", function!(completion_cost_with_cache, 4))?;
|
|
12788
13899
|
|
|
13900
|
+
module.define_module_function("model_info", function!(model_info, 1))?;
|
|
13901
|
+
|
|
12789
13902
|
module.define_module_function("clear", function!(clear, 0))?;
|
|
12790
13903
|
|
|
12791
13904
|
module.define_module_function("count_tokens", function!(count_tokens, 2))?;
|
|
@@ -12796,6 +13909,15 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
12796
13909
|
|
|
12797
13910
|
module.define_module_function("ensure_crypto_provider", function!(ensure_crypto_provider, 0))?;
|
|
12798
13911
|
|
|
13912
|
+
module.define_module_function(
|
|
13913
|
+
"install_catalog_overlay_from_str",
|
|
13914
|
+
function!(install_catalog_overlay_from_str, 1),
|
|
13915
|
+
)?;
|
|
13916
|
+
|
|
13917
|
+
module.define_module_function("clear_catalog_overlay", function!(clear_catalog_overlay, 0))?;
|
|
13918
|
+
|
|
13919
|
+
module.define_module_function("refresh_catalog", function!(refresh_catalog_async, -1))?;
|
|
13920
|
+
|
|
12799
13921
|
module.define_module_function("chat_stream", function!(chat_stream, 2))?;
|
|
12800
13922
|
|
|
12801
13923
|
let liter_llm_error_info_class = module.define_class("LiterLlmErrorInfo", ruby.class_object())?;
|