liter_llm 2.1.0 → 2.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e555b291c7f9b51a9f33a3faac045894fd050864425b8c01eacf53c51faa63c7
4
- data.tar.gz: b8eda3d87c1d4eae2942df9e7d356688399103dbc5930f11815dcaa78ba30b5e
3
+ metadata.gz: 2fac5b39a78e7b0ba2fc6be32fdde5f79eb581385a6bf0ec4085faa5565f550f
4
+ data.tar.gz: 7abe061b587abd8a7f4f102793fbb44fa878e5b3596e13f09e65601a0ef30e41
5
5
  SHA512:
6
- metadata.gz: 7159a3f937e798ace8ed05beb9143361c2a7c37c8cc5f0109ddb46847fec87febabe08a41f7f3bc984afbd12340b1f6fce1132c4c782054a1d0c740bbd11276b
7
- data.tar.gz: db1e76690db3d697de65bf11956127ca227218f8295fa3afde1057065f55006e01324c2d61f68680080213c472e310d66a22e6a775cd8fb328357d8307a66bff
6
+ metadata.gz: d3e83540844a170585517992d47e62efb42420039813609ed64916d15eef804c2ce7d64e6c3c80ec258d1e9e1c6e490a97309f1ad501fa9397829d61a91a4181
7
+ data.tar.gz: 3c4abef27ed348e45ad9634ba21bdef6f86f99195b08258497bd0d193608fcf68fa3fd3fc10b1d41da7db1c50e1d05c3b7e29f61c9e86e95a8d7c4371865ce02
@@ -1697,9 +1697,9 @@ checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae"
1697
1697
 
1698
1698
  [[package]]
1699
1699
  name = "liter-llm"
1700
- version = "2.1.0"
1700
+ version = "2.1.1"
1701
1701
  source = "registry+https://github.com/rust-lang/crates.io-index"
1702
- checksum = "6260bb696426412f48912d852ae82bf006107501cc0dab73842bfcec681f26e9"
1702
+ checksum = "71e3d2ee6d906bd5bd018254d38737e0287f355d4e9706736128e63bc87009a1"
1703
1703
  dependencies = [
1704
1704
  "ahash",
1705
1705
  "arc-swap",
@@ -1742,7 +1742,7 @@ dependencies = [
1742
1742
 
1743
1743
  [[package]]
1744
1744
  name = "liter-llm-rb"
1745
- version = "2.1.0"
1745
+ version = "2.1.1"
1746
1746
  dependencies = [
1747
1747
  "futures",
1748
1748
  "liter-llm",
@@ -1,11 +1,11 @@
1
1
  # This file is auto-generated by alef — DO NOT EDIT.
2
- # alef:hash:0eb2568b15feb97631bad1b770304bcf4ec113ac881a730345d89ef5ecb4709e
2
+ # alef:hash:8ee1b6e150f8695841cbc61738b1d6c4711c9a9fe834562664a5bfb006ed704a
3
3
  # To regenerate: alef generate
4
4
  # To verify freshness: alef verify
5
5
 
6
6
  [package]
7
7
  name = "liter-llm-rb"
8
- version = "2.1.0"
8
+ version = "2.1.1"
9
9
  edition = "2024"
10
10
  license = "MIT"
11
11
  description = "Universal LLM API client with Rust-powered polyglot bindings."
@@ -31,7 +31,7 @@ wasm-http = ["liter-llm/wasm-http"]
31
31
 
32
32
  [dependencies]
33
33
  futures = "0.3"
34
- liter-llm = { version = "2.1.0", features = ["native-http", "full"] }
34
+ liter-llm = { version = "2.1.1", features = ["native-http", "full"] }
35
35
  magnus = "0.9"
36
36
  rb-sys = ">=0.9.130, <0.10"
37
37
  serde = { version = "1", features = ["derive"] }
@@ -1,5 +1,5 @@
1
1
  // This file is auto-generated by alef. DO NOT EDIT.
2
- // alef:hash:c38ee16af03a7f5880934b3b89c3209a36af80d907b6491debc2153c4df4d7bf
2
+ // alef:hash:b9959449e602c92504188e4992627401dc218754267986b232c4fb71d53a59c3
3
3
  // Re-generate with: alef generate
4
4
  #![allow(dead_code, unused_imports, unused_variables)]
5
5
  #![allow(
@@ -13550,7 +13550,38 @@ pub enum ToolChoice {
13550
13550
 
13551
13551
  impl magnus::TryConvert for ToolChoice {
13552
13552
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
13553
- <&Self as magnus::TryConvert>::try_convert(val).cloned()
13553
+ // The native class is the only unambiguous input for a discriminator-free enum, but it is
13554
+ // not the only legitimate one: serde's own Deserialize accepts every variant's wire form,
13555
+ // so a caller holding a decoded String or Hash must keep working. Take the wrapped instance
13556
+ // when there is one, otherwise fall through to the serde reader below.
13557
+ if let Ok(wrapped) = <&Self as magnus::TryConvert>::try_convert(val) {
13558
+ return Ok(wrapped.clone());
13559
+ } // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
13560
+ // For unit enums or when passed as a string, fall back to string-based conversion.
13561
+ let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
13562
+ s
13563
+ } else {
13564
+ val.funcall::<_, _, String>("to_json", ()).map_err(|e| {
13565
+ magnus::Error::new(
13566
+ unsafe { Ruby::get_unchecked() }.exception_type_error(),
13567
+ format!("no implicit conversion into ToolChoice: {}", e),
13568
+ )
13569
+ })?
13570
+ };
13571
+ // Try deserializing as JSON first (handles JSON strings like "\"markdown\"" or "{\"click\":{\"selector\":\"...\"}}\"")
13572
+ // For internally-tagged enums, a bare variant string is wrapped as {"<tag>": value}.
13573
+ // If that fails, try treating it as a plain string value and wrap in quotes
13574
+ // If both fail, try as Custom variant (for untagged enum support)
13575
+ serde_json::from_str(&json_str)
13576
+ .or_else(|_| serde_json::from_str(&format!("\"{json_str}\"")))
13577
+ .or_else(|_| {
13578
+ // Try as a JSON string for Custom variant (untagged enums accept any remaining value)
13579
+ match serde_json::to_value(&json_str) {
13580
+ Ok(val) => serde_json::from_value(val),
13581
+ Err(e) => Err(e),
13582
+ }
13583
+ })
13584
+ .map_err(|e| magnus::Error::new(unsafe { Ruby::get_unchecked() }.exception_type_error(), e.to_string()))
13554
13585
  }
13555
13586
  }
13556
13587
 
@@ -1,10 +1,10 @@
1
1
  # This file is auto-generated by alef — DO NOT EDIT.
2
- # alef:hash:255ad57888389e715408840023ca11140a5ae7727059c28a47c9d9f68b90bdf4
2
+ # alef:hash:5bcf51fe4904f5876e8b2685e02d50a1d932faa82247d16cedafb3a57552930e
3
3
  # To regenerate: alef generate
4
4
  # To verify freshness: alef verify
5
5
  # frozen_string_literal: true
6
6
 
7
7
  module LiterLlm
8
8
  ## The version string for this package.
9
- VERSION = "2.1.0"
9
+ VERSION = "2.1.1"
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: liter_llm
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Na'aman Hirschfeld