xberg 1.3.0 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/xberg_rb/native/Cargo.lock +60 -71
- data/ext/xberg_rb/native/Cargo.toml +6 -6
- data/ext/xberg_rb/src/lib.rs +909 -146
- data/lib/xberg/version.rb +2 -2
- data/sig/types.rbs +34 -6
- metadata +2 -2
data/ext/xberg_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:3e862eca7b1250c4aa8d40b5563353572b94bd205d31f9f57c9efc950fcd26cb
|
|
3
3
|
// Re-generate with: alef generate
|
|
4
4
|
#![allow(dead_code, unused_imports, unused_variables)]
|
|
5
5
|
#![allow(
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
clippy::useless_conversion,
|
|
19
19
|
clippy::clone_on_copy
|
|
20
20
|
)]
|
|
21
|
+
#![allow(deprecated)]
|
|
21
22
|
|
|
22
23
|
use async_trait::async_trait;
|
|
23
24
|
use magnus::{Error, IntoValueFromNative, Ruby, function, method, prelude::*, try_convert::TryConvertOwned};
|
|
@@ -1515,6 +1516,7 @@ pub struct CaptioningConfig {
|
|
|
1515
1516
|
llm: LlmConfig,
|
|
1516
1517
|
prompt: Option<String>,
|
|
1517
1518
|
min_image_area: u32,
|
|
1519
|
+
alt_text: CaptionAltTextMode,
|
|
1518
1520
|
}
|
|
1519
1521
|
|
|
1520
1522
|
unsafe impl IntoValueFromNative for CaptioningConfig {}
|
|
@@ -1559,6 +1561,7 @@ impl Default for CaptioningConfig {
|
|
|
1559
1561
|
llm: LlmConfig::default(),
|
|
1560
1562
|
prompt: None,
|
|
1561
1563
|
min_image_area: 1000,
|
|
1564
|
+
alt_text: CaptionAltTextMode::Preserve,
|
|
1562
1565
|
}
|
|
1563
1566
|
}
|
|
1564
1567
|
}
|
|
@@ -1602,6 +1605,15 @@ impl CaptioningConfig {
|
|
|
1602
1605
|
})?,
|
|
1603
1606
|
None => 1000,
|
|
1604
1607
|
},
|
|
1608
|
+
alt_text: match kwargs.get(ruby.to_symbol("alt_text")) {
|
|
1609
|
+
Some(v) => CaptionAltTextMode::try_convert(v).map_err(|e| {
|
|
1610
|
+
magnus::Error::new(
|
|
1611
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
1612
|
+
format!("invalid value for `alt_text`: {}", e),
|
|
1613
|
+
)
|
|
1614
|
+
})?,
|
|
1615
|
+
None => CaptionAltTextMode::Preserve,
|
|
1616
|
+
},
|
|
1605
1617
|
})
|
|
1606
1618
|
}
|
|
1607
1619
|
|
|
@@ -1616,6 +1628,10 @@ impl CaptioningConfig {
|
|
|
1616
1628
|
fn min_image_area(&self) -> u32 {
|
|
1617
1629
|
self.min_image_area
|
|
1618
1630
|
}
|
|
1631
|
+
|
|
1632
|
+
fn alt_text(&self) -> CaptionAltTextMode {
|
|
1633
|
+
self.alt_text.clone()
|
|
1634
|
+
}
|
|
1619
1635
|
}
|
|
1620
1636
|
|
|
1621
1637
|
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
@@ -1724,9 +1740,9 @@ pub struct Chunk {
|
|
|
1724
1740
|
content: String,
|
|
1725
1741
|
chunk_type: ChunkType,
|
|
1726
1742
|
embedding: Option<Vec<f32>>,
|
|
1727
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
1743
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
1728
1744
|
sparse_embedding: Option<SparseEmbedding>,
|
|
1729
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
1745
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
1730
1746
|
late_interaction: Option<MultiVectorEmbedding>,
|
|
1731
1747
|
metadata: ChunkMetadata,
|
|
1732
1748
|
}
|
|
@@ -1782,12 +1798,7 @@ impl Chunk {
|
|
|
1782
1798
|
format!("invalid value for `chunk_type`: {}", e),
|
|
1783
1799
|
)
|
|
1784
1800
|
})?,
|
|
1785
|
-
None =>
|
|
1786
|
-
return Err(magnus::Error::new(
|
|
1787
|
-
unsafe { magnus::Ruby::get_unchecked() }.exception_arg_error(),
|
|
1788
|
-
"missing required field: chunk_type",
|
|
1789
|
-
));
|
|
1790
|
-
}
|
|
1801
|
+
None => ChunkType::Unknown,
|
|
1791
1802
|
},
|
|
1792
1803
|
embedding: match kwargs.get(ruby.to_symbol("embedding")).filter(|v| !v.is_nil()) {
|
|
1793
1804
|
Some(v) => Some(<Vec<f32>>::try_convert(v).map_err(|e| {
|
|
@@ -1798,7 +1809,7 @@ impl Chunk {
|
|
|
1798
1809
|
})?),
|
|
1799
1810
|
None => None,
|
|
1800
1811
|
},
|
|
1801
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
1812
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
1802
1813
|
sparse_embedding: match kwargs.get(ruby.to_symbol("sparse_embedding")).filter(|v| !v.is_nil()) {
|
|
1803
1814
|
Some(v) => Some(SparseEmbedding::try_convert(v).map_err(|e| {
|
|
1804
1815
|
magnus::Error::new(
|
|
@@ -1808,7 +1819,7 @@ impl Chunk {
|
|
|
1808
1819
|
})?),
|
|
1809
1820
|
None => None,
|
|
1810
1821
|
},
|
|
1811
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
1822
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
1812
1823
|
late_interaction: match kwargs.get(ruby.to_symbol("late_interaction")).filter(|v| !v.is_nil()) {
|
|
1813
1824
|
Some(v) => Some(MultiVectorEmbedding::try_convert(v).map_err(|e| {
|
|
1814
1825
|
magnus::Error::new(
|
|
@@ -1847,12 +1858,12 @@ impl Chunk {
|
|
|
1847
1858
|
self.embedding.clone()
|
|
1848
1859
|
}
|
|
1849
1860
|
|
|
1850
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
1861
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
1851
1862
|
fn sparse_embedding(&self) -> Option<SparseEmbedding> {
|
|
1852
1863
|
self.sparse_embedding.clone()
|
|
1853
1864
|
}
|
|
1854
1865
|
|
|
1855
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
1866
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
1856
1867
|
fn late_interaction(&self) -> Option<MultiVectorEmbedding> {
|
|
1857
1868
|
self.late_interaction.clone()
|
|
1858
1869
|
}
|
|
@@ -4072,6 +4083,7 @@ pub struct ConversionOptions {
|
|
|
4072
4083
|
strip_tags: Vec<String>,
|
|
4073
4084
|
preserve_tags: Vec<String>,
|
|
4074
4085
|
skip_images: bool,
|
|
4086
|
+
inline_data_media: InlineDataMedia,
|
|
4075
4087
|
url_escape_style: UrlEscapeStyle,
|
|
4076
4088
|
link_style: LinkStyle,
|
|
4077
4089
|
output_format: HtmlToMarkdownRsOutputFormat,
|
|
@@ -4415,6 +4427,15 @@ impl ConversionOptions {
|
|
|
4415
4427
|
})?,
|
|
4416
4428
|
None => false,
|
|
4417
4429
|
},
|
|
4430
|
+
inline_data_media: match kwargs.get(ruby.to_symbol("inline_data_media")) {
|
|
4431
|
+
Some(v) => InlineDataMedia::try_convert(v).map_err(|e| {
|
|
4432
|
+
magnus::Error::new(
|
|
4433
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
4434
|
+
format!("invalid value for `inline_data_media`: {}", e),
|
|
4435
|
+
)
|
|
4436
|
+
})?,
|
|
4437
|
+
None => InlineDataMedia::Keep,
|
|
4438
|
+
},
|
|
4418
4439
|
url_escape_style: match kwargs.get(ruby.to_symbol("url_escape_style")) {
|
|
4419
4440
|
Some(v) => UrlEscapeStyle::try_convert(v).map_err(|e| {
|
|
4420
4441
|
magnus::Error::new(
|
|
@@ -4654,6 +4675,10 @@ impl ConversionOptions {
|
|
|
4654
4675
|
self.skip_images
|
|
4655
4676
|
}
|
|
4656
4677
|
|
|
4678
|
+
fn inline_data_media(&self) -> InlineDataMedia {
|
|
4679
|
+
self.inline_data_media.clone()
|
|
4680
|
+
}
|
|
4681
|
+
|
|
4657
4682
|
fn url_escape_style(&self) -> UrlEscapeStyle {
|
|
4658
4683
|
self.url_escape_style.clone()
|
|
4659
4684
|
}
|
|
@@ -7804,12 +7829,7 @@ impl DocumentNode {
|
|
|
7804
7829
|
format!("invalid value for `content_layer`: {}", e),
|
|
7805
7830
|
)
|
|
7806
7831
|
})?,
|
|
7807
|
-
None =>
|
|
7808
|
-
return Err(magnus::Error::new(
|
|
7809
|
-
unsafe { magnus::Ruby::get_unchecked() }.exception_arg_error(),
|
|
7810
|
-
"missing required field: content_layer",
|
|
7811
|
-
));
|
|
7812
|
-
}
|
|
7832
|
+
None => ContentLayer::Body,
|
|
7813
7833
|
},
|
|
7814
7834
|
page: match kwargs.get(ruby.to_symbol("page")).filter(|v| !v.is_nil()) {
|
|
7815
7835
|
Some(v) => Some(u32::try_convert(v).map_err(|e| {
|
|
@@ -10682,6 +10702,135 @@ impl ExcelWorkbook {
|
|
|
10682
10702
|
}
|
|
10683
10703
|
}
|
|
10684
10704
|
|
|
10705
|
+
#[derive(Clone, Debug, serde::Serialize)]
|
|
10706
|
+
#[serde(default)]
|
|
10707
|
+
#[magnus::wrap(class = "Xberg::ExternalRedactionFinding")]
|
|
10708
|
+
pub struct ExternalRedactionFinding {
|
|
10709
|
+
label: String,
|
|
10710
|
+
text: Option<String>,
|
|
10711
|
+
start: Option<u32>,
|
|
10712
|
+
end: Option<u32>,
|
|
10713
|
+
score: Option<f32>,
|
|
10714
|
+
}
|
|
10715
|
+
|
|
10716
|
+
unsafe impl IntoValueFromNative for ExternalRedactionFinding {}
|
|
10717
|
+
|
|
10718
|
+
impl magnus::TryConvert for ExternalRedactionFinding {
|
|
10719
|
+
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
10720
|
+
if let Ok(r) = <&ExternalRedactionFinding as magnus::TryConvert>::try_convert(val) {
|
|
10721
|
+
return Ok(r.clone());
|
|
10722
|
+
}
|
|
10723
|
+
let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
|
|
10724
|
+
s
|
|
10725
|
+
} else {
|
|
10726
|
+
val.funcall::<_, _, String>("to_json", ()).map_err(|e| {
|
|
10727
|
+
magnus::Error::new(
|
|
10728
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
10729
|
+
format!("no implicit conversion into ExternalRedactionFinding: {}", e),
|
|
10730
|
+
)
|
|
10731
|
+
})?
|
|
10732
|
+
};
|
|
10733
|
+
serde_json::from_str::<ExternalRedactionFinding>(&json_str).map_err(|e| {
|
|
10734
|
+
magnus::Error::new(
|
|
10735
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
10736
|
+
format!("failed to deserialize ExternalRedactionFinding: {}", e),
|
|
10737
|
+
)
|
|
10738
|
+
})
|
|
10739
|
+
}
|
|
10740
|
+
}
|
|
10741
|
+
|
|
10742
|
+
unsafe impl TryConvertOwned for ExternalRedactionFinding {}
|
|
10743
|
+
impl<'de> serde::Deserialize<'de> for ExternalRedactionFinding {
|
|
10744
|
+
fn deserialize<D>(deserializer: D) -> ::core::result::Result<Self, D::Error>
|
|
10745
|
+
where
|
|
10746
|
+
D: serde::Deserializer<'de>,
|
|
10747
|
+
{
|
|
10748
|
+
<xberg::ExternalRedactionFinding as serde::Deserialize>::deserialize(deserializer).map(Into::into)
|
|
10749
|
+
}
|
|
10750
|
+
}
|
|
10751
|
+
|
|
10752
|
+
impl Default for ExternalRedactionFinding {
|
|
10753
|
+
fn default() -> Self {
|
|
10754
|
+
xberg::ExternalRedactionFinding::default().into()
|
|
10755
|
+
}
|
|
10756
|
+
}
|
|
10757
|
+
|
|
10758
|
+
impl ExternalRedactionFinding {
|
|
10759
|
+
fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
|
|
10760
|
+
let ruby = unsafe { magnus::Ruby::get_unchecked() };
|
|
10761
|
+
let args = magnus::scan_args::scan_args::<(), (Option<magnus::RHash>,), (), (), (), ()>(args)?;
|
|
10762
|
+
let (kwargs_opt,) = args.optional;
|
|
10763
|
+
let kwargs = kwargs_opt.unwrap_or_else(|| ruby.hash_new());
|
|
10764
|
+
Ok(Self {
|
|
10765
|
+
label: match kwargs.get(ruby.to_symbol("label")) {
|
|
10766
|
+
Some(v) => String::try_convert(v).map_err(|e| {
|
|
10767
|
+
magnus::Error::new(
|
|
10768
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
10769
|
+
format!("invalid value for `label`: {}", e),
|
|
10770
|
+
)
|
|
10771
|
+
})?,
|
|
10772
|
+
None => Default::default(),
|
|
10773
|
+
},
|
|
10774
|
+
text: match kwargs.get(ruby.to_symbol("text")).filter(|v| !v.is_nil()) {
|
|
10775
|
+
Some(v) => Some(String::try_convert(v).map_err(|e| {
|
|
10776
|
+
magnus::Error::new(
|
|
10777
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
10778
|
+
format!("invalid value for `text`: {}", e),
|
|
10779
|
+
)
|
|
10780
|
+
})?),
|
|
10781
|
+
None => None,
|
|
10782
|
+
},
|
|
10783
|
+
start: match kwargs.get(ruby.to_symbol("start")).filter(|v| !v.is_nil()) {
|
|
10784
|
+
Some(v) => Some(u32::try_convert(v).map_err(|e| {
|
|
10785
|
+
magnus::Error::new(
|
|
10786
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
10787
|
+
format!("invalid value for `start`: {}", e),
|
|
10788
|
+
)
|
|
10789
|
+
})?),
|
|
10790
|
+
None => None,
|
|
10791
|
+
},
|
|
10792
|
+
end: match kwargs.get(ruby.to_symbol("end")).filter(|v| !v.is_nil()) {
|
|
10793
|
+
Some(v) => Some(u32::try_convert(v).map_err(|e| {
|
|
10794
|
+
magnus::Error::new(
|
|
10795
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
10796
|
+
format!("invalid value for `end`: {}", e),
|
|
10797
|
+
)
|
|
10798
|
+
})?),
|
|
10799
|
+
None => None,
|
|
10800
|
+
},
|
|
10801
|
+
score: match kwargs.get(ruby.to_symbol("score")).filter(|v| !v.is_nil()) {
|
|
10802
|
+
Some(v) => Some(f32::try_convert(v).map_err(|e| {
|
|
10803
|
+
magnus::Error::new(
|
|
10804
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
10805
|
+
format!("invalid value for `score`: {}", e),
|
|
10806
|
+
)
|
|
10807
|
+
})?),
|
|
10808
|
+
None => None,
|
|
10809
|
+
},
|
|
10810
|
+
})
|
|
10811
|
+
}
|
|
10812
|
+
|
|
10813
|
+
fn label(&self) -> String {
|
|
10814
|
+
self.label.clone()
|
|
10815
|
+
}
|
|
10816
|
+
|
|
10817
|
+
fn text(&self) -> Option<String> {
|
|
10818
|
+
self.text.clone()
|
|
10819
|
+
}
|
|
10820
|
+
|
|
10821
|
+
fn start(&self) -> Option<u32> {
|
|
10822
|
+
self.start
|
|
10823
|
+
}
|
|
10824
|
+
|
|
10825
|
+
fn end(&self) -> Option<u32> {
|
|
10826
|
+
self.end
|
|
10827
|
+
}
|
|
10828
|
+
|
|
10829
|
+
fn score(&self) -> Option<f32> {
|
|
10830
|
+
self.score
|
|
10831
|
+
}
|
|
10832
|
+
}
|
|
10833
|
+
|
|
10685
10834
|
#[derive(Clone, Debug, serde::Serialize)]
|
|
10686
10835
|
#[serde(default)]
|
|
10687
10836
|
#[magnus::wrap(class = "Xberg::ExtractInput")]
|
|
@@ -18774,7 +18923,7 @@ impl LateInteractionConfig {
|
|
|
18774
18923
|
}
|
|
18775
18924
|
}
|
|
18776
18925
|
|
|
18777
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
18926
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
18778
18927
|
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
18779
18928
|
#[magnus::wrap(class = "Xberg::LateInteractionMatch")]
|
|
18780
18929
|
pub struct LateInteractionMatch {
|
|
@@ -18782,10 +18931,10 @@ pub struct LateInteractionMatch {
|
|
|
18782
18931
|
score: f32,
|
|
18783
18932
|
}
|
|
18784
18933
|
|
|
18785
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
18934
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
18786
18935
|
unsafe impl IntoValueFromNative for LateInteractionMatch {}
|
|
18787
18936
|
|
|
18788
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
18937
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
18789
18938
|
impl magnus::TryConvert for LateInteractionMatch {
|
|
18790
18939
|
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
18791
18940
|
if let Ok(r) = <&LateInteractionMatch as magnus::TryConvert>::try_convert(val) {
|
|
@@ -18810,10 +18959,10 @@ impl magnus::TryConvert for LateInteractionMatch {
|
|
|
18810
18959
|
}
|
|
18811
18960
|
}
|
|
18812
18961
|
|
|
18813
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
18962
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
18814
18963
|
unsafe impl TryConvertOwned for LateInteractionMatch {}
|
|
18815
18964
|
|
|
18816
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
18965
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
18817
18966
|
impl LateInteractionMatch {
|
|
18818
18967
|
fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
|
|
18819
18968
|
let ruby = unsafe { magnus::Ruby::get_unchecked() };
|
|
@@ -18851,7 +19000,7 @@ impl LateInteractionMatch {
|
|
|
18851
19000
|
}
|
|
18852
19001
|
}
|
|
18853
19002
|
|
|
18854
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
19003
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
18855
19004
|
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
18856
19005
|
#[magnus::wrap(class = "Xberg::LateInteractionPreset")]
|
|
18857
19006
|
pub struct LateInteractionPreset {
|
|
@@ -18865,10 +19014,10 @@ pub struct LateInteractionPreset {
|
|
|
18865
19014
|
description: String,
|
|
18866
19015
|
}
|
|
18867
19016
|
|
|
18868
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
19017
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
18869
19018
|
unsafe impl IntoValueFromNative for LateInteractionPreset {}
|
|
18870
19019
|
|
|
18871
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
19020
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
18872
19021
|
impl magnus::TryConvert for LateInteractionPreset {
|
|
18873
19022
|
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
18874
19023
|
if let Ok(r) = <&LateInteractionPreset as magnus::TryConvert>::try_convert(val) {
|
|
@@ -18893,10 +19042,10 @@ impl magnus::TryConvert for LateInteractionPreset {
|
|
|
18893
19042
|
}
|
|
18894
19043
|
}
|
|
18895
19044
|
|
|
18896
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
19045
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
18897
19046
|
unsafe impl TryConvertOwned for LateInteractionPreset {}
|
|
18898
19047
|
|
|
18899
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
19048
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
18900
19049
|
impl LateInteractionPreset {
|
|
18901
19050
|
fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
|
|
18902
19051
|
let ruby = unsafe { magnus::Ruby::get_unchecked() };
|
|
@@ -21338,7 +21487,6 @@ impl Metadata {
|
|
|
21338
21487
|
}
|
|
21339
21488
|
}
|
|
21340
21489
|
|
|
21341
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
21342
21490
|
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
21343
21491
|
#[magnus::wrap(class = "Xberg::ModelPaths")]
|
|
21344
21492
|
pub struct ModelPaths {
|
|
@@ -21348,10 +21496,8 @@ pub struct ModelPaths {
|
|
|
21348
21496
|
dict_file: String,
|
|
21349
21497
|
}
|
|
21350
21498
|
|
|
21351
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
21352
21499
|
unsafe impl IntoValueFromNative for ModelPaths {}
|
|
21353
21500
|
|
|
21354
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
21355
21501
|
impl magnus::TryConvert for ModelPaths {
|
|
21356
21502
|
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
21357
21503
|
if let Ok(r) = <&ModelPaths as magnus::TryConvert>::try_convert(val) {
|
|
@@ -21376,10 +21522,8 @@ impl magnus::TryConvert for ModelPaths {
|
|
|
21376
21522
|
}
|
|
21377
21523
|
}
|
|
21378
21524
|
|
|
21379
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
21380
21525
|
unsafe impl TryConvertOwned for ModelPaths {}
|
|
21381
21526
|
|
|
21382
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
21383
21527
|
impl ModelPaths {
|
|
21384
21528
|
fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
|
|
21385
21529
|
let ruby = unsafe { magnus::Ruby::get_unchecked() };
|
|
@@ -21443,7 +21587,7 @@ impl ModelPaths {
|
|
|
21443
21587
|
}
|
|
21444
21588
|
}
|
|
21445
21589
|
|
|
21446
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
21590
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
21447
21591
|
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
21448
21592
|
#[magnus::wrap(class = "Xberg::MultiVectorEmbedding")]
|
|
21449
21593
|
pub struct MultiVectorEmbedding {
|
|
@@ -21452,10 +21596,10 @@ pub struct MultiVectorEmbedding {
|
|
|
21452
21596
|
data: Vec<f32>,
|
|
21453
21597
|
}
|
|
21454
21598
|
|
|
21455
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
21599
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
21456
21600
|
unsafe impl IntoValueFromNative for MultiVectorEmbedding {}
|
|
21457
21601
|
|
|
21458
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
21602
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
21459
21603
|
impl magnus::TryConvert for MultiVectorEmbedding {
|
|
21460
21604
|
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
21461
21605
|
if let Ok(r) = <&MultiVectorEmbedding as magnus::TryConvert>::try_convert(val) {
|
|
@@ -21480,10 +21624,10 @@ impl magnus::TryConvert for MultiVectorEmbedding {
|
|
|
21480
21624
|
}
|
|
21481
21625
|
}
|
|
21482
21626
|
|
|
21483
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
21627
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
21484
21628
|
unsafe impl TryConvertOwned for MultiVectorEmbedding {}
|
|
21485
21629
|
|
|
21486
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
21630
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
21487
21631
|
impl MultiVectorEmbedding {
|
|
21488
21632
|
fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
|
|
21489
21633
|
let ruby = unsafe { magnus::Ruby::get_unchecked() };
|
|
@@ -22093,6 +22237,7 @@ pub struct OcrConfig {
|
|
|
22093
22237
|
tesseract_config: Option<TesseractConfig>,
|
|
22094
22238
|
output_format: Option<OutputFormat>,
|
|
22095
22239
|
paddle_ocr_config: Option<String>,
|
|
22240
|
+
paddle_ocr_settings: Option<PaddleOcrConfig>,
|
|
22096
22241
|
backend_options: Option<String>,
|
|
22097
22242
|
element_config: Option<OcrElementConfig>,
|
|
22098
22243
|
quality_thresholds: Option<OcrQualityThresholds>,
|
|
@@ -22211,6 +22356,18 @@ impl OcrConfig {
|
|
|
22211
22356
|
})?),
|
|
22212
22357
|
None => None,
|
|
22213
22358
|
},
|
|
22359
|
+
paddle_ocr_settings: match kwargs
|
|
22360
|
+
.get(ruby.to_symbol("paddle_ocr_settings"))
|
|
22361
|
+
.filter(|v| !v.is_nil())
|
|
22362
|
+
{
|
|
22363
|
+
Some(v) => Some(PaddleOcrConfig::try_convert(v).map_err(|e| {
|
|
22364
|
+
magnus::Error::new(
|
|
22365
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
22366
|
+
format!("invalid value for `paddle_ocr_settings`: {}", e),
|
|
22367
|
+
)
|
|
22368
|
+
})?),
|
|
22369
|
+
None => None,
|
|
22370
|
+
},
|
|
22214
22371
|
backend_options: match kwargs.get(ruby.to_symbol("backend_options")).filter(|v| !v.is_nil()) {
|
|
22215
22372
|
Some(v) => Some(String::try_convert(v).map_err(|e| {
|
|
22216
22373
|
magnus::Error::new(
|
|
@@ -22355,6 +22512,10 @@ impl OcrConfig {
|
|
|
22355
22512
|
self.paddle_ocr_config.clone()
|
|
22356
22513
|
}
|
|
22357
22514
|
|
|
22515
|
+
fn paddle_ocr_settings(&self) -> Option<PaddleOcrConfig> {
|
|
22516
|
+
self.paddle_ocr_settings.clone()
|
|
22517
|
+
}
|
|
22518
|
+
|
|
22358
22519
|
fn backend_options(&self) -> Option<String> {
|
|
22359
22520
|
self.backend_options.clone()
|
|
22360
22521
|
}
|
|
@@ -23065,6 +23226,7 @@ pub struct OcrPipelineStage {
|
|
|
23065
23226
|
language: Option<Vec<String>>,
|
|
23066
23227
|
tesseract_config: Option<TesseractConfig>,
|
|
23067
23228
|
paddle_ocr_config: Option<String>,
|
|
23229
|
+
paddle_ocr_settings: Option<PaddleOcrConfig>,
|
|
23068
23230
|
vlm_config: Option<LlmConfig>,
|
|
23069
23231
|
backend_options: Option<String>,
|
|
23070
23232
|
}
|
|
@@ -23113,6 +23275,7 @@ impl Default for OcrPipelineStage {
|
|
|
23113
23275
|
language: None,
|
|
23114
23276
|
tesseract_config: None,
|
|
23115
23277
|
paddle_ocr_config: None,
|
|
23278
|
+
paddle_ocr_settings: None,
|
|
23116
23279
|
vlm_config: None,
|
|
23117
23280
|
backend_options: None,
|
|
23118
23281
|
}
|
|
@@ -23171,6 +23334,18 @@ impl OcrPipelineStage {
|
|
|
23171
23334
|
})?),
|
|
23172
23335
|
None => None,
|
|
23173
23336
|
},
|
|
23337
|
+
paddle_ocr_settings: match kwargs
|
|
23338
|
+
.get(ruby.to_symbol("paddle_ocr_settings"))
|
|
23339
|
+
.filter(|v| !v.is_nil())
|
|
23340
|
+
{
|
|
23341
|
+
Some(v) => Some(PaddleOcrConfig::try_convert(v).map_err(|e| {
|
|
23342
|
+
magnus::Error::new(
|
|
23343
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
23344
|
+
format!("invalid value for `paddle_ocr_settings`: {}", e),
|
|
23345
|
+
)
|
|
23346
|
+
})?),
|
|
23347
|
+
None => None,
|
|
23348
|
+
},
|
|
23174
23349
|
vlm_config: match kwargs.get(ruby.to_symbol("vlm_config")).filter(|v| !v.is_nil()) {
|
|
23175
23350
|
Some(v) => Some(LlmConfig::try_convert(v).map_err(|e| {
|
|
23176
23351
|
magnus::Error::new(
|
|
@@ -23212,6 +23387,10 @@ impl OcrPipelineStage {
|
|
|
23212
23387
|
self.paddle_ocr_config.clone()
|
|
23213
23388
|
}
|
|
23214
23389
|
|
|
23390
|
+
fn paddle_ocr_settings(&self) -> Option<PaddleOcrConfig> {
|
|
23391
|
+
self.paddle_ocr_settings.clone()
|
|
23392
|
+
}
|
|
23393
|
+
|
|
23215
23394
|
fn vlm_config(&self) -> Option<LlmConfig> {
|
|
23216
23395
|
self.vlm_config.clone()
|
|
23217
23396
|
}
|
|
@@ -24095,7 +24274,6 @@ impl OrientationResult {
|
|
|
24095
24274
|
}
|
|
24096
24275
|
}
|
|
24097
24276
|
|
|
24098
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
24099
24277
|
#[derive(Clone, Debug, serde::Serialize)]
|
|
24100
24278
|
#[serde(default)]
|
|
24101
24279
|
#[magnus::wrap(class = "Xberg::PaddleOcrConfig")]
|
|
@@ -24116,10 +24294,8 @@ pub struct PaddleOcrConfig {
|
|
|
24116
24294
|
inference_backend: Option<PaddleInferenceBackend>,
|
|
24117
24295
|
}
|
|
24118
24296
|
|
|
24119
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
24120
24297
|
unsafe impl IntoValueFromNative for PaddleOcrConfig {}
|
|
24121
24298
|
|
|
24122
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
24123
24299
|
impl magnus::TryConvert for PaddleOcrConfig {
|
|
24124
24300
|
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
24125
24301
|
if let Ok(r) = <&PaddleOcrConfig as magnus::TryConvert>::try_convert(val) {
|
|
@@ -24144,9 +24320,7 @@ impl magnus::TryConvert for PaddleOcrConfig {
|
|
|
24144
24320
|
}
|
|
24145
24321
|
}
|
|
24146
24322
|
|
|
24147
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
24148
24323
|
unsafe impl TryConvertOwned for PaddleOcrConfig {}
|
|
24149
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
24150
24324
|
impl<'de> serde::Deserialize<'de> for PaddleOcrConfig {
|
|
24151
24325
|
fn deserialize<D>(deserializer: D) -> ::core::result::Result<Self, D::Error>
|
|
24152
24326
|
where
|
|
@@ -24156,14 +24330,12 @@ impl<'de> serde::Deserialize<'de> for PaddleOcrConfig {
|
|
|
24156
24330
|
}
|
|
24157
24331
|
}
|
|
24158
24332
|
|
|
24159
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
24160
24333
|
impl Default for PaddleOcrConfig {
|
|
24161
24334
|
fn default() -> Self {
|
|
24162
24335
|
xberg::PaddleOcrConfig::default().into()
|
|
24163
24336
|
}
|
|
24164
24337
|
}
|
|
24165
24338
|
|
|
24166
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
24167
24339
|
impl PaddleOcrConfig {
|
|
24168
24340
|
fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
|
|
24169
24341
|
let ruby = unsafe { magnus::Ruby::get_unchecked() };
|
|
@@ -29681,6 +29853,10 @@ pub struct RedactionConfig {
|
|
|
29681
29853
|
preserve_offsets: bool,
|
|
29682
29854
|
custom_terms: Vec<RedactionTerm>,
|
|
29683
29855
|
custom_patterns: Vec<RedactionPattern>,
|
|
29856
|
+
findings: Vec<ExternalRedactionFinding>,
|
|
29857
|
+
min_score: Option<f32>,
|
|
29858
|
+
findings_path: Option<String>,
|
|
29859
|
+
findings_offset_encoding: RedactionOffsetEncoding,
|
|
29684
29860
|
}
|
|
29685
29861
|
|
|
29686
29862
|
unsafe impl IntoValueFromNative for RedactionConfig {}
|
|
@@ -29786,6 +29962,42 @@ impl RedactionConfig {
|
|
|
29786
29962
|
})?,
|
|
29787
29963
|
None => Default::default(),
|
|
29788
29964
|
},
|
|
29965
|
+
findings: match kwargs.get(ruby.to_symbol("findings")) {
|
|
29966
|
+
Some(v) => <Vec<ExternalRedactionFinding>>::try_convert(v).map_err(|e| {
|
|
29967
|
+
magnus::Error::new(
|
|
29968
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
29969
|
+
format!("invalid value for `findings`: {}", e),
|
|
29970
|
+
)
|
|
29971
|
+
})?,
|
|
29972
|
+
None => Default::default(),
|
|
29973
|
+
},
|
|
29974
|
+
min_score: match kwargs.get(ruby.to_symbol("min_score")).filter(|v| !v.is_nil()) {
|
|
29975
|
+
Some(v) => Some(f32::try_convert(v).map_err(|e| {
|
|
29976
|
+
magnus::Error::new(
|
|
29977
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
29978
|
+
format!("invalid value for `min_score`: {}", e),
|
|
29979
|
+
)
|
|
29980
|
+
})?),
|
|
29981
|
+
None => None,
|
|
29982
|
+
},
|
|
29983
|
+
findings_path: match kwargs.get(ruby.to_symbol("findings_path")).filter(|v| !v.is_nil()) {
|
|
29984
|
+
Some(v) => Some(String::try_convert(v).map_err(|e| {
|
|
29985
|
+
magnus::Error::new(
|
|
29986
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
29987
|
+
format!("invalid value for `findings_path`: {}", e),
|
|
29988
|
+
)
|
|
29989
|
+
})?),
|
|
29990
|
+
None => None,
|
|
29991
|
+
},
|
|
29992
|
+
findings_offset_encoding: match kwargs.get(ruby.to_symbol("findings_offset_encoding")) {
|
|
29993
|
+
Some(v) => RedactionOffsetEncoding::try_convert(v).map_err(|e| {
|
|
29994
|
+
magnus::Error::new(
|
|
29995
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
29996
|
+
format!("invalid value for `findings_offset_encoding`: {}", e),
|
|
29997
|
+
)
|
|
29998
|
+
})?,
|
|
29999
|
+
None => RedactionOffsetEncoding::UnicodeCodePoints,
|
|
30000
|
+
},
|
|
29789
30001
|
})
|
|
29790
30002
|
}
|
|
29791
30003
|
|
|
@@ -29813,6 +30025,22 @@ impl RedactionConfig {
|
|
|
29813
30025
|
self.custom_patterns.clone()
|
|
29814
30026
|
}
|
|
29815
30027
|
|
|
30028
|
+
fn findings(&self) -> Vec<ExternalRedactionFinding> {
|
|
30029
|
+
self.findings.clone()
|
|
30030
|
+
}
|
|
30031
|
+
|
|
30032
|
+
fn min_score(&self) -> Option<f32> {
|
|
30033
|
+
self.min_score
|
|
30034
|
+
}
|
|
30035
|
+
|
|
30036
|
+
fn findings_path(&self) -> Option<String> {
|
|
30037
|
+
self.findings_path.clone()
|
|
30038
|
+
}
|
|
30039
|
+
|
|
30040
|
+
fn findings_offset_encoding(&self) -> RedactionOffsetEncoding {
|
|
30041
|
+
self.findings_offset_encoding.clone()
|
|
30042
|
+
}
|
|
30043
|
+
|
|
29816
30044
|
fn validate(&self) -> Result<(), Error> {
|
|
29817
30045
|
#[allow(clippy::needless_update)]
|
|
29818
30046
|
let core_self = xberg::RedactionConfig {
|
|
@@ -29828,6 +30056,14 @@ impl RedactionConfig {
|
|
|
29828
30056
|
|
|
29829
30057
|
custom_patterns: self.custom_patterns.clone().into_iter().map(Into::into).collect(),
|
|
29830
30058
|
|
|
30059
|
+
findings: self.findings.clone().into_iter().map(Into::into).collect(),
|
|
30060
|
+
|
|
30061
|
+
min_score: self.min_score,
|
|
30062
|
+
|
|
30063
|
+
findings_path: self.findings_path.clone().map(Into::into),
|
|
30064
|
+
|
|
30065
|
+
findings_offset_encoding: self.findings_offset_encoding.clone().into(),
|
|
30066
|
+
|
|
29831
30067
|
..Default::default()
|
|
29832
30068
|
};
|
|
29833
30069
|
let result = core_self.validate().map_err(|e| {
|
|
@@ -30313,7 +30549,10 @@ impl Registry {
|
|
|
30313
30549
|
}
|
|
30314
30550
|
}
|
|
30315
30551
|
|
|
30316
|
-
#[cfg(any(
|
|
30552
|
+
#[cfg(any(
|
|
30553
|
+
any(feature = "reranker-presets", feature = "reranker"),
|
|
30554
|
+
not(feature = "reranker-presets")
|
|
30555
|
+
))]
|
|
30317
30556
|
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
30318
30557
|
#[magnus::wrap(class = "Xberg::RerankedDocument")]
|
|
30319
30558
|
pub struct RerankedDocument {
|
|
@@ -30322,10 +30561,16 @@ pub struct RerankedDocument {
|
|
|
30322
30561
|
document: String,
|
|
30323
30562
|
}
|
|
30324
30563
|
|
|
30325
|
-
#[cfg(any(
|
|
30564
|
+
#[cfg(any(
|
|
30565
|
+
any(feature = "reranker-presets", feature = "reranker"),
|
|
30566
|
+
not(feature = "reranker-presets")
|
|
30567
|
+
))]
|
|
30326
30568
|
unsafe impl IntoValueFromNative for RerankedDocument {}
|
|
30327
30569
|
|
|
30328
|
-
#[cfg(any(
|
|
30570
|
+
#[cfg(any(
|
|
30571
|
+
any(feature = "reranker-presets", feature = "reranker"),
|
|
30572
|
+
not(feature = "reranker-presets")
|
|
30573
|
+
))]
|
|
30329
30574
|
impl magnus::TryConvert for RerankedDocument {
|
|
30330
30575
|
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
30331
30576
|
if let Ok(r) = <&RerankedDocument as magnus::TryConvert>::try_convert(val) {
|
|
@@ -30350,10 +30595,16 @@ impl magnus::TryConvert for RerankedDocument {
|
|
|
30350
30595
|
}
|
|
30351
30596
|
}
|
|
30352
30597
|
|
|
30353
|
-
#[cfg(any(
|
|
30598
|
+
#[cfg(any(
|
|
30599
|
+
any(feature = "reranker-presets", feature = "reranker"),
|
|
30600
|
+
not(feature = "reranker-presets")
|
|
30601
|
+
))]
|
|
30354
30602
|
unsafe impl TryConvertOwned for RerankedDocument {}
|
|
30355
30603
|
|
|
30356
|
-
#[cfg(any(
|
|
30604
|
+
#[cfg(any(
|
|
30605
|
+
any(feature = "reranker-presets", feature = "reranker"),
|
|
30606
|
+
not(feature = "reranker-presets")
|
|
30607
|
+
))]
|
|
30357
30608
|
impl RerankedDocument {
|
|
30358
30609
|
fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
|
|
30359
30610
|
let ruby = unsafe { magnus::Ruby::get_unchecked() };
|
|
@@ -31411,7 +31662,7 @@ impl SitemapUrl {
|
|
|
31411
31662
|
}
|
|
31412
31663
|
}
|
|
31413
31664
|
|
|
31414
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
31665
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
31415
31666
|
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
31416
31667
|
#[magnus::wrap(class = "Xberg::SparseEmbedding")]
|
|
31417
31668
|
pub struct SparseEmbedding {
|
|
@@ -31419,10 +31670,10 @@ pub struct SparseEmbedding {
|
|
|
31419
31670
|
values: Vec<f32>,
|
|
31420
31671
|
}
|
|
31421
31672
|
|
|
31422
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
31673
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
31423
31674
|
unsafe impl IntoValueFromNative for SparseEmbedding {}
|
|
31424
31675
|
|
|
31425
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
31676
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
31426
31677
|
impl magnus::TryConvert for SparseEmbedding {
|
|
31427
31678
|
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
31428
31679
|
if let Ok(r) = <&SparseEmbedding as magnus::TryConvert>::try_convert(val) {
|
|
@@ -31447,10 +31698,10 @@ impl magnus::TryConvert for SparseEmbedding {
|
|
|
31447
31698
|
}
|
|
31448
31699
|
}
|
|
31449
31700
|
|
|
31450
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
31701
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
31451
31702
|
unsafe impl TryConvertOwned for SparseEmbedding {}
|
|
31452
31703
|
|
|
31453
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
31704
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
31454
31705
|
impl SparseEmbedding {
|
|
31455
31706
|
fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
|
|
31456
31707
|
let ruby = unsafe { magnus::Ruby::get_unchecked() };
|
|
@@ -31648,7 +31899,7 @@ impl SparseEmbeddingConfig {
|
|
|
31648
31899
|
}
|
|
31649
31900
|
}
|
|
31650
31901
|
|
|
31651
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
31902
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
31652
31903
|
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
31653
31904
|
#[magnus::wrap(class = "Xberg::SparseEmbeddingPreset")]
|
|
31654
31905
|
pub struct SparseEmbeddingPreset {
|
|
@@ -31660,10 +31911,10 @@ pub struct SparseEmbeddingPreset {
|
|
|
31660
31911
|
description: String,
|
|
31661
31912
|
}
|
|
31662
31913
|
|
|
31663
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
31914
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
31664
31915
|
unsafe impl IntoValueFromNative for SparseEmbeddingPreset {}
|
|
31665
31916
|
|
|
31666
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
31917
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
31667
31918
|
impl magnus::TryConvert for SparseEmbeddingPreset {
|
|
31668
31919
|
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
31669
31920
|
if let Ok(r) = <&SparseEmbeddingPreset as magnus::TryConvert>::try_convert(val) {
|
|
@@ -31688,10 +31939,10 @@ impl magnus::TryConvert for SparseEmbeddingPreset {
|
|
|
31688
31939
|
}
|
|
31689
31940
|
}
|
|
31690
31941
|
|
|
31691
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
31942
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
31692
31943
|
unsafe impl TryConvertOwned for SparseEmbeddingPreset {}
|
|
31693
31944
|
|
|
31694
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
31945
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
31695
31946
|
impl SparseEmbeddingPreset {
|
|
31696
31947
|
fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
|
|
31697
31948
|
let ruby = unsafe { magnus::Ruby::get_unchecked() };
|
|
@@ -36613,6 +36864,59 @@ impl magnus::TryConvert for CandleTrocrVariant {
|
|
|
36613
36864
|
unsafe impl IntoValueFromNative for CandleTrocrVariant {}
|
|
36614
36865
|
unsafe impl TryConvertOwned for CandleTrocrVariant {}
|
|
36615
36866
|
|
|
36867
|
+
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
|
|
36868
|
+
#[serde(rename_all = "snake_case")]
|
|
36869
|
+
pub enum CaptionAltTextMode {
|
|
36870
|
+
Preserve,
|
|
36871
|
+
Combine,
|
|
36872
|
+
Replace,
|
|
36873
|
+
}
|
|
36874
|
+
|
|
36875
|
+
impl Default for CaptionAltTextMode {
|
|
36876
|
+
fn default() -> Self {
|
|
36877
|
+
Self::Preserve
|
|
36878
|
+
}
|
|
36879
|
+
}
|
|
36880
|
+
|
|
36881
|
+
impl magnus::IntoValue for CaptionAltTextMode {
|
|
36882
|
+
fn into_value_with(self, handle: &Ruby) -> magnus::Value {
|
|
36883
|
+
let sym = match self {
|
|
36884
|
+
CaptionAltTextMode::Preserve => "preserve",
|
|
36885
|
+
CaptionAltTextMode::Combine => "combine",
|
|
36886
|
+
CaptionAltTextMode::Replace => "replace",
|
|
36887
|
+
};
|
|
36888
|
+
handle.to_symbol(sym).into_value_with(handle)
|
|
36889
|
+
}
|
|
36890
|
+
}
|
|
36891
|
+
|
|
36892
|
+
impl magnus::TryConvert for CaptionAltTextMode {
|
|
36893
|
+
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
36894
|
+
// IntoValue emits Symbols, including when this enum is a Hash key.
|
|
36895
|
+
// Accept that exact representation as well as String inputs; do not
|
|
36896
|
+
// coerce arbitrary objects through to_s.
|
|
36897
|
+
let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
|
|
36898
|
+
symbol.name()?.into_owned()
|
|
36899
|
+
} else {
|
|
36900
|
+
magnus::TryConvert::try_convert(val)?
|
|
36901
|
+
};
|
|
36902
|
+
// Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
|
|
36903
|
+
// emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
|
|
36904
|
+
// existing consumer code written in any of those styles keep working.
|
|
36905
|
+
match s.as_str() {
|
|
36906
|
+
"preserve" | "Preserve" => Ok(CaptionAltTextMode::Preserve),
|
|
36907
|
+
"combine" | "Combine" => Ok(CaptionAltTextMode::Combine),
|
|
36908
|
+
"replace" | "Replace" => Ok(CaptionAltTextMode::Replace),
|
|
36909
|
+
other => Err(magnus::Error::new(
|
|
36910
|
+
unsafe { Ruby::get_unchecked() }.exception_arg_error(),
|
|
36911
|
+
format!("invalid CaptionAltTextMode value: {other}"),
|
|
36912
|
+
)),
|
|
36913
|
+
}
|
|
36914
|
+
}
|
|
36915
|
+
}
|
|
36916
|
+
|
|
36917
|
+
unsafe impl IntoValueFromNative for CaptionAltTextMode {}
|
|
36918
|
+
unsafe impl TryConvertOwned for CaptionAltTextMode {}
|
|
36919
|
+
|
|
36616
36920
|
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
36617
36921
|
#[serde(tag = "type")]
|
|
36618
36922
|
#[serde(rename_all = "snake_case")]
|
|
@@ -38940,6 +39244,58 @@ impl magnus::TryConvert for ImageType {
|
|
|
38940
39244
|
unsafe impl IntoValueFromNative for ImageType {}
|
|
38941
39245
|
unsafe impl TryConvertOwned for ImageType {}
|
|
38942
39246
|
|
|
39247
|
+
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
|
|
39248
|
+
pub enum InlineDataMedia {
|
|
39249
|
+
Keep,
|
|
39250
|
+
AltTextOnly,
|
|
39251
|
+
DropElement,
|
|
39252
|
+
}
|
|
39253
|
+
|
|
39254
|
+
impl Default for InlineDataMedia {
|
|
39255
|
+
fn default() -> Self {
|
|
39256
|
+
Self::Keep
|
|
39257
|
+
}
|
|
39258
|
+
}
|
|
39259
|
+
|
|
39260
|
+
impl magnus::IntoValue for InlineDataMedia {
|
|
39261
|
+
fn into_value_with(self, handle: &Ruby) -> magnus::Value {
|
|
39262
|
+
let sym = match self {
|
|
39263
|
+
InlineDataMedia::Keep => "Keep",
|
|
39264
|
+
InlineDataMedia::AltTextOnly => "AltTextOnly",
|
|
39265
|
+
InlineDataMedia::DropElement => "DropElement",
|
|
39266
|
+
};
|
|
39267
|
+
handle.to_symbol(sym).into_value_with(handle)
|
|
39268
|
+
}
|
|
39269
|
+
}
|
|
39270
|
+
|
|
39271
|
+
impl magnus::TryConvert for InlineDataMedia {
|
|
39272
|
+
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
39273
|
+
// IntoValue emits Symbols, including when this enum is a Hash key.
|
|
39274
|
+
// Accept that exact representation as well as String inputs; do not
|
|
39275
|
+
// coerce arbitrary objects through to_s.
|
|
39276
|
+
let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
|
|
39277
|
+
symbol.name()?.into_owned()
|
|
39278
|
+
} else {
|
|
39279
|
+
magnus::TryConvert::try_convert(val)?
|
|
39280
|
+
};
|
|
39281
|
+
// Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
|
|
39282
|
+
// emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
|
|
39283
|
+
// existing consumer code written in any of those styles keep working.
|
|
39284
|
+
match s.as_str() {
|
|
39285
|
+
"Keep" | "keep" => Ok(InlineDataMedia::Keep),
|
|
39286
|
+
"AltTextOnly" | "alt_text_only" => Ok(InlineDataMedia::AltTextOnly),
|
|
39287
|
+
"DropElement" | "drop_element" => Ok(InlineDataMedia::DropElement),
|
|
39288
|
+
other => Err(magnus::Error::new(
|
|
39289
|
+
unsafe { Ruby::get_unchecked() }.exception_arg_error(),
|
|
39290
|
+
format!("invalid InlineDataMedia value: {other}"),
|
|
39291
|
+
)),
|
|
39292
|
+
}
|
|
39293
|
+
}
|
|
39294
|
+
}
|
|
39295
|
+
|
|
39296
|
+
unsafe impl IntoValueFromNative for InlineDataMedia {}
|
|
39297
|
+
unsafe impl TryConvertOwned for InlineDataMedia {}
|
|
39298
|
+
|
|
38943
39299
|
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
|
|
38944
39300
|
#[serde(rename_all = "snake_case")]
|
|
38945
39301
|
pub enum InlineType {
|
|
@@ -41104,6 +41460,59 @@ impl magnus::TryConvert for ProcessingStage {
|
|
|
41104
41460
|
unsafe impl IntoValueFromNative for ProcessingStage {}
|
|
41105
41461
|
unsafe impl TryConvertOwned for ProcessingStage {}
|
|
41106
41462
|
|
|
41463
|
+
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
|
|
41464
|
+
#[serde(rename_all = "snake_case")]
|
|
41465
|
+
pub enum RedactionOffsetEncoding {
|
|
41466
|
+
Utf8Bytes,
|
|
41467
|
+
UnicodeCodePoints,
|
|
41468
|
+
Utf16CodeUnits,
|
|
41469
|
+
}
|
|
41470
|
+
|
|
41471
|
+
impl Default for RedactionOffsetEncoding {
|
|
41472
|
+
fn default() -> Self {
|
|
41473
|
+
Self::UnicodeCodePoints
|
|
41474
|
+
}
|
|
41475
|
+
}
|
|
41476
|
+
|
|
41477
|
+
impl magnus::IntoValue for RedactionOffsetEncoding {
|
|
41478
|
+
fn into_value_with(self, handle: &Ruby) -> magnus::Value {
|
|
41479
|
+
let sym = match self {
|
|
41480
|
+
RedactionOffsetEncoding::Utf8Bytes => "utf8_bytes",
|
|
41481
|
+
RedactionOffsetEncoding::UnicodeCodePoints => "unicode_code_points",
|
|
41482
|
+
RedactionOffsetEncoding::Utf16CodeUnits => "utf16_code_units",
|
|
41483
|
+
};
|
|
41484
|
+
handle.to_symbol(sym).into_value_with(handle)
|
|
41485
|
+
}
|
|
41486
|
+
}
|
|
41487
|
+
|
|
41488
|
+
impl magnus::TryConvert for RedactionOffsetEncoding {
|
|
41489
|
+
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
41490
|
+
// IntoValue emits Symbols, including when this enum is a Hash key.
|
|
41491
|
+
// Accept that exact representation as well as String inputs; do not
|
|
41492
|
+
// coerce arbitrary objects through to_s.
|
|
41493
|
+
let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
|
|
41494
|
+
symbol.name()?.into_owned()
|
|
41495
|
+
} else {
|
|
41496
|
+
magnus::TryConvert::try_convert(val)?
|
|
41497
|
+
};
|
|
41498
|
+
// Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
|
|
41499
|
+
// emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
|
|
41500
|
+
// existing consumer code written in any of those styles keep working.
|
|
41501
|
+
match s.as_str() {
|
|
41502
|
+
"utf8_bytes" | "Utf8Bytes" => Ok(RedactionOffsetEncoding::Utf8Bytes),
|
|
41503
|
+
"unicode_code_points" | "UnicodeCodePoints" => Ok(RedactionOffsetEncoding::UnicodeCodePoints),
|
|
41504
|
+
"utf16_code_units" | "Utf16CodeUnits" => Ok(RedactionOffsetEncoding::Utf16CodeUnits),
|
|
41505
|
+
other => Err(magnus::Error::new(
|
|
41506
|
+
unsafe { Ruby::get_unchecked() }.exception_arg_error(),
|
|
41507
|
+
format!("invalid RedactionOffsetEncoding value: {other}"),
|
|
41508
|
+
)),
|
|
41509
|
+
}
|
|
41510
|
+
}
|
|
41511
|
+
}
|
|
41512
|
+
|
|
41513
|
+
unsafe impl IntoValueFromNative for RedactionOffsetEncoding {}
|
|
41514
|
+
unsafe impl TryConvertOwned for RedactionOffsetEncoding {}
|
|
41515
|
+
|
|
41107
41516
|
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
|
|
41108
41517
|
#[serde(rename_all = "snake_case")]
|
|
41109
41518
|
pub enum RedactionStrategy {
|
|
@@ -42701,6 +43110,130 @@ fn extract_batch_async(args: &[magnus::Value]) -> Result<ExtractionResult, Error
|
|
|
42701
43110
|
Ok(result.into())
|
|
42702
43111
|
}
|
|
42703
43112
|
|
|
43113
|
+
#[cfg(feature = "redaction")]
|
|
43114
|
+
fn extract_with_external_redaction(args: &[magnus::Value]) -> Result<ExtractionResult, Error> {
|
|
43115
|
+
let args = magnus::scan_args::scan_args::<
|
|
43116
|
+
(magnus::Value, magnus::Value, String),
|
|
43117
|
+
(Option<magnus::Value>, Option<u32>),
|
|
43118
|
+
(),
|
|
43119
|
+
(),
|
|
43120
|
+
(),
|
|
43121
|
+
(),
|
|
43122
|
+
>(args)?;
|
|
43123
|
+
let (input, config, findings_json) = args.required;
|
|
43124
|
+
|
|
43125
|
+
let (offset_encoding, max_findings) = args.optional;
|
|
43126
|
+
|
|
43127
|
+
let offset_encoding: Option<String> = offset_encoding.and_then(|v| {
|
|
43128
|
+
if v.is_nil() {
|
|
43129
|
+
None
|
|
43130
|
+
} else {
|
|
43131
|
+
Some(String::try_convert(v).unwrap_or_default())
|
|
43132
|
+
}
|
|
43133
|
+
});
|
|
43134
|
+
|
|
43135
|
+
let input_core: xberg::ExtractInput = {
|
|
43136
|
+
let binding_val: ExtractInput = ExtractInput::try_convert(input).map_err(|e| {
|
|
43137
|
+
magnus::Error::new(
|
|
43138
|
+
unsafe { Ruby::get_unchecked() }.exception_runtime_error(),
|
|
43139
|
+
e.to_string(),
|
|
43140
|
+
)
|
|
43141
|
+
})?;
|
|
43142
|
+
binding_val.into()
|
|
43143
|
+
};
|
|
43144
|
+
let config_core: xberg::ExtractionConfig = {
|
|
43145
|
+
let binding_val: ExtractionConfig = ExtractionConfig::try_convert(config).map_err(|e| {
|
|
43146
|
+
magnus::Error::new(
|
|
43147
|
+
unsafe { Ruby::get_unchecked() }.exception_runtime_error(),
|
|
43148
|
+
e.to_string(),
|
|
43149
|
+
)
|
|
43150
|
+
})?;
|
|
43151
|
+
binding_val.into()
|
|
43152
|
+
};
|
|
43153
|
+
let async_result = alef_magnus_run_without_gvl(move || -> Result<_, String> {
|
|
43154
|
+
let rt = tokio::runtime::Builder::new_current_thread()
|
|
43155
|
+
.enable_all()
|
|
43156
|
+
.build()
|
|
43157
|
+
.map_err(|e| e.to_string())?;
|
|
43158
|
+
rt.block_on(async {
|
|
43159
|
+
xberg::extract_with_external_redaction(
|
|
43160
|
+
input_core,
|
|
43161
|
+
&config_core,
|
|
43162
|
+
&findings_json,
|
|
43163
|
+
offset_encoding.as_deref(),
|
|
43164
|
+
max_findings,
|
|
43165
|
+
)
|
|
43166
|
+
.await
|
|
43167
|
+
})
|
|
43168
|
+
.map_err(|e| e.to_string())
|
|
43169
|
+
});
|
|
43170
|
+
let result = async_result
|
|
43171
|
+
.map_err(|message| magnus::Error::new(unsafe { Ruby::get_unchecked() }.exception_runtime_error(), message))?;
|
|
43172
|
+
Ok(result.into())
|
|
43173
|
+
}
|
|
43174
|
+
|
|
43175
|
+
#[cfg(feature = "redaction")]
|
|
43176
|
+
fn extract_with_external_redaction_async(args: &[magnus::Value]) -> Result<ExtractionResult, Error> {
|
|
43177
|
+
let args = magnus::scan_args::scan_args::<
|
|
43178
|
+
(magnus::Value, magnus::Value, String),
|
|
43179
|
+
(Option<magnus::Value>, Option<u32>),
|
|
43180
|
+
(),
|
|
43181
|
+
(),
|
|
43182
|
+
(),
|
|
43183
|
+
(),
|
|
43184
|
+
>(args)?;
|
|
43185
|
+
let (input, config, findings_json) = args.required;
|
|
43186
|
+
|
|
43187
|
+
let (offset_encoding, max_findings) = args.optional;
|
|
43188
|
+
|
|
43189
|
+
let offset_encoding: Option<String> = offset_encoding.and_then(|v| {
|
|
43190
|
+
if v.is_nil() {
|
|
43191
|
+
None
|
|
43192
|
+
} else {
|
|
43193
|
+
Some(String::try_convert(v).unwrap_or_default())
|
|
43194
|
+
}
|
|
43195
|
+
});
|
|
43196
|
+
|
|
43197
|
+
let input_core: xberg::ExtractInput = {
|
|
43198
|
+
let binding_val: ExtractInput = ExtractInput::try_convert(input).map_err(|e| {
|
|
43199
|
+
magnus::Error::new(
|
|
43200
|
+
unsafe { Ruby::get_unchecked() }.exception_runtime_error(),
|
|
43201
|
+
e.to_string(),
|
|
43202
|
+
)
|
|
43203
|
+
})?;
|
|
43204
|
+
binding_val.into()
|
|
43205
|
+
};
|
|
43206
|
+
let config_core: xberg::ExtractionConfig = {
|
|
43207
|
+
let binding_val: ExtractionConfig = ExtractionConfig::try_convert(config).map_err(|e| {
|
|
43208
|
+
magnus::Error::new(
|
|
43209
|
+
unsafe { Ruby::get_unchecked() }.exception_runtime_error(),
|
|
43210
|
+
e.to_string(),
|
|
43211
|
+
)
|
|
43212
|
+
})?;
|
|
43213
|
+
binding_val.into()
|
|
43214
|
+
};
|
|
43215
|
+
let async_result = alef_magnus_run_without_gvl(move || -> Result<_, String> {
|
|
43216
|
+
let rt = tokio::runtime::Builder::new_current_thread()
|
|
43217
|
+
.enable_all()
|
|
43218
|
+
.build()
|
|
43219
|
+
.map_err(|e| e.to_string())?;
|
|
43220
|
+
rt.block_on(async {
|
|
43221
|
+
xberg::extract_with_external_redaction(
|
|
43222
|
+
input_core,
|
|
43223
|
+
&config_core,
|
|
43224
|
+
&findings_json,
|
|
43225
|
+
offset_encoding.as_deref(),
|
|
43226
|
+
max_findings,
|
|
43227
|
+
)
|
|
43228
|
+
.await
|
|
43229
|
+
})
|
|
43230
|
+
.map_err(|e| e.to_string())
|
|
43231
|
+
});
|
|
43232
|
+
let result = async_result
|
|
43233
|
+
.map_err(|message| magnus::Error::new(unsafe { Ruby::get_unchecked() }.exception_runtime_error(), message))?;
|
|
43234
|
+
Ok(result.into())
|
|
43235
|
+
}
|
|
43236
|
+
|
|
42704
43237
|
#[cfg(feature = "markdown-footnotes")]
|
|
42705
43238
|
fn find_unmarked_claims(markdown: String) -> Vec<String> {
|
|
42706
43239
|
xberg::find_unmarked_claims(&markdown)
|
|
@@ -42997,6 +43530,114 @@ fn pdf_page_count(args: &[magnus::Value]) -> Result<usize, Error> {
|
|
|
42997
43530
|
Ok(result)
|
|
42998
43531
|
}
|
|
42999
43532
|
|
|
43533
|
+
#[cfg(feature = "redaction")]
|
|
43534
|
+
fn redact_external(args: &[magnus::Value]) -> Result<ExtractedDocument, Error> {
|
|
43535
|
+
let args = magnus::scan_args::scan_args::<
|
|
43536
|
+
(magnus::Value, magnus::Value, String),
|
|
43537
|
+
(Option<magnus::Value>, Option<u32>),
|
|
43538
|
+
(),
|
|
43539
|
+
(),
|
|
43540
|
+
(),
|
|
43541
|
+
(),
|
|
43542
|
+
>(args)?;
|
|
43543
|
+
let (document, config, findings_json) = args.required;
|
|
43544
|
+
|
|
43545
|
+
let (offset_encoding, max_findings) = args.optional;
|
|
43546
|
+
|
|
43547
|
+
let offset_encoding: Option<String> = offset_encoding.and_then(|v| {
|
|
43548
|
+
if v.is_nil() {
|
|
43549
|
+
None
|
|
43550
|
+
} else {
|
|
43551
|
+
Some(String::try_convert(v).unwrap_or_default())
|
|
43552
|
+
}
|
|
43553
|
+
});
|
|
43554
|
+
|
|
43555
|
+
let document: xberg::ExtractedDocument = {
|
|
43556
|
+
let binding_val: ExtractedDocument = ExtractedDocument::try_convert(document)
|
|
43557
|
+
.map_err(|e| magnus::Error::new(unsafe { Ruby::get_unchecked() }.exception_type_error(), e.to_string()))?;
|
|
43558
|
+
binding_val.into()
|
|
43559
|
+
};
|
|
43560
|
+
let config: xberg::RedactionConfig = {
|
|
43561
|
+
let binding_val: RedactionConfig = RedactionConfig::try_convert(config)
|
|
43562
|
+
.map_err(|e| magnus::Error::new(unsafe { Ruby::get_unchecked() }.exception_type_error(), e.to_string()))?;
|
|
43563
|
+
binding_val.into()
|
|
43564
|
+
};
|
|
43565
|
+
let async_result = alef_magnus_run_without_gvl(move || -> Result<_, String> {
|
|
43566
|
+
let rt = tokio::runtime::Builder::new_current_thread()
|
|
43567
|
+
.enable_all()
|
|
43568
|
+
.build()
|
|
43569
|
+
.map_err(|e| e.to_string())?;
|
|
43570
|
+
rt.block_on(async {
|
|
43571
|
+
xberg::redact_external(
|
|
43572
|
+
document.into(),
|
|
43573
|
+
config.into(),
|
|
43574
|
+
&findings_json,
|
|
43575
|
+
offset_encoding.as_deref(),
|
|
43576
|
+
max_findings,
|
|
43577
|
+
)
|
|
43578
|
+
.await
|
|
43579
|
+
})
|
|
43580
|
+
.map_err(|e| e.to_string())
|
|
43581
|
+
});
|
|
43582
|
+
let result = async_result
|
|
43583
|
+
.map_err(|message| magnus::Error::new(unsafe { Ruby::get_unchecked() }.exception_runtime_error(), message))?;
|
|
43584
|
+
Ok(result.into())
|
|
43585
|
+
}
|
|
43586
|
+
|
|
43587
|
+
#[cfg(feature = "redaction")]
|
|
43588
|
+
fn redact_external_async(args: &[magnus::Value]) -> Result<ExtractedDocument, Error> {
|
|
43589
|
+
let args = magnus::scan_args::scan_args::<
|
|
43590
|
+
(magnus::Value, magnus::Value, String),
|
|
43591
|
+
(Option<magnus::Value>, Option<u32>),
|
|
43592
|
+
(),
|
|
43593
|
+
(),
|
|
43594
|
+
(),
|
|
43595
|
+
(),
|
|
43596
|
+
>(args)?;
|
|
43597
|
+
let (document, config, findings_json) = args.required;
|
|
43598
|
+
|
|
43599
|
+
let (offset_encoding, max_findings) = args.optional;
|
|
43600
|
+
|
|
43601
|
+
let offset_encoding: Option<String> = offset_encoding.and_then(|v| {
|
|
43602
|
+
if v.is_nil() {
|
|
43603
|
+
None
|
|
43604
|
+
} else {
|
|
43605
|
+
Some(String::try_convert(v).unwrap_or_default())
|
|
43606
|
+
}
|
|
43607
|
+
});
|
|
43608
|
+
|
|
43609
|
+
let document: xberg::ExtractedDocument = {
|
|
43610
|
+
let binding_val: ExtractedDocument = ExtractedDocument::try_convert(document)
|
|
43611
|
+
.map_err(|e| magnus::Error::new(unsafe { Ruby::get_unchecked() }.exception_type_error(), e.to_string()))?;
|
|
43612
|
+
binding_val.into()
|
|
43613
|
+
};
|
|
43614
|
+
let config: xberg::RedactionConfig = {
|
|
43615
|
+
let binding_val: RedactionConfig = RedactionConfig::try_convert(config)
|
|
43616
|
+
.map_err(|e| magnus::Error::new(unsafe { Ruby::get_unchecked() }.exception_type_error(), e.to_string()))?;
|
|
43617
|
+
binding_val.into()
|
|
43618
|
+
};
|
|
43619
|
+
let async_result = alef_magnus_run_without_gvl(move || -> Result<_, String> {
|
|
43620
|
+
let rt = tokio::runtime::Builder::new_current_thread()
|
|
43621
|
+
.enable_all()
|
|
43622
|
+
.build()
|
|
43623
|
+
.map_err(|e| e.to_string())?;
|
|
43624
|
+
rt.block_on(async {
|
|
43625
|
+
xberg::redact_external(
|
|
43626
|
+
document.into(),
|
|
43627
|
+
config.into(),
|
|
43628
|
+
&findings_json,
|
|
43629
|
+
offset_encoding.as_deref(),
|
|
43630
|
+
max_findings,
|
|
43631
|
+
)
|
|
43632
|
+
.await
|
|
43633
|
+
})
|
|
43634
|
+
.map_err(|e| e.to_string())
|
|
43635
|
+
});
|
|
43636
|
+
let result = async_result
|
|
43637
|
+
.map_err(|message| magnus::Error::new(unsafe { Ruby::get_unchecked() }.exception_runtime_error(), message))?;
|
|
43638
|
+
Ok(result.into())
|
|
43639
|
+
}
|
|
43640
|
+
|
|
43000
43641
|
#[cfg(feature = "markdown-footnotes")]
|
|
43001
43642
|
fn verify_excerpt(excerpt: String, source_text: String) -> bool {
|
|
43002
43643
|
xberg::verify_excerpt(&excerpt, &source_text)
|
|
@@ -47731,6 +48372,7 @@ impl From<CaptioningConfig> for xberg::CaptioningConfig {
|
|
|
47731
48372
|
llm: val.llm.into(),
|
|
47732
48373
|
prompt: val.prompt,
|
|
47733
48374
|
min_image_area: val.min_image_area,
|
|
48375
|
+
alt_text: val.alt_text.into(),
|
|
47734
48376
|
}
|
|
47735
48377
|
}
|
|
47736
48378
|
}
|
|
@@ -47742,6 +48384,7 @@ impl From<xberg::CaptioningConfig> for CaptioningConfig {
|
|
|
47742
48384
|
llm: val.llm.into(),
|
|
47743
48385
|
prompt: val.prompt.map(|v| v.to_string()),
|
|
47744
48386
|
min_image_area: val.min_image_area,
|
|
48387
|
+
alt_text: val.alt_text.into(),
|
|
47745
48388
|
}
|
|
47746
48389
|
}
|
|
47747
48390
|
}
|
|
@@ -47775,9 +48418,9 @@ impl From<Chunk> for xberg::Chunk {
|
|
|
47775
48418
|
content: val.content,
|
|
47776
48419
|
chunk_type: val.chunk_type.into(),
|
|
47777
48420
|
embedding: val.embedding.map(|v| v.into_iter().collect()),
|
|
47778
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
48421
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
47779
48422
|
sparse_embedding: val.sparse_embedding.map(Into::into),
|
|
47780
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
48423
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
47781
48424
|
late_interaction: val.late_interaction.map(Into::into),
|
|
47782
48425
|
metadata: val.metadata.into(),
|
|
47783
48426
|
}
|
|
@@ -47791,9 +48434,9 @@ impl From<xberg::Chunk> for Chunk {
|
|
|
47791
48434
|
content: val.content.to_string(),
|
|
47792
48435
|
chunk_type: val.chunk_type.into(),
|
|
47793
48436
|
embedding: val.embedding.map(|v| v.into_iter().collect()),
|
|
47794
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
48437
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
47795
48438
|
sparse_embedding: val.sparse_embedding.map(Into::into),
|
|
47796
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
48439
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
47797
48440
|
late_interaction: val.late_interaction.map(Into::into),
|
|
47798
48441
|
metadata: val.metadata.into(),
|
|
47799
48442
|
}
|
|
@@ -48268,6 +48911,7 @@ impl From<ConversionOptions> for html_to_markdown_rs::ConversionOptions {
|
|
|
48268
48911
|
strip_tags: val.strip_tags.into_iter().collect(),
|
|
48269
48912
|
preserve_tags: val.preserve_tags.into_iter().collect(),
|
|
48270
48913
|
skip_images: val.skip_images,
|
|
48914
|
+
inline_data_media: val.inline_data_media.into(),
|
|
48271
48915
|
url_escape_style: val.url_escape_style.into(),
|
|
48272
48916
|
link_style: val.link_style.into(),
|
|
48273
48917
|
output_format: val.output_format.into(),
|
|
@@ -48321,6 +48965,7 @@ impl From<html_to_markdown_rs::ConversionOptions> for ConversionOptions {
|
|
|
48321
48965
|
strip_tags: val.strip_tags.into_iter().collect(),
|
|
48322
48966
|
preserve_tags: val.preserve_tags.into_iter().collect(),
|
|
48323
48967
|
skip_images: val.skip_images,
|
|
48968
|
+
inline_data_media: val.inline_data_media.into(),
|
|
48324
48969
|
url_escape_style: val.url_escape_style.into(),
|
|
48325
48970
|
link_style: val.link_style.into(),
|
|
48326
48971
|
output_format: val.output_format.into(),
|
|
@@ -49443,6 +50088,33 @@ impl From<xberg::ExcelWorkbook> for ExcelWorkbook {
|
|
|
49443
50088
|
}
|
|
49444
50089
|
}
|
|
49445
50090
|
|
|
50091
|
+
#[allow(clippy::needless_update)]
|
|
50092
|
+
impl From<ExternalRedactionFinding> for xberg::ExternalRedactionFinding {
|
|
50093
|
+
fn from(val: ExternalRedactionFinding) -> Self {
|
|
50094
|
+
Self {
|
|
50095
|
+
label: val.label,
|
|
50096
|
+
text: val.text,
|
|
50097
|
+
start: val.start,
|
|
50098
|
+
end: val.end,
|
|
50099
|
+
score: val.score,
|
|
50100
|
+
..Default::default()
|
|
50101
|
+
}
|
|
50102
|
+
}
|
|
50103
|
+
}
|
|
50104
|
+
|
|
50105
|
+
#[allow(clippy::redundant_closure)]
|
|
50106
|
+
impl From<xberg::ExternalRedactionFinding> for ExternalRedactionFinding {
|
|
50107
|
+
fn from(val: xberg::ExternalRedactionFinding) -> Self {
|
|
50108
|
+
Self {
|
|
50109
|
+
label: val.label.to_string(),
|
|
50110
|
+
text: val.text.map(|v| v.to_string()),
|
|
50111
|
+
start: val.start,
|
|
50112
|
+
end: val.end,
|
|
50113
|
+
score: val.score,
|
|
50114
|
+
}
|
|
50115
|
+
}
|
|
50116
|
+
}
|
|
50117
|
+
|
|
49446
50118
|
#[allow(clippy::needless_update)]
|
|
49447
50119
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
49448
50120
|
impl From<ExtractInput> for xberg::ExtractInput {
|
|
@@ -50930,7 +51602,7 @@ impl From<xberg::LateInteractionConfig> for LateInteractionConfig {
|
|
|
50930
51602
|
}
|
|
50931
51603
|
}
|
|
50932
51604
|
|
|
50933
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
51605
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
50934
51606
|
impl From<LateInteractionMatch> for xberg::LateInteractionMatch {
|
|
50935
51607
|
fn from(val: LateInteractionMatch) -> Self {
|
|
50936
51608
|
Self {
|
|
@@ -50940,7 +51612,7 @@ impl From<LateInteractionMatch> for xberg::LateInteractionMatch {
|
|
|
50940
51612
|
}
|
|
50941
51613
|
}
|
|
50942
51614
|
|
|
50943
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
51615
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
50944
51616
|
impl From<xberg::LateInteractionMatch> for LateInteractionMatch {
|
|
50945
51617
|
fn from(val: xberg::LateInteractionMatch) -> Self {
|
|
50946
51618
|
Self {
|
|
@@ -50950,7 +51622,7 @@ impl From<xberg::LateInteractionMatch> for LateInteractionMatch {
|
|
|
50950
51622
|
}
|
|
50951
51623
|
}
|
|
50952
51624
|
|
|
50953
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
51625
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
50954
51626
|
impl From<xberg::LateInteractionPreset> for LateInteractionPreset {
|
|
50955
51627
|
fn from(val: xberg::LateInteractionPreset) -> Self {
|
|
50956
51628
|
Self {
|
|
@@ -51409,7 +52081,6 @@ impl From<xberg::Metadata> for Metadata {
|
|
|
51409
52081
|
}
|
|
51410
52082
|
}
|
|
51411
52083
|
|
|
51412
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
51413
52084
|
impl From<xberg::ModelPaths> for ModelPaths {
|
|
51414
52085
|
fn from(val: xberg::ModelPaths) -> Self {
|
|
51415
52086
|
Self {
|
|
@@ -51421,7 +52092,7 @@ impl From<xberg::ModelPaths> for ModelPaths {
|
|
|
51421
52092
|
}
|
|
51422
52093
|
}
|
|
51423
52094
|
|
|
51424
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
52095
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
51425
52096
|
impl From<MultiVectorEmbedding> for xberg::MultiVectorEmbedding {
|
|
51426
52097
|
fn from(val: MultiVectorEmbedding) -> Self {
|
|
51427
52098
|
Self {
|
|
@@ -51432,7 +52103,7 @@ impl From<MultiVectorEmbedding> for xberg::MultiVectorEmbedding {
|
|
|
51432
52103
|
}
|
|
51433
52104
|
}
|
|
51434
52105
|
|
|
51435
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
52106
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
51436
52107
|
impl From<xberg::MultiVectorEmbedding> for MultiVectorEmbedding {
|
|
51437
52108
|
fn from(val: xberg::MultiVectorEmbedding) -> Self {
|
|
51438
52109
|
Self {
|
|
@@ -51579,6 +52250,7 @@ impl From<OcrConfig> for xberg::OcrConfig {
|
|
|
51579
52250
|
.paddle_ocr_config
|
|
51580
52251
|
.as_ref()
|
|
51581
52252
|
.and_then(|s| serde_json::from_str(s).ok()),
|
|
52253
|
+
paddle_ocr_settings: val.paddle_ocr_settings.map(Into::into),
|
|
51582
52254
|
backend_options: val.backend_options.as_ref().and_then(|s| serde_json::from_str(s).ok()),
|
|
51583
52255
|
element_config: val.element_config.map(Into::into),
|
|
51584
52256
|
quality_thresholds: val.quality_thresholds.map(Into::into),
|
|
@@ -51609,6 +52281,7 @@ impl From<xberg::OcrConfig> for OcrConfig {
|
|
|
51609
52281
|
tesseract_config: val.tesseract_config.map(Into::into),
|
|
51610
52282
|
output_format: val.output_format.map(Into::into),
|
|
51611
52283
|
paddle_ocr_config: val.paddle_ocr_config.as_ref().map(ToString::to_string),
|
|
52284
|
+
paddle_ocr_settings: val.paddle_ocr_settings.map(Into::into),
|
|
51612
52285
|
backend_options: val.backend_options.as_ref().map(ToString::to_string),
|
|
51613
52286
|
element_config: val.element_config.map(Into::into),
|
|
51614
52287
|
quality_thresholds: val.quality_thresholds.map(Into::into),
|
|
@@ -51773,6 +52446,7 @@ impl From<OcrPipelineStage> for xberg::OcrPipelineStage {
|
|
|
51773
52446
|
.paddle_ocr_config
|
|
51774
52447
|
.as_ref()
|
|
51775
52448
|
.and_then(|s| serde_json::from_str(s).ok()),
|
|
52449
|
+
paddle_ocr_settings: val.paddle_ocr_settings.map(Into::into),
|
|
51776
52450
|
vlm_config: val.vlm_config.map(Into::into),
|
|
51777
52451
|
backend_options: val.backend_options.as_ref().and_then(|s| serde_json::from_str(s).ok()),
|
|
51778
52452
|
}
|
|
@@ -51788,6 +52462,7 @@ impl From<xberg::OcrPipelineStage> for OcrPipelineStage {
|
|
|
51788
52462
|
language: val.language.map(|v| v.into_iter().collect()),
|
|
51789
52463
|
tesseract_config: val.tesseract_config.map(Into::into),
|
|
51790
52464
|
paddle_ocr_config: val.paddle_ocr_config.as_ref().map(ToString::to_string),
|
|
52465
|
+
paddle_ocr_settings: val.paddle_ocr_settings.map(Into::into),
|
|
51791
52466
|
vlm_config: val.vlm_config.map(Into::into),
|
|
51792
52467
|
backend_options: val.backend_options.as_ref().map(ToString::to_string),
|
|
51793
52468
|
}
|
|
@@ -51930,7 +52605,6 @@ impl From<xberg::OrientationResult> for OrientationResult {
|
|
|
51930
52605
|
}
|
|
51931
52606
|
}
|
|
51932
52607
|
|
|
51933
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
51934
52608
|
#[allow(clippy::needless_update)]
|
|
51935
52609
|
#[allow(clippy::useless_conversion)]
|
|
51936
52610
|
impl From<PaddleOcrConfig> for xberg::PaddleOcrConfig {
|
|
@@ -51955,7 +52629,6 @@ impl From<PaddleOcrConfig> for xberg::PaddleOcrConfig {
|
|
|
51955
52629
|
}
|
|
51956
52630
|
}
|
|
51957
52631
|
|
|
51958
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
51959
52632
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
51960
52633
|
impl From<xberg::PaddleOcrConfig> for PaddleOcrConfig {
|
|
51961
52634
|
fn from(val: xberg::PaddleOcrConfig) -> Self {
|
|
@@ -52901,12 +53574,16 @@ impl From<RedactionConfig> for xberg::RedactionConfig {
|
|
|
52901
53574
|
preserve_offsets: val.preserve_offsets,
|
|
52902
53575
|
custom_terms: val.custom_terms.into_iter().map(Into::into).collect(),
|
|
52903
53576
|
custom_patterns: val.custom_patterns.into_iter().map(Into::into).collect(),
|
|
53577
|
+
findings: val.findings.into_iter().map(Into::into).collect(),
|
|
53578
|
+
min_score: val.min_score,
|
|
53579
|
+
findings_path: val.findings_path.map(Into::into),
|
|
53580
|
+
findings_offset_encoding: val.findings_offset_encoding.into(),
|
|
52904
53581
|
..Default::default()
|
|
52905
53582
|
}
|
|
52906
53583
|
}
|
|
52907
53584
|
}
|
|
52908
53585
|
|
|
52909
|
-
#[allow(clippy::useless_conversion)]
|
|
53586
|
+
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
52910
53587
|
impl From<xberg::RedactionConfig> for RedactionConfig {
|
|
52911
53588
|
fn from(val: xberg::RedactionConfig) -> Self {
|
|
52912
53589
|
Self {
|
|
@@ -52916,6 +53593,10 @@ impl From<xberg::RedactionConfig> for RedactionConfig {
|
|
|
52916
53593
|
preserve_offsets: val.preserve_offsets,
|
|
52917
53594
|
custom_terms: val.custom_terms.into_iter().map(Into::into).collect(),
|
|
52918
53595
|
custom_patterns: val.custom_patterns.into_iter().map(Into::into).collect(),
|
|
53596
|
+
findings: val.findings.into_iter().map(Into::into).collect(),
|
|
53597
|
+
min_score: val.min_score,
|
|
53598
|
+
findings_path: val.findings_path.map(|p| p.to_string_lossy().to_string()),
|
|
53599
|
+
findings_offset_encoding: val.findings_offset_encoding.into(),
|
|
52919
53600
|
}
|
|
52920
53601
|
}
|
|
52921
53602
|
}
|
|
@@ -53006,7 +53687,10 @@ impl From<xberg::RedactionTerm> for RedactionTerm {
|
|
|
53006
53687
|
}
|
|
53007
53688
|
}
|
|
53008
53689
|
|
|
53009
|
-
#[cfg(any(
|
|
53690
|
+
#[cfg(any(
|
|
53691
|
+
any(feature = "reranker-presets", feature = "reranker"),
|
|
53692
|
+
not(feature = "reranker-presets")
|
|
53693
|
+
))]
|
|
53010
53694
|
impl From<xberg::RerankedDocument> for RerankedDocument {
|
|
53011
53695
|
fn from(val: xberg::RerankedDocument) -> Self {
|
|
53012
53696
|
Self {
|
|
@@ -53182,7 +53866,7 @@ impl From<crawlberg::SitemapUrl> for SitemapUrl {
|
|
|
53182
53866
|
}
|
|
53183
53867
|
}
|
|
53184
53868
|
|
|
53185
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
53869
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
53186
53870
|
impl From<SparseEmbedding> for xberg::SparseEmbedding {
|
|
53187
53871
|
fn from(val: SparseEmbedding) -> Self {
|
|
53188
53872
|
Self {
|
|
@@ -53192,7 +53876,7 @@ impl From<SparseEmbedding> for xberg::SparseEmbedding {
|
|
|
53192
53876
|
}
|
|
53193
53877
|
}
|
|
53194
53878
|
|
|
53195
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
53879
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
53196
53880
|
impl From<xberg::SparseEmbedding> for SparseEmbedding {
|
|
53197
53881
|
fn from(val: xberg::SparseEmbedding) -> Self {
|
|
53198
53882
|
Self {
|
|
@@ -53234,7 +53918,7 @@ impl From<xberg::SparseEmbeddingConfig> for SparseEmbeddingConfig {
|
|
|
53234
53918
|
}
|
|
53235
53919
|
}
|
|
53236
53920
|
|
|
53237
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
53921
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
53238
53922
|
impl From<xberg::SparseEmbeddingPreset> for SparseEmbeddingPreset {
|
|
53239
53923
|
fn from(val: xberg::SparseEmbeddingPreset) -> Self {
|
|
53240
53924
|
Self {
|
|
@@ -54289,6 +54973,26 @@ impl From<xberg::candle_ocr::CandleTrocrVariant> for CandleTrocrVariant {
|
|
|
54289
54973
|
}
|
|
54290
54974
|
}
|
|
54291
54975
|
|
|
54976
|
+
impl From<CaptionAltTextMode> for xberg::CaptionAltTextMode {
|
|
54977
|
+
fn from(val: CaptionAltTextMode) -> Self {
|
|
54978
|
+
match val {
|
|
54979
|
+
CaptionAltTextMode::Preserve => Self::Preserve,
|
|
54980
|
+
CaptionAltTextMode::Combine => Self::Combine,
|
|
54981
|
+
CaptionAltTextMode::Replace => Self::Replace,
|
|
54982
|
+
}
|
|
54983
|
+
}
|
|
54984
|
+
}
|
|
54985
|
+
|
|
54986
|
+
impl From<xberg::CaptionAltTextMode> for CaptionAltTextMode {
|
|
54987
|
+
fn from(val: xberg::CaptionAltTextMode) -> Self {
|
|
54988
|
+
match val {
|
|
54989
|
+
xberg::CaptionAltTextMode::Preserve => Self::Preserve,
|
|
54990
|
+
xberg::CaptionAltTextMode::Combine => Self::Combine,
|
|
54991
|
+
xberg::CaptionAltTextMode::Replace => Self::Replace,
|
|
54992
|
+
}
|
|
54993
|
+
}
|
|
54994
|
+
}
|
|
54995
|
+
|
|
54292
54996
|
impl From<ChunkSizing> for xberg::ChunkSizing {
|
|
54293
54997
|
fn from(val: ChunkSizing) -> Self {
|
|
54294
54998
|
match val {
|
|
@@ -55185,6 +55889,26 @@ impl From<xberg::ImageType> for ImageType {
|
|
|
55185
55889
|
}
|
|
55186
55890
|
}
|
|
55187
55891
|
|
|
55892
|
+
impl From<InlineDataMedia> for html_to_markdown_rs::InlineDataMedia {
|
|
55893
|
+
fn from(val: InlineDataMedia) -> Self {
|
|
55894
|
+
match val {
|
|
55895
|
+
InlineDataMedia::Keep => Self::Keep,
|
|
55896
|
+
InlineDataMedia::AltTextOnly => Self::AltTextOnly,
|
|
55897
|
+
InlineDataMedia::DropElement => Self::DropElement,
|
|
55898
|
+
}
|
|
55899
|
+
}
|
|
55900
|
+
}
|
|
55901
|
+
|
|
55902
|
+
impl From<html_to_markdown_rs::InlineDataMedia> for InlineDataMedia {
|
|
55903
|
+
fn from(val: html_to_markdown_rs::InlineDataMedia) -> Self {
|
|
55904
|
+
match val {
|
|
55905
|
+
html_to_markdown_rs::InlineDataMedia::Keep => Self::Keep,
|
|
55906
|
+
html_to_markdown_rs::InlineDataMedia::AltTextOnly => Self::AltTextOnly,
|
|
55907
|
+
html_to_markdown_rs::InlineDataMedia::DropElement => Self::DropElement,
|
|
55908
|
+
}
|
|
55909
|
+
}
|
|
55910
|
+
}
|
|
55911
|
+
|
|
55188
55912
|
impl From<InlineType> for xberg::InlineType {
|
|
55189
55913
|
fn from(val: InlineType) -> Self {
|
|
55190
55914
|
match val {
|
|
@@ -55802,7 +56526,6 @@ impl From<xberg::PSMMode> for PSMMode {
|
|
|
55802
56526
|
}
|
|
55803
56527
|
}
|
|
55804
56528
|
|
|
55805
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
55806
56529
|
impl From<PaddleInferenceBackend> for xberg::PaddleInferenceBackend {
|
|
55807
56530
|
fn from(val: PaddleInferenceBackend) -> Self {
|
|
55808
56531
|
match val {
|
|
@@ -55812,7 +56535,6 @@ impl From<PaddleInferenceBackend> for xberg::PaddleInferenceBackend {
|
|
|
55812
56535
|
}
|
|
55813
56536
|
}
|
|
55814
56537
|
|
|
55815
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
55816
56538
|
impl From<xberg::PaddleInferenceBackend> for PaddleInferenceBackend {
|
|
55817
56539
|
fn from(val: xberg::PaddleInferenceBackend) -> Self {
|
|
55818
56540
|
match val {
|
|
@@ -55822,7 +56544,6 @@ impl From<xberg::PaddleInferenceBackend> for PaddleInferenceBackend {
|
|
|
55822
56544
|
}
|
|
55823
56545
|
}
|
|
55824
56546
|
|
|
55825
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
55826
56547
|
impl From<xberg::PaddleLanguage> for PaddleLanguage {
|
|
55827
56548
|
fn from(val: xberg::PaddleLanguage) -> Self {
|
|
55828
56549
|
match val {
|
|
@@ -56100,6 +56821,26 @@ impl From<xberg::ProcessingStage> for ProcessingStage {
|
|
|
56100
56821
|
}
|
|
56101
56822
|
}
|
|
56102
56823
|
|
|
56824
|
+
impl From<RedactionOffsetEncoding> for xberg::RedactionOffsetEncoding {
|
|
56825
|
+
fn from(val: RedactionOffsetEncoding) -> Self {
|
|
56826
|
+
match val {
|
|
56827
|
+
RedactionOffsetEncoding::Utf8Bytes => Self::Utf8Bytes,
|
|
56828
|
+
RedactionOffsetEncoding::UnicodeCodePoints => Self::UnicodeCodePoints,
|
|
56829
|
+
RedactionOffsetEncoding::Utf16CodeUnits => Self::Utf16CodeUnits,
|
|
56830
|
+
}
|
|
56831
|
+
}
|
|
56832
|
+
}
|
|
56833
|
+
|
|
56834
|
+
impl From<xberg::RedactionOffsetEncoding> for RedactionOffsetEncoding {
|
|
56835
|
+
fn from(val: xberg::RedactionOffsetEncoding) -> Self {
|
|
56836
|
+
match val {
|
|
56837
|
+
xberg::RedactionOffsetEncoding::Utf8Bytes => Self::Utf8Bytes,
|
|
56838
|
+
xberg::RedactionOffsetEncoding::UnicodeCodePoints => Self::UnicodeCodePoints,
|
|
56839
|
+
xberg::RedactionOffsetEncoding::Utf16CodeUnits => Self::Utf16CodeUnits,
|
|
56840
|
+
}
|
|
56841
|
+
}
|
|
56842
|
+
}
|
|
56843
|
+
|
|
56103
56844
|
impl From<RedactionStrategy> for xberg::RedactionStrategy {
|
|
56104
56845
|
fn from(val: RedactionStrategy) -> Self {
|
|
56105
56846
|
match val {
|
|
@@ -56874,6 +57615,8 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
56874
57615
|
|
|
56875
57616
|
class.define_method("min_image_area", method!(CaptioningConfig::min_image_area, 0))?;
|
|
56876
57617
|
|
|
57618
|
+
class.define_method("alt_text", method!(CaptioningConfig::alt_text, 0))?;
|
|
57619
|
+
|
|
56877
57620
|
let class = module.define_class("CellChange", ruby.class_object())?;
|
|
56878
57621
|
|
|
56879
57622
|
class.define_singleton_method("new", function!(CellChange::new, -1))?;
|
|
@@ -56896,10 +57639,10 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
56896
57639
|
|
|
56897
57640
|
class.define_method("embedding", method!(Chunk::embedding, 0))?;
|
|
56898
57641
|
|
|
56899
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
57642
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
56900
57643
|
class.define_method("sparse_embedding", method!(Chunk::sparse_embedding, 0))?;
|
|
56901
57644
|
|
|
56902
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
57645
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
56903
57646
|
class.define_method("late_interaction", method!(Chunk::late_interaction, 0))?;
|
|
56904
57647
|
|
|
56905
57648
|
class.define_method("metadata", method!(Chunk::metadata, 0))?;
|
|
@@ -57267,6 +58010,8 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
57267
58010
|
|
|
57268
58011
|
class.define_method("skip_images", method!(ConversionOptions::skip_images, 0))?;
|
|
57269
58012
|
|
|
58013
|
+
class.define_method("inline_data_media", method!(ConversionOptions::inline_data_media, 0))?;
|
|
58014
|
+
|
|
57270
58015
|
class.define_method("url_escape_style", method!(ConversionOptions::url_escape_style, 0))?;
|
|
57271
58016
|
|
|
57272
58017
|
class.define_method("link_style", method!(ConversionOptions::link_style, 0))?;
|
|
@@ -58096,6 +58841,20 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
58096
58841
|
|
|
58097
58842
|
class.define_method("revisions", method!(ExcelWorkbook::revisions, 0))?;
|
|
58098
58843
|
|
|
58844
|
+
let class = module.define_class("ExternalRedactionFinding", ruby.class_object())?;
|
|
58845
|
+
|
|
58846
|
+
class.define_singleton_method("new", function!(ExternalRedactionFinding::new, -1))?;
|
|
58847
|
+
|
|
58848
|
+
class.define_method("label", method!(ExternalRedactionFinding::label, 0))?;
|
|
58849
|
+
|
|
58850
|
+
class.define_method("text", method!(ExternalRedactionFinding::text, 0))?;
|
|
58851
|
+
|
|
58852
|
+
class.define_method("start", method!(ExternalRedactionFinding::start, 0))?;
|
|
58853
|
+
|
|
58854
|
+
class.define_method("end", method!(ExternalRedactionFinding::end, 0))?;
|
|
58855
|
+
|
|
58856
|
+
class.define_method("score", method!(ExternalRedactionFinding::score, 0))?;
|
|
58857
|
+
|
|
58099
58858
|
let class = module.define_class("ExtractInput", ruby.class_object())?;
|
|
58100
58859
|
|
|
58101
58860
|
class.define_singleton_method("new", function!(ExtractInput::new, -1))?;
|
|
@@ -59252,42 +60011,42 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
59252
60011
|
|
|
59253
60012
|
let class = module.define_class("LateInteractionMatch", ruby.class_object())?;
|
|
59254
60013
|
|
|
59255
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
60014
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
59256
60015
|
class.define_singleton_method("new", function!(LateInteractionMatch::new, -1))?;
|
|
59257
60016
|
|
|
59258
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
60017
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
59259
60018
|
class.define_method("index", method!(LateInteractionMatch::index, 0))?;
|
|
59260
60019
|
|
|
59261
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
60020
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
59262
60021
|
class.define_method("score", method!(LateInteractionMatch::score, 0))?;
|
|
59263
60022
|
|
|
59264
60023
|
let class = module.define_class("LateInteractionPreset", ruby.class_object())?;
|
|
59265
60024
|
|
|
59266
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
60025
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
59267
60026
|
class.define_singleton_method("new", function!(LateInteractionPreset::new, -1))?;
|
|
59268
60027
|
|
|
59269
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
60028
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
59270
60029
|
class.define_method("name", method!(LateInteractionPreset::name, 0))?;
|
|
59271
60030
|
|
|
59272
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
60031
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
59273
60032
|
class.define_method("model_repo", method!(LateInteractionPreset::model_repo, 0))?;
|
|
59274
60033
|
|
|
59275
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
60034
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
59276
60035
|
class.define_method("model_file", method!(LateInteractionPreset::model_file, 0))?;
|
|
59277
60036
|
|
|
59278
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
60037
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
59279
60038
|
class.define_method("additional_files", method!(LateInteractionPreset::additional_files, 0))?;
|
|
59280
60039
|
|
|
59281
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
60040
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
59282
60041
|
class.define_method("max_length", method!(LateInteractionPreset::max_length, 0))?;
|
|
59283
60042
|
|
|
59284
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
60043
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
59285
60044
|
class.define_method("query_max_length", method!(LateInteractionPreset::query_max_length, 0))?;
|
|
59286
60045
|
|
|
59287
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
60046
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
59288
60047
|
class.define_method("dim", method!(LateInteractionPreset::dim, 0))?;
|
|
59289
60048
|
|
|
59290
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
60049
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
59291
60050
|
class.define_method("description", method!(LateInteractionPreset::description, 0))?;
|
|
59292
60051
|
|
|
59293
60052
|
let class = module.define_class("LayoutDetection", ruby.class_object())?;
|
|
@@ -59573,36 +60332,31 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
59573
60332
|
|
|
59574
60333
|
let class = module.define_class("ModelPaths", ruby.class_object())?;
|
|
59575
60334
|
|
|
59576
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
59577
60335
|
class.define_singleton_method("new", function!(ModelPaths::new, -1))?;
|
|
59578
60336
|
|
|
59579
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
59580
60337
|
class.define_method("det_model", method!(ModelPaths::det_model, 0))?;
|
|
59581
60338
|
|
|
59582
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
59583
60339
|
class.define_method("cls_model", method!(ModelPaths::cls_model, 0))?;
|
|
59584
60340
|
|
|
59585
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
59586
60341
|
class.define_method("rec_model", method!(ModelPaths::rec_model, 0))?;
|
|
59587
60342
|
|
|
59588
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
59589
60343
|
class.define_method("dict_file", method!(ModelPaths::dict_file, 0))?;
|
|
59590
60344
|
|
|
59591
60345
|
let class = module.define_class("MultiVectorEmbedding", ruby.class_object())?;
|
|
59592
60346
|
|
|
59593
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
60347
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
59594
60348
|
class.define_singleton_method("new", function!(MultiVectorEmbedding::new, -1))?;
|
|
59595
60349
|
|
|
59596
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
60350
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
59597
60351
|
class.define_method("num_tokens", method!(MultiVectorEmbedding::num_tokens, 0))?;
|
|
59598
60352
|
|
|
59599
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
60353
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
59600
60354
|
class.define_method("dim", method!(MultiVectorEmbedding::dim, 0))?;
|
|
59601
60355
|
|
|
59602
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
60356
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
59603
60357
|
class.define_method("data", method!(MultiVectorEmbedding::data, 0))?;
|
|
59604
60358
|
|
|
59605
|
-
#[cfg(feature = "late-interaction-presets")]
|
|
60359
|
+
#[cfg(any(feature = "late-interaction-presets", not(feature = "late-interaction-presets")))]
|
|
59606
60360
|
class.define_method("is_well_formed", method!(MultiVectorEmbedding::is_well_formed, 0))?;
|
|
59607
60361
|
|
|
59608
60362
|
let class = module.define_class("MultidocInput", ruby.class_object())?;
|
|
@@ -59690,6 +60444,8 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
59690
60444
|
|
|
59691
60445
|
class.define_method("paddle_ocr_config", method!(OcrConfig::paddle_ocr_config, 0))?;
|
|
59692
60446
|
|
|
60447
|
+
class.define_method("paddle_ocr_settings", method!(OcrConfig::paddle_ocr_settings, 0))?;
|
|
60448
|
+
|
|
59693
60449
|
class.define_method("backend_options", method!(OcrConfig::backend_options, 0))?;
|
|
59694
60450
|
|
|
59695
60451
|
class.define_method("element_config", method!(OcrConfig::element_config, 0))?;
|
|
@@ -59802,6 +60558,8 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
59802
60558
|
|
|
59803
60559
|
class.define_method("paddle_ocr_config", method!(OcrPipelineStage::paddle_ocr_config, 0))?;
|
|
59804
60560
|
|
|
60561
|
+
class.define_method("paddle_ocr_settings", method!(OcrPipelineStage::paddle_ocr_settings, 0))?;
|
|
60562
|
+
|
|
59805
60563
|
class.define_method("vlm_config", method!(OcrPipelineStage::vlm_config, 0))?;
|
|
59806
60564
|
|
|
59807
60565
|
class.define_method("backend_options", method!(OcrPipelineStage::backend_options, 0))?;
|
|
@@ -59987,100 +60745,73 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
59987
60745
|
|
|
59988
60746
|
let class = module.define_class("PaddleOcrConfig", ruby.class_object())?;
|
|
59989
60747
|
|
|
59990
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
59991
60748
|
class.define_singleton_method("new", function!(PaddleOcrConfig::new, -1))?;
|
|
59992
60749
|
|
|
59993
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
59994
60750
|
class.define_method("language", method!(PaddleOcrConfig::language, 0))?;
|
|
59995
60751
|
|
|
59996
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
59997
60752
|
class.define_method("cache_dir", method!(PaddleOcrConfig::cache_dir, 0))?;
|
|
59998
60753
|
|
|
59999
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
60000
60754
|
class.define_method("use_angle_cls", method!(PaddleOcrConfig::use_angle_cls, 0))?;
|
|
60001
60755
|
|
|
60002
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
60003
60756
|
class.define_method(
|
|
60004
60757
|
"enable_table_detection",
|
|
60005
60758
|
method!(PaddleOcrConfig::enable_table_detection, 0),
|
|
60006
60759
|
)?;
|
|
60007
60760
|
|
|
60008
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
60009
60761
|
class.define_method("det_db_thresh", method!(PaddleOcrConfig::det_db_thresh, 0))?;
|
|
60010
60762
|
|
|
60011
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
60012
60763
|
class.define_method("det_db_box_thresh", method!(PaddleOcrConfig::det_db_box_thresh, 0))?;
|
|
60013
60764
|
|
|
60014
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
60015
60765
|
class.define_method("det_db_unclip_ratio", method!(PaddleOcrConfig::det_db_unclip_ratio, 0))?;
|
|
60016
60766
|
|
|
60017
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
60018
60767
|
class.define_method("det_limit_side_len", method!(PaddleOcrConfig::det_limit_side_len, 0))?;
|
|
60019
60768
|
|
|
60020
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
60021
60769
|
class.define_method("rec_batch_num", method!(PaddleOcrConfig::rec_batch_num, 0))?;
|
|
60022
60770
|
|
|
60023
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
60024
60771
|
class.define_method("padding", method!(PaddleOcrConfig::padding, 0))?;
|
|
60025
60772
|
|
|
60026
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
60027
60773
|
class.define_method("drop_score", method!(PaddleOcrConfig::drop_score, 0))?;
|
|
60028
60774
|
|
|
60029
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
60030
60775
|
class.define_method("model_tier", method!(PaddleOcrConfig::model_tier, 0))?;
|
|
60031
60776
|
|
|
60032
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
60033
60777
|
class.define_method("model_version", method!(PaddleOcrConfig::model_version, 0))?;
|
|
60034
60778
|
|
|
60035
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
60036
60779
|
class.define_method("inference_backend", method!(PaddleOcrConfig::inference_backend, 0))?;
|
|
60037
60780
|
|
|
60038
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
60039
60781
|
class.define_method("with_cache_dir", method!(PaddleOcrConfig::with_cache_dir, 1))?;
|
|
60040
60782
|
|
|
60041
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
60042
60783
|
class.define_method(
|
|
60043
60784
|
"with_table_detection",
|
|
60044
60785
|
method!(PaddleOcrConfig::with_table_detection, 1),
|
|
60045
60786
|
)?;
|
|
60046
60787
|
|
|
60047
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
60048
60788
|
class.define_method("with_angle_cls", method!(PaddleOcrConfig::with_angle_cls, 1))?;
|
|
60049
60789
|
|
|
60050
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
60051
60790
|
class.define_method("with_det_db_thresh", method!(PaddleOcrConfig::with_det_db_thresh, 1))?;
|
|
60052
60791
|
|
|
60053
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
60054
60792
|
class.define_method(
|
|
60055
60793
|
"with_det_db_box_thresh",
|
|
60056
60794
|
method!(PaddleOcrConfig::with_det_db_box_thresh, 1),
|
|
60057
60795
|
)?;
|
|
60058
60796
|
|
|
60059
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
60060
60797
|
class.define_method(
|
|
60061
60798
|
"with_det_db_unclip_ratio",
|
|
60062
60799
|
method!(PaddleOcrConfig::with_det_db_unclip_ratio, 1),
|
|
60063
60800
|
)?;
|
|
60064
60801
|
|
|
60065
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
60066
60802
|
class.define_method(
|
|
60067
60803
|
"with_det_limit_side_len",
|
|
60068
60804
|
method!(PaddleOcrConfig::with_det_limit_side_len, 1),
|
|
60069
60805
|
)?;
|
|
60070
60806
|
|
|
60071
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
60072
60807
|
class.define_method("with_rec_batch_num", method!(PaddleOcrConfig::with_rec_batch_num, 1))?;
|
|
60073
60808
|
|
|
60074
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
60075
60809
|
class.define_method("with_drop_score", method!(PaddleOcrConfig::with_drop_score, 1))?;
|
|
60076
60810
|
|
|
60077
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
60078
60811
|
class.define_method("with_padding", method!(PaddleOcrConfig::with_padding, 1))?;
|
|
60079
60812
|
|
|
60080
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
60081
60813
|
class.define_method("with_model_tier", method!(PaddleOcrConfig::with_model_tier, 1))?;
|
|
60082
60814
|
|
|
60083
|
-
#[cfg(feature = "paddle-ocr-types")]
|
|
60084
60815
|
class.define_method("with_model_version", method!(PaddleOcrConfig::with_model_version, 1))?;
|
|
60085
60816
|
|
|
60086
60817
|
let class = module.define_class("PaddleOcrVlBackendOptions", ruby.class_object())?;
|
|
@@ -60755,6 +61486,17 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
60755
61486
|
|
|
60756
61487
|
class.define_method("custom_patterns", method!(RedactionConfig::custom_patterns, 0))?;
|
|
60757
61488
|
|
|
61489
|
+
class.define_method("findings", method!(RedactionConfig::findings, 0))?;
|
|
61490
|
+
|
|
61491
|
+
class.define_method("min_score", method!(RedactionConfig::min_score, 0))?;
|
|
61492
|
+
|
|
61493
|
+
class.define_method("findings_path", method!(RedactionConfig::findings_path, 0))?;
|
|
61494
|
+
|
|
61495
|
+
class.define_method(
|
|
61496
|
+
"findings_offset_encoding",
|
|
61497
|
+
method!(RedactionConfig::findings_offset_encoding, 0),
|
|
61498
|
+
)?;
|
|
61499
|
+
|
|
60758
61500
|
class.define_method("validate", method!(RedactionConfig::validate, 0))?;
|
|
60759
61501
|
|
|
60760
61502
|
let class = module.define_class("RedactionFinding", ruby.class_object())?;
|
|
@@ -60821,16 +61563,28 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
60821
61563
|
|
|
60822
61564
|
let class = module.define_class("RerankedDocument", ruby.class_object())?;
|
|
60823
61565
|
|
|
60824
|
-
#[cfg(any(
|
|
61566
|
+
#[cfg(any(
|
|
61567
|
+
any(feature = "reranker-presets", feature = "reranker"),
|
|
61568
|
+
not(feature = "reranker-presets")
|
|
61569
|
+
))]
|
|
60825
61570
|
class.define_singleton_method("new", function!(RerankedDocument::new, -1))?;
|
|
60826
61571
|
|
|
60827
|
-
#[cfg(any(
|
|
61572
|
+
#[cfg(any(
|
|
61573
|
+
any(feature = "reranker-presets", feature = "reranker"),
|
|
61574
|
+
not(feature = "reranker-presets")
|
|
61575
|
+
))]
|
|
60828
61576
|
class.define_method("index", method!(RerankedDocument::index, 0))?;
|
|
60829
61577
|
|
|
60830
|
-
#[cfg(any(
|
|
61578
|
+
#[cfg(any(
|
|
61579
|
+
any(feature = "reranker-presets", feature = "reranker"),
|
|
61580
|
+
not(feature = "reranker-presets")
|
|
61581
|
+
))]
|
|
60831
61582
|
class.define_method("score", method!(RerankedDocument::score, 0))?;
|
|
60832
61583
|
|
|
60833
|
-
#[cfg(any(
|
|
61584
|
+
#[cfg(any(
|
|
61585
|
+
any(feature = "reranker-presets", feature = "reranker"),
|
|
61586
|
+
not(feature = "reranker-presets")
|
|
61587
|
+
))]
|
|
60834
61588
|
class.define_method("document", method!(RerankedDocument::document, 0))?;
|
|
60835
61589
|
|
|
60836
61590
|
let class = module.define_class("RerankerConfig", ruby.class_object())?;
|
|
@@ -60987,13 +61741,13 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
60987
61741
|
|
|
60988
61742
|
let class = module.define_class("SparseEmbedding", ruby.class_object())?;
|
|
60989
61743
|
|
|
60990
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
61744
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
60991
61745
|
class.define_singleton_method("new", function!(SparseEmbedding::new, -1))?;
|
|
60992
61746
|
|
|
60993
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
61747
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
60994
61748
|
class.define_method("indices", method!(SparseEmbedding::indices, 0))?;
|
|
60995
61749
|
|
|
60996
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
61750
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
60997
61751
|
class.define_method("values", method!(SparseEmbedding::values, 0))?;
|
|
60998
61752
|
|
|
60999
61753
|
let class = module.define_class("SparseEmbeddingConfig", ruby.class_object())?;
|
|
@@ -61022,25 +61776,25 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
61022
61776
|
|
|
61023
61777
|
let class = module.define_class("SparseEmbeddingPreset", ruby.class_object())?;
|
|
61024
61778
|
|
|
61025
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
61779
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
61026
61780
|
class.define_singleton_method("new", function!(SparseEmbeddingPreset::new, -1))?;
|
|
61027
61781
|
|
|
61028
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
61782
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
61029
61783
|
class.define_method("name", method!(SparseEmbeddingPreset::name, 0))?;
|
|
61030
61784
|
|
|
61031
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
61785
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
61032
61786
|
class.define_method("model_repo", method!(SparseEmbeddingPreset::model_repo, 0))?;
|
|
61033
61787
|
|
|
61034
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
61788
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
61035
61789
|
class.define_method("model_file", method!(SparseEmbeddingPreset::model_file, 0))?;
|
|
61036
61790
|
|
|
61037
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
61791
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
61038
61792
|
class.define_method("additional_files", method!(SparseEmbeddingPreset::additional_files, 0))?;
|
|
61039
61793
|
|
|
61040
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
61794
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
61041
61795
|
class.define_method("max_length", method!(SparseEmbeddingPreset::max_length, 0))?;
|
|
61042
61796
|
|
|
61043
|
-
#[cfg(feature = "sparse-embedding-presets")]
|
|
61797
|
+
#[cfg(any(feature = "sparse-embedding-presets", not(feature = "sparse-embedding-presets")))]
|
|
61044
61798
|
class.define_method("description", method!(SparseEmbeddingPreset::description, 0))?;
|
|
61045
61799
|
|
|
61046
61800
|
let class = module.define_class("SsrfPolicy", ruby.class_object())?;
|
|
@@ -61643,6 +62397,12 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
61643
62397
|
|
|
61644
62398
|
module.define_module_function("extract_batch", function!(extract_batch_async, -1))?;
|
|
61645
62399
|
|
|
62400
|
+
#[cfg(feature = "redaction")]
|
|
62401
|
+
module.define_module_function(
|
|
62402
|
+
"extract_with_external_redaction",
|
|
62403
|
+
function!(extract_with_external_redaction_async, -1),
|
|
62404
|
+
)?;
|
|
62405
|
+
|
|
61646
62406
|
#[cfg(feature = "markdown-footnotes")]
|
|
61647
62407
|
module.define_module_function("find_unmarked_claims", function!(find_unmarked_claims, 1))?;
|
|
61648
62408
|
|
|
@@ -61702,6 +62462,9 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
61702
62462
|
#[cfg(feature = "pdf")]
|
|
61703
62463
|
module.define_module_function("pdf_page_count", function!(pdf_page_count, -1))?;
|
|
61704
62464
|
|
|
62465
|
+
#[cfg(feature = "redaction")]
|
|
62466
|
+
module.define_module_function("redact_external", function!(redact_external_async, -1))?;
|
|
62467
|
+
|
|
61705
62468
|
#[cfg(feature = "markdown-footnotes")]
|
|
61706
62469
|
module.define_module_function("verify_excerpt", function!(verify_excerpt, 2))?;
|
|
61707
62470
|
|