xberg 1.2.5 → 1.2.7

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.
@@ -1,5 +1,5 @@
1
1
  // This file is auto-generated by alef. DO NOT EDIT.
2
- // alef:hash:88d2135df85c592f02269aceb1caa207be8b22378d55c8bd717ffaa3f5359d86
2
+ // alef:hash:f1a359a24f246b68ebe2717a124008b9358925ba194cc8cb713eb90df7dc417d
3
3
  // Re-generate with: alef generate
4
4
  #![allow(dead_code, unused_imports, unused_variables)]
5
5
  #![allow(
@@ -3484,6 +3484,7 @@ impl CodeMetadata {
3484
3484
  #[magnus::wrap(class = "Xberg::ConcurrencyConfig")]
3485
3485
  pub struct ConcurrencyConfig {
3486
3486
  max_threads: Option<usize>,
3487
+ max_concurrent_ocr: Option<usize>,
3487
3488
  }
3488
3489
 
3489
3490
  unsafe impl IntoValueFromNative for ConcurrencyConfig {}
@@ -3544,12 +3545,25 @@ impl ConcurrencyConfig {
3544
3545
  })?),
3545
3546
  None => None,
3546
3547
  },
3548
+ max_concurrent_ocr: match kwargs.get(ruby.to_symbol("max_concurrent_ocr")).filter(|v| !v.is_nil()) {
3549
+ Some(v) => Some(usize::try_convert(v).map_err(|e| {
3550
+ magnus::Error::new(
3551
+ unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
3552
+ format!("invalid value for `max_concurrent_ocr`: {}", e),
3553
+ )
3554
+ })?),
3555
+ None => None,
3556
+ },
3547
3557
  })
3548
3558
  }
3549
3559
 
3550
3560
  fn max_threads(&self) -> Option<usize> {
3551
3561
  self.max_threads
3552
3562
  }
3563
+
3564
+ fn max_concurrent_ocr(&self) -> Option<usize> {
3565
+ self.max_concurrent_ocr
3566
+ }
3553
3567
  }
3554
3568
 
3555
3569
  #[derive(Clone, Debug, serde::Serialize)]
@@ -6006,8 +6020,12 @@ impl DbfMetadata {
6006
6020
  #[magnus::wrap(class = "Xberg::DeepseekOcrBackendOptions")]
6007
6021
  pub struct DeepseekOcrBackendOptions {
6008
6022
  model_path: Option<String>,
6023
+ model_id: Option<String>,
6024
+ hf_revision: Option<String>,
6025
+ cache_dir: Option<String>,
6009
6026
  device: Option<CandleDevicePreference>,
6010
6027
  version: Option<u32>,
6028
+ dtype: Option<CandleDeepseekOcrDtype>,
6011
6029
  }
6012
6030
 
6013
6031
  #[cfg(feature = "candle-ocr")]
@@ -6074,6 +6092,33 @@ impl DeepseekOcrBackendOptions {
6074
6092
  })?),
6075
6093
  None => None,
6076
6094
  },
6095
+ model_id: match kwargs.get(ruby.to_symbol("model_id")).filter(|v| !v.is_nil()) {
6096
+ Some(v) => Some(String::try_convert(v).map_err(|e| {
6097
+ magnus::Error::new(
6098
+ unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
6099
+ format!("invalid value for `model_id`: {}", e),
6100
+ )
6101
+ })?),
6102
+ None => None,
6103
+ },
6104
+ hf_revision: match kwargs.get(ruby.to_symbol("hf_revision")).filter(|v| !v.is_nil()) {
6105
+ Some(v) => Some(String::try_convert(v).map_err(|e| {
6106
+ magnus::Error::new(
6107
+ unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
6108
+ format!("invalid value for `hf_revision`: {}", e),
6109
+ )
6110
+ })?),
6111
+ None => None,
6112
+ },
6113
+ cache_dir: match kwargs.get(ruby.to_symbol("cache_dir")).filter(|v| !v.is_nil()) {
6114
+ Some(v) => Some(String::try_convert(v).map_err(|e| {
6115
+ magnus::Error::new(
6116
+ unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
6117
+ format!("invalid value for `cache_dir`: {}", e),
6118
+ )
6119
+ })?),
6120
+ None => None,
6121
+ },
6077
6122
  device: match kwargs.get(ruby.to_symbol("device")).filter(|v| !v.is_nil()) {
6078
6123
  Some(v) => Some(CandleDevicePreference::try_convert(v).map_err(|e| {
6079
6124
  magnus::Error::new(
@@ -6092,6 +6137,15 @@ impl DeepseekOcrBackendOptions {
6092
6137
  })?),
6093
6138
  None => None,
6094
6139
  },
6140
+ dtype: match kwargs.get(ruby.to_symbol("dtype")).filter(|v| !v.is_nil()) {
6141
+ Some(v) => Some(CandleDeepseekOcrDtype::try_convert(v).map_err(|e| {
6142
+ magnus::Error::new(
6143
+ unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
6144
+ format!("invalid value for `dtype`: {}", e),
6145
+ )
6146
+ })?),
6147
+ None => None,
6148
+ },
6095
6149
  })
6096
6150
  }
6097
6151
 
@@ -6099,6 +6153,18 @@ impl DeepseekOcrBackendOptions {
6099
6153
  self.model_path.clone()
6100
6154
  }
6101
6155
 
6156
+ fn model_id(&self) -> Option<String> {
6157
+ self.model_id.clone()
6158
+ }
6159
+
6160
+ fn hf_revision(&self) -> Option<String> {
6161
+ self.hf_revision.clone()
6162
+ }
6163
+
6164
+ fn cache_dir(&self) -> Option<String> {
6165
+ self.cache_dir.clone()
6166
+ }
6167
+
6102
6168
  fn device(&self) -> Option<CandleDevicePreference> {
6103
6169
  self.device.clone()
6104
6170
  }
@@ -6106,6 +6172,10 @@ impl DeepseekOcrBackendOptions {
6106
6172
  fn version(&self) -> Option<u32> {
6107
6173
  self.version
6108
6174
  }
6175
+
6176
+ fn dtype(&self) -> Option<CandleDeepseekOcrDtype> {
6177
+ self.dtype.clone()
6178
+ }
6109
6179
  }
6110
6180
 
6111
6181
  #[cfg(feature = "api")]
@@ -12691,6 +12761,202 @@ impl ExtractionConfig {
12691
12761
  core_self.needs_image_data()
12692
12762
  }
12693
12763
 
12764
+ fn runs_ocr_on_embedded_images(&self) -> bool {
12765
+ #[allow(clippy::needless_update)]
12766
+ let core_self = xberg::ExtractionConfig {
12767
+ mime_detection_policy: self.mime_detection_policy.clone().into(),
12768
+
12769
+ use_cache: self.use_cache,
12770
+
12771
+ enable_quality_processing: self.enable_quality_processing,
12772
+
12773
+ ocr: self.ocr.clone().map(Into::into),
12774
+
12775
+ force_ocr: self.force_ocr,
12776
+
12777
+ ocr_strategy: self.ocr_strategy.clone().into(),
12778
+
12779
+ force_ocr_pages: self.force_ocr_pages.clone(),
12780
+
12781
+ disable_ocr: self.disable_ocr,
12782
+
12783
+ chunking: self.chunking.clone().map(Into::into),
12784
+
12785
+ content_filter: self.content_filter.clone().map(Into::into),
12786
+
12787
+ images: self.images.clone().map(Into::into),
12788
+
12789
+ token_reduction: self.token_reduction.clone().map(Into::into),
12790
+
12791
+ language_detection: self.language_detection.clone().map(Into::into),
12792
+
12793
+ pages: self.pages.clone().map(Into::into),
12794
+
12795
+ postprocessor: self.postprocessor.clone().map(Into::into),
12796
+
12797
+ extraction_timeout_secs: self.extraction_timeout_secs,
12798
+
12799
+ max_concurrent_extractions: self.max_concurrent_extractions,
12800
+
12801
+ result_format: self.result_format.clone().into(),
12802
+
12803
+ security_limits: self.security_limits.clone().map(Into::into),
12804
+
12805
+ max_embedded_file_bytes: self.max_embedded_file_bytes,
12806
+
12807
+ output_format: self.output_format.clone().into(),
12808
+
12809
+ escape_markdown: self.escape_markdown,
12810
+
12811
+ table_anchors: self.table_anchors,
12812
+
12813
+ jupyter_cell_rendering: self.jupyter_cell_rendering.clone().into(),
12814
+
12815
+ apply_notebook_cell_tags: self.apply_notebook_cell_tags,
12816
+
12817
+ use_layout_for_markdown: self.use_layout_for_markdown,
12818
+
12819
+ include_document_structure: self.include_document_structure,
12820
+
12821
+ acceleration: self.acceleration.clone().map(Into::into),
12822
+
12823
+ cache_namespace: self.cache_namespace.clone(),
12824
+
12825
+ cache_ttl_secs: self.cache_ttl_secs,
12826
+
12827
+ email: self.email.clone().map(Into::into),
12828
+
12829
+ csv: self.csv.clone().map(Into::into),
12830
+
12831
+ geojson: self.geojson.clone().map(Into::into),
12832
+
12833
+ concurrency: self.concurrency.clone().map(Into::into),
12834
+
12835
+ url: self.url.clone().into(),
12836
+
12837
+ max_archive_depth: self.max_archive_depth,
12838
+
12839
+ structured_extraction: self.structured_extraction.clone().map(Into::into),
12840
+
12841
+ ner: self.ner.clone().map(Into::into),
12842
+
12843
+ redaction: self.redaction.clone().map(Into::into),
12844
+
12845
+ summarization: self.summarization.clone().map(Into::into),
12846
+
12847
+ translation: self.translation.clone().map(Into::into),
12848
+
12849
+ page_classification: self.page_classification.clone().map(Into::into),
12850
+
12851
+ chunk_classification: self.chunk_classification.clone().map(Into::into),
12852
+
12853
+ captioning: self.captioning.clone().map(Into::into),
12854
+
12855
+ qr_codes: self.qr_codes,
12856
+
12857
+ ..Default::default()
12858
+ };
12859
+ core_self.runs_ocr_on_embedded_images()
12860
+ }
12861
+
12862
+ fn wants_own_bytes_in_result(&self) -> bool {
12863
+ #[allow(clippy::needless_update)]
12864
+ let core_self = xberg::ExtractionConfig {
12865
+ mime_detection_policy: self.mime_detection_policy.clone().into(),
12866
+
12867
+ use_cache: self.use_cache,
12868
+
12869
+ enable_quality_processing: self.enable_quality_processing,
12870
+
12871
+ ocr: self.ocr.clone().map(Into::into),
12872
+
12873
+ force_ocr: self.force_ocr,
12874
+
12875
+ ocr_strategy: self.ocr_strategy.clone().into(),
12876
+
12877
+ force_ocr_pages: self.force_ocr_pages.clone(),
12878
+
12879
+ disable_ocr: self.disable_ocr,
12880
+
12881
+ chunking: self.chunking.clone().map(Into::into),
12882
+
12883
+ content_filter: self.content_filter.clone().map(Into::into),
12884
+
12885
+ images: self.images.clone().map(Into::into),
12886
+
12887
+ token_reduction: self.token_reduction.clone().map(Into::into),
12888
+
12889
+ language_detection: self.language_detection.clone().map(Into::into),
12890
+
12891
+ pages: self.pages.clone().map(Into::into),
12892
+
12893
+ postprocessor: self.postprocessor.clone().map(Into::into),
12894
+
12895
+ extraction_timeout_secs: self.extraction_timeout_secs,
12896
+
12897
+ max_concurrent_extractions: self.max_concurrent_extractions,
12898
+
12899
+ result_format: self.result_format.clone().into(),
12900
+
12901
+ security_limits: self.security_limits.clone().map(Into::into),
12902
+
12903
+ max_embedded_file_bytes: self.max_embedded_file_bytes,
12904
+
12905
+ output_format: self.output_format.clone().into(),
12906
+
12907
+ escape_markdown: self.escape_markdown,
12908
+
12909
+ table_anchors: self.table_anchors,
12910
+
12911
+ jupyter_cell_rendering: self.jupyter_cell_rendering.clone().into(),
12912
+
12913
+ apply_notebook_cell_tags: self.apply_notebook_cell_tags,
12914
+
12915
+ use_layout_for_markdown: self.use_layout_for_markdown,
12916
+
12917
+ include_document_structure: self.include_document_structure,
12918
+
12919
+ acceleration: self.acceleration.clone().map(Into::into),
12920
+
12921
+ cache_namespace: self.cache_namespace.clone(),
12922
+
12923
+ cache_ttl_secs: self.cache_ttl_secs,
12924
+
12925
+ email: self.email.clone().map(Into::into),
12926
+
12927
+ csv: self.csv.clone().map(Into::into),
12928
+
12929
+ geojson: self.geojson.clone().map(Into::into),
12930
+
12931
+ concurrency: self.concurrency.clone().map(Into::into),
12932
+
12933
+ url: self.url.clone().into(),
12934
+
12935
+ max_archive_depth: self.max_archive_depth,
12936
+
12937
+ structured_extraction: self.structured_extraction.clone().map(Into::into),
12938
+
12939
+ ner: self.ner.clone().map(Into::into),
12940
+
12941
+ redaction: self.redaction.clone().map(Into::into),
12942
+
12943
+ summarization: self.summarization.clone().map(Into::into),
12944
+
12945
+ translation: self.translation.clone().map(Into::into),
12946
+
12947
+ page_classification: self.page_classification.clone().map(Into::into),
12948
+
12949
+ chunk_classification: self.chunk_classification.clone().map(Into::into),
12950
+
12951
+ captioning: self.captioning.clone().map(Into::into),
12952
+
12953
+ qr_codes: self.qr_codes,
12954
+
12955
+ ..Default::default()
12956
+ };
12957
+ core_self.wants_own_bytes_in_result()
12958
+ }
12959
+
12694
12960
  fn needs_image_processing(&self) -> bool {
12695
12961
  #[allow(clippy::needless_update)]
12696
12962
  let core_self = xberg::ExtractionConfig {
@@ -22794,6 +23060,8 @@ pub struct OcrQualityThresholds {
22794
23060
  min_undecodable_ratio: f64,
22795
23061
  enable_provenance_ocr_routing: bool,
22796
23062
  min_provenance_fallback_ratio: f64,
23063
+ enable_plausibility_ocr_routing: bool,
23064
+ min_reliable_language_chunk_ratio: f64,
22797
23065
  }
22798
23066
 
22799
23067
  unsafe impl IntoValueFromNative for OcrQualityThresholds {}
@@ -23065,6 +23333,24 @@ impl OcrQualityThresholds {
23065
23333
  })?,
23066
23334
  None => 0.5,
23067
23335
  },
23336
+ enable_plausibility_ocr_routing: match kwargs.get(ruby.to_symbol("enable_plausibility_ocr_routing")) {
23337
+ Some(v) => bool::try_convert(v).map_err(|e| {
23338
+ magnus::Error::new(
23339
+ unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
23340
+ format!("invalid value for `enable_plausibility_ocr_routing`: {}", e),
23341
+ )
23342
+ })?,
23343
+ None => true,
23344
+ },
23345
+ min_reliable_language_chunk_ratio: match kwargs.get(ruby.to_symbol("min_reliable_language_chunk_ratio")) {
23346
+ Some(v) => f64::try_convert(v).map_err(|e| {
23347
+ magnus::Error::new(
23348
+ unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
23349
+ format!("invalid value for `min_reliable_language_chunk_ratio`: {}", e),
23350
+ )
23351
+ })?,
23352
+ None => 0.1,
23353
+ },
23068
23354
  })
23069
23355
  }
23070
23356
 
@@ -23163,6 +23449,14 @@ impl OcrQualityThresholds {
23163
23449
  fn min_provenance_fallback_ratio(&self) -> f64 {
23164
23450
  self.min_provenance_fallback_ratio
23165
23451
  }
23452
+
23453
+ fn enable_plausibility_ocr_routing(&self) -> bool {
23454
+ self.enable_plausibility_ocr_routing
23455
+ }
23456
+
23457
+ fn min_reliable_language_chunk_ratio(&self) -> f64 {
23458
+ self.min_reliable_language_chunk_ratio
23459
+ }
23166
23460
  }
23167
23461
 
23168
23462
  #[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
@@ -26652,6 +26946,8 @@ pub struct PdfMetadata {
26652
26946
  page_count: Option<u32>,
26653
26947
  scanned_confidence: Option<f32>,
26654
26948
  scanned_pages: Option<Vec<u32>>,
26949
+ fabricated_text_pages: Option<Vec<u32>>,
26950
+ implausible_text_pages: Option<Vec<u32>>,
26655
26951
  layout_gated_pages: Option<Vec<u32>>,
26656
26952
  layout_gate_reasons: Option<Vec<String>>,
26657
26953
  }
@@ -26774,6 +27070,30 @@ impl PdfMetadata {
26774
27070
  })?),
26775
27071
  None => None,
26776
27072
  },
27073
+ fabricated_text_pages: match kwargs
27074
+ .get(ruby.to_symbol("fabricated_text_pages"))
27075
+ .filter(|v| !v.is_nil())
27076
+ {
27077
+ Some(v) => Some(<Vec<u32>>::try_convert(v).map_err(|e| {
27078
+ magnus::Error::new(
27079
+ unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
27080
+ format!("invalid value for `fabricated_text_pages`: {}", e),
27081
+ )
27082
+ })?),
27083
+ None => None,
27084
+ },
27085
+ implausible_text_pages: match kwargs
27086
+ .get(ruby.to_symbol("implausible_text_pages"))
27087
+ .filter(|v| !v.is_nil())
27088
+ {
27089
+ Some(v) => Some(<Vec<u32>>::try_convert(v).map_err(|e| {
27090
+ magnus::Error::new(
27091
+ unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
27092
+ format!("invalid value for `implausible_text_pages`: {}", e),
27093
+ )
27094
+ })?),
27095
+ None => None,
27096
+ },
26777
27097
  layout_gated_pages: match kwargs.get(ruby.to_symbol("layout_gated_pages")).filter(|v| !v.is_nil()) {
26778
27098
  Some(v) => Some(<Vec<u32>>::try_convert(v).map_err(|e| {
26779
27099
  magnus::Error::new(
@@ -26830,6 +27150,14 @@ impl PdfMetadata {
26830
27150
  self.scanned_pages.clone()
26831
27151
  }
26832
27152
 
27153
+ fn fabricated_text_pages(&self) -> Option<Vec<u32>> {
27154
+ self.fabricated_text_pages.clone()
27155
+ }
27156
+
27157
+ fn implausible_text_pages(&self) -> Option<Vec<u32>> {
27158
+ self.implausible_text_pages.clone()
27159
+ }
27160
+
26833
27161
  fn layout_gated_pages(&self) -> Option<Vec<u32>> {
26834
27162
  self.layout_gated_pages.clone()
26835
27163
  }
@@ -35309,7 +35637,8 @@ impl magnus::IntoValue for AnnotationKind {
35309
35637
 
35310
35638
  impl magnus::TryConvert for AnnotationKind {
35311
35639
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
35312
- // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
35640
+ // Generated Data variants carry native DTOs, not JSON-compatible display strings.
35641
+ let class_name: Option<String> = val.class().funcall("name", ())?; // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
35313
35642
  // For unit enums or when passed as a string, fall back to string-based conversion.
35314
35643
  let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
35315
35644
  s
@@ -35341,9 +35670,10 @@ impl magnus::TryConvert for AnnotationKind {
35341
35670
 
35342
35671
  unsafe impl IntoValueFromNative for AnnotationKind {}
35343
35672
  unsafe impl TryConvertOwned for AnnotationKind {}
35673
+
35344
35674
  impl AnnotationKind {}
35345
35675
 
35346
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
35676
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
35347
35677
  #[serde(rename_all = "snake_case")]
35348
35678
  pub enum AssetCategory {
35349
35679
  Document,
@@ -35384,7 +35714,14 @@ impl magnus::IntoValue for AssetCategory {
35384
35714
 
35385
35715
  impl magnus::TryConvert for AssetCategory {
35386
35716
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
35387
- let s: String = magnus::TryConvert::try_convert(val)?;
35717
+ // IntoValue emits Symbols, including when this enum is a Hash key.
35718
+ // Accept that exact representation as well as String inputs; do not
35719
+ // coerce arbitrary objects through to_s.
35720
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
35721
+ symbol.name()?.into_owned()
35722
+ } else {
35723
+ magnus::TryConvert::try_convert(val)?
35724
+ };
35388
35725
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
35389
35726
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
35390
35727
  // existing consumer code written in any of those styles keep working.
@@ -35441,7 +35778,8 @@ impl magnus::IntoValue for AuthConfig {
35441
35778
 
35442
35779
  impl magnus::TryConvert for AuthConfig {
35443
35780
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
35444
- // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
35781
+ // Generated Data variants carry native DTOs, not JSON-compatible display strings.
35782
+ let class_name: Option<String> = val.class().funcall("name", ())?; // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
35445
35783
  // For unit enums or when passed as a string, fall back to string-based conversion.
35446
35784
  let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
35447
35785
  s
@@ -35473,9 +35811,10 @@ impl magnus::TryConvert for AuthConfig {
35473
35811
 
35474
35812
  unsafe impl IntoValueFromNative for AuthConfig {}
35475
35813
  unsafe impl TryConvertOwned for AuthConfig {}
35814
+
35476
35815
  impl AuthConfig {}
35477
35816
 
35478
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
35817
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
35479
35818
  #[serde(rename_all = "snake_case")]
35480
35819
  pub enum BlockType {
35481
35820
  Paragraph,
@@ -35528,7 +35867,14 @@ impl magnus::IntoValue for BlockType {
35528
35867
 
35529
35868
  impl magnus::TryConvert for BlockType {
35530
35869
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
35531
- let s: String = magnus::TryConvert::try_convert(val)?;
35870
+ // IntoValue emits Symbols, including when this enum is a Hash key.
35871
+ // Accept that exact representation as well as String inputs; do not
35872
+ // coerce arbitrary objects through to_s.
35873
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
35874
+ symbol.name()?.into_owned()
35875
+ } else {
35876
+ magnus::TryConvert::try_convert(val)?
35877
+ };
35532
35878
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
35533
35879
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
35534
35880
  // existing consumer code written in any of those styles keep working.
@@ -35560,7 +35906,7 @@ impl magnus::TryConvert for BlockType {
35560
35906
  unsafe impl IntoValueFromNative for BlockType {}
35561
35907
  unsafe impl TryConvertOwned for BlockType {}
35562
35908
 
35563
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
35909
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
35564
35910
  #[serde(rename_all = "snake_case")]
35565
35911
  pub enum BoundaryReason {
35566
35912
  Start,
@@ -35591,7 +35937,14 @@ impl magnus::IntoValue for BoundaryReason {
35591
35937
 
35592
35938
  impl magnus::TryConvert for BoundaryReason {
35593
35939
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
35594
- let s: String = magnus::TryConvert::try_convert(val)?;
35940
+ // IntoValue emits Symbols, including when this enum is a Hash key.
35941
+ // Accept that exact representation as well as String inputs; do not
35942
+ // coerce arbitrary objects through to_s.
35943
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
35944
+ symbol.name()?.into_owned()
35945
+ } else {
35946
+ magnus::TryConvert::try_convert(val)?
35947
+ };
35595
35948
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
35596
35949
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
35597
35950
  // existing consumer code written in any of those styles keep working.
@@ -35612,7 +35965,7 @@ impl magnus::TryConvert for BoundaryReason {
35612
35965
  unsafe impl IntoValueFromNative for BoundaryReason {}
35613
35966
  unsafe impl TryConvertOwned for BoundaryReason {}
35614
35967
 
35615
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
35968
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
35616
35969
  #[serde(rename_all = "snake_case")]
35617
35970
  pub enum BrowserBackend {
35618
35971
  Chromiumoxide,
@@ -35637,7 +35990,14 @@ impl magnus::IntoValue for BrowserBackend {
35637
35990
 
35638
35991
  impl magnus::TryConvert for BrowserBackend {
35639
35992
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
35640
- let s: String = magnus::TryConvert::try_convert(val)?;
35993
+ // IntoValue emits Symbols, including when this enum is a Hash key.
35994
+ // Accept that exact representation as well as String inputs; do not
35995
+ // coerce arbitrary objects through to_s.
35996
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
35997
+ symbol.name()?.into_owned()
35998
+ } else {
35999
+ magnus::TryConvert::try_convert(val)?
36000
+ };
35641
36001
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
35642
36002
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
35643
36003
  // existing consumer code written in any of those styles keep working.
@@ -35655,7 +36015,7 @@ impl magnus::TryConvert for BrowserBackend {
35655
36015
  unsafe impl IntoValueFromNative for BrowserBackend {}
35656
36016
  unsafe impl TryConvertOwned for BrowserBackend {}
35657
36017
 
35658
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
36018
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
35659
36019
  #[serde(rename_all = "snake_case")]
35660
36020
  pub enum BrowserMode {
35661
36021
  Auto,
@@ -35684,7 +36044,14 @@ impl magnus::IntoValue for BrowserMode {
35684
36044
 
35685
36045
  impl magnus::TryConvert for BrowserMode {
35686
36046
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
35687
- let s: String = magnus::TryConvert::try_convert(val)?;
36047
+ // IntoValue emits Symbols, including when this enum is a Hash key.
36048
+ // Accept that exact representation as well as String inputs; do not
36049
+ // coerce arbitrary objects through to_s.
36050
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
36051
+ symbol.name()?.into_owned()
36052
+ } else {
36053
+ magnus::TryConvert::try_convert(val)?
36054
+ };
35688
36055
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
35689
36056
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
35690
36057
  // existing consumer code written in any of those styles keep working.
@@ -35704,7 +36071,7 @@ impl magnus::TryConvert for BrowserMode {
35704
36071
  unsafe impl IntoValueFromNative for BrowserMode {}
35705
36072
  unsafe impl TryConvertOwned for BrowserMode {}
35706
36073
 
35707
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
36074
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
35708
36075
  #[serde(rename_all = "snake_case")]
35709
36076
  pub enum BrowserWait {
35710
36077
  NetworkIdle,
@@ -35731,7 +36098,14 @@ impl magnus::IntoValue for BrowserWait {
35731
36098
 
35732
36099
  impl magnus::TryConvert for BrowserWait {
35733
36100
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
35734
- let s: String = magnus::TryConvert::try_convert(val)?;
36101
+ // IntoValue emits Symbols, including when this enum is a Hash key.
36102
+ // Accept that exact representation as well as String inputs; do not
36103
+ // coerce arbitrary objects through to_s.
36104
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
36105
+ symbol.name()?.into_owned()
36106
+ } else {
36107
+ magnus::TryConvert::try_convert(val)?
36108
+ };
35735
36109
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
35736
36110
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
35737
36111
  // existing consumer code written in any of those styles keep working.
@@ -35750,7 +36124,7 @@ impl magnus::TryConvert for BrowserWait {
35750
36124
  unsafe impl IntoValueFromNative for BrowserWait {}
35751
36125
  unsafe impl TryConvertOwned for BrowserWait {}
35752
36126
 
35753
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
36127
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
35754
36128
  #[serde(rename_all = "snake_case")]
35755
36129
  pub enum CallMode {
35756
36130
  TextOnly,
@@ -35777,7 +36151,14 @@ impl magnus::IntoValue for CallMode {
35777
36151
 
35778
36152
  impl magnus::TryConvert for CallMode {
35779
36153
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
35780
- let s: String = magnus::TryConvert::try_convert(val)?;
36154
+ // IntoValue emits Symbols, including when this enum is a Hash key.
36155
+ // Accept that exact representation as well as String inputs; do not
36156
+ // coerce arbitrary objects through to_s.
36157
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
36158
+ symbol.name()?.into_owned()
36159
+ } else {
36160
+ magnus::TryConvert::try_convert(val)?
36161
+ };
35781
36162
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
35782
36163
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
35783
36164
  // existing consumer code written in any of those styles keep working.
@@ -35796,7 +36177,63 @@ impl magnus::TryConvert for CallMode {
35796
36177
  unsafe impl IntoValueFromNative for CallMode {}
35797
36178
  unsafe impl TryConvertOwned for CallMode {}
35798
36179
 
35799
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
36180
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
36181
+ #[serde(rename_all = "lowercase")]
36182
+ pub enum CandleDeepseekOcrDtype {
36183
+ Auto,
36184
+ F32,
36185
+ F16,
36186
+ Bf16,
36187
+ }
36188
+
36189
+ impl Default for CandleDeepseekOcrDtype {
36190
+ fn default() -> Self {
36191
+ Self::Auto
36192
+ }
36193
+ }
36194
+
36195
+ impl magnus::IntoValue for CandleDeepseekOcrDtype {
36196
+ fn into_value_with(self, handle: &Ruby) -> magnus::Value {
36197
+ let sym = match self {
36198
+ CandleDeepseekOcrDtype::Auto => "auto",
36199
+ CandleDeepseekOcrDtype::F32 => "f32",
36200
+ CandleDeepseekOcrDtype::F16 => "f16",
36201
+ CandleDeepseekOcrDtype::Bf16 => "bf16",
36202
+ };
36203
+ handle.to_symbol(sym).into_value_with(handle)
36204
+ }
36205
+ }
36206
+
36207
+ impl magnus::TryConvert for CandleDeepseekOcrDtype {
36208
+ fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
36209
+ // IntoValue emits Symbols, including when this enum is a Hash key.
36210
+ // Accept that exact representation as well as String inputs; do not
36211
+ // coerce arbitrary objects through to_s.
36212
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
36213
+ symbol.name()?.into_owned()
36214
+ } else {
36215
+ magnus::TryConvert::try_convert(val)?
36216
+ };
36217
+ // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
36218
+ // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
36219
+ // existing consumer code written in any of those styles keep working.
36220
+ match s.as_str() {
36221
+ "auto" | "Auto" => Ok(CandleDeepseekOcrDtype::Auto),
36222
+ "f32" | "F32" => Ok(CandleDeepseekOcrDtype::F32),
36223
+ "f16" | "F16" => Ok(CandleDeepseekOcrDtype::F16),
36224
+ "bf16" | "Bf16" => Ok(CandleDeepseekOcrDtype::Bf16),
36225
+ other => Err(magnus::Error::new(
36226
+ unsafe { Ruby::get_unchecked() }.exception_arg_error(),
36227
+ format!("invalid CandleDeepseekOcrDtype value: {other}"),
36228
+ )),
36229
+ }
36230
+ }
36231
+ }
36232
+
36233
+ unsafe impl IntoValueFromNative for CandleDeepseekOcrDtype {}
36234
+ unsafe impl TryConvertOwned for CandleDeepseekOcrDtype {}
36235
+
36236
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
35800
36237
  #[serde(rename_all = "lowercase")]
35801
36238
  pub enum CandleDevicePreference {
35802
36239
  Auto,
@@ -35825,7 +36262,14 @@ impl magnus::IntoValue for CandleDevicePreference {
35825
36262
 
35826
36263
  impl magnus::TryConvert for CandleDevicePreference {
35827
36264
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
35828
- let s: String = magnus::TryConvert::try_convert(val)?;
36265
+ // IntoValue emits Symbols, including when this enum is a Hash key.
36266
+ // Accept that exact representation as well as String inputs; do not
36267
+ // coerce arbitrary objects through to_s.
36268
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
36269
+ symbol.name()?.into_owned()
36270
+ } else {
36271
+ magnus::TryConvert::try_convert(val)?
36272
+ };
35829
36273
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
35830
36274
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
35831
36275
  // existing consumer code written in any of those styles keep working.
@@ -35845,7 +36289,7 @@ impl magnus::TryConvert for CandleDevicePreference {
35845
36289
  unsafe impl IntoValueFromNative for CandleDevicePreference {}
35846
36290
  unsafe impl TryConvertOwned for CandleDevicePreference {}
35847
36291
 
35848
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
36292
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
35849
36293
  #[serde(rename_all = "kebab-case")]
35850
36294
  pub enum CandleTrocrVariant {
35851
36295
  BasePrinted,
@@ -35874,7 +36318,14 @@ impl magnus::IntoValue for CandleTrocrVariant {
35874
36318
 
35875
36319
  impl magnus::TryConvert for CandleTrocrVariant {
35876
36320
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
35877
- let s: String = magnus::TryConvert::try_convert(val)?;
36321
+ // IntoValue emits Symbols, including when this enum is a Hash key.
36322
+ // Accept that exact representation as well as String inputs; do not
36323
+ // coerce arbitrary objects through to_s.
36324
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
36325
+ symbol.name()?.into_owned()
36326
+ } else {
36327
+ magnus::TryConvert::try_convert(val)?
36328
+ };
35878
36329
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
35879
36330
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
35880
36331
  // existing consumer code written in any of those styles keep working.
@@ -35919,7 +36370,8 @@ impl magnus::IntoValue for ChunkSizing {
35919
36370
 
35920
36371
  impl magnus::TryConvert for ChunkSizing {
35921
36372
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
35922
- // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
36373
+ // Generated Data variants carry native DTOs, not JSON-compatible display strings.
36374
+ let class_name: Option<String> = val.class().funcall("name", ())?; // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
35923
36375
  // For unit enums or when passed as a string, fall back to string-based conversion.
35924
36376
  let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
35925
36377
  s
@@ -35951,9 +36403,10 @@ impl magnus::TryConvert for ChunkSizing {
35951
36403
 
35952
36404
  unsafe impl IntoValueFromNative for ChunkSizing {}
35953
36405
  unsafe impl TryConvertOwned for ChunkSizing {}
36406
+
35954
36407
  impl ChunkSizing {}
35955
36408
 
35956
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
36409
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
35957
36410
  #[serde(rename_all = "snake_case")]
35958
36411
  pub enum ChunkType {
35959
36412
  Heading,
@@ -36006,7 +36459,14 @@ impl magnus::IntoValue for ChunkType {
36006
36459
 
36007
36460
  impl magnus::TryConvert for ChunkType {
36008
36461
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
36009
- let s: String = magnus::TryConvert::try_convert(val)?;
36462
+ // IntoValue emits Symbols, including when this enum is a Hash key.
36463
+ // Accept that exact representation as well as String inputs; do not
36464
+ // coerce arbitrary objects through to_s.
36465
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
36466
+ symbol.name()?.into_owned()
36467
+ } else {
36468
+ magnus::TryConvert::try_convert(val)?
36469
+ };
36010
36470
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
36011
36471
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
36012
36472
  // existing consumer code written in any of those styles keep working.
@@ -36038,7 +36498,7 @@ impl magnus::TryConvert for ChunkType {
36038
36498
  unsafe impl IntoValueFromNative for ChunkType {}
36039
36499
  unsafe impl TryConvertOwned for ChunkType {}
36040
36500
 
36041
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
36501
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
36042
36502
  #[serde(rename_all = "lowercase")]
36043
36503
  pub enum ChunkerType {
36044
36504
  Text,
@@ -36067,7 +36527,14 @@ impl magnus::IntoValue for ChunkerType {
36067
36527
 
36068
36528
  impl magnus::TryConvert for ChunkerType {
36069
36529
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
36070
- let s: String = magnus::TryConvert::try_convert(val)?;
36530
+ // IntoValue emits Symbols, including when this enum is a Hash key.
36531
+ // Accept that exact representation as well as String inputs; do not
36532
+ // coerce arbitrary objects through to_s.
36533
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
36534
+ symbol.name()?.into_owned()
36535
+ } else {
36536
+ magnus::TryConvert::try_convert(val)?
36537
+ };
36071
36538
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
36072
36539
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
36073
36540
  // existing consumer code written in any of those styles keep working.
@@ -36116,7 +36583,8 @@ impl magnus::IntoValue for ChunkingReason {
36116
36583
 
36117
36584
  impl magnus::TryConvert for ChunkingReason {
36118
36585
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
36119
- // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
36586
+ // Generated Data variants carry native DTOs, not JSON-compatible display strings.
36587
+ let class_name: Option<String> = val.class().funcall("name", ())?; // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
36120
36588
  // For unit enums or when passed as a string, fall back to string-based conversion.
36121
36589
  let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
36122
36590
  s
@@ -36148,9 +36616,10 @@ impl magnus::TryConvert for ChunkingReason {
36148
36616
 
36149
36617
  unsafe impl IntoValueFromNative for ChunkingReason {}
36150
36618
  unsafe impl TryConvertOwned for ChunkingReason {}
36619
+
36151
36620
  impl ChunkingReason {}
36152
36621
 
36153
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
36622
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
36154
36623
  pub enum CodeBlockStyle {
36155
36624
  Indented,
36156
36625
  Backticks,
@@ -36176,7 +36645,14 @@ impl magnus::IntoValue for CodeBlockStyle {
36176
36645
 
36177
36646
  impl magnus::TryConvert for CodeBlockStyle {
36178
36647
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
36179
- let s: String = magnus::TryConvert::try_convert(val)?;
36648
+ // IntoValue emits Symbols, including when this enum is a Hash key.
36649
+ // Accept that exact representation as well as String inputs; do not
36650
+ // coerce arbitrary objects through to_s.
36651
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
36652
+ symbol.name()?.into_owned()
36653
+ } else {
36654
+ magnus::TryConvert::try_convert(val)?
36655
+ };
36180
36656
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
36181
36657
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
36182
36658
  // existing consumer code written in any of those styles keep working.
@@ -36195,7 +36671,7 @@ impl magnus::TryConvert for CodeBlockStyle {
36195
36671
  unsafe impl IntoValueFromNative for CodeBlockStyle {}
36196
36672
  unsafe impl TryConvertOwned for CodeBlockStyle {}
36197
36673
 
36198
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
36674
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
36199
36675
  #[serde(rename_all = "snake_case")]
36200
36676
  pub enum CodeContentMode {
36201
36677
  Chunks,
@@ -36222,7 +36698,14 @@ impl magnus::IntoValue for CodeContentMode {
36222
36698
 
36223
36699
  impl magnus::TryConvert for CodeContentMode {
36224
36700
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
36225
- let s: String = magnus::TryConvert::try_convert(val)?;
36701
+ // IntoValue emits Symbols, including when this enum is a Hash key.
36702
+ // Accept that exact representation as well as String inputs; do not
36703
+ // coerce arbitrary objects through to_s.
36704
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
36705
+ symbol.name()?.into_owned()
36706
+ } else {
36707
+ magnus::TryConvert::try_convert(val)?
36708
+ };
36226
36709
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
36227
36710
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
36228
36711
  // existing consumer code written in any of those styles keep working.
@@ -36241,7 +36724,7 @@ impl magnus::TryConvert for CodeContentMode {
36241
36724
  unsafe impl IntoValueFromNative for CodeContentMode {}
36242
36725
  unsafe impl TryConvertOwned for CodeContentMode {}
36243
36726
 
36244
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
36727
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
36245
36728
  #[serde(rename_all = "snake_case")]
36246
36729
  pub enum CodeDataNodeKind {
36247
36730
  KeyValue,
@@ -36268,7 +36751,14 @@ impl magnus::IntoValue for CodeDataNodeKind {
36268
36751
 
36269
36752
  impl magnus::TryConvert for CodeDataNodeKind {
36270
36753
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
36271
- let s: String = magnus::TryConvert::try_convert(val)?;
36754
+ // IntoValue emits Symbols, including when this enum is a Hash key.
36755
+ // Accept that exact representation as well as String inputs; do not
36756
+ // coerce arbitrary objects through to_s.
36757
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
36758
+ symbol.name()?.into_owned()
36759
+ } else {
36760
+ magnus::TryConvert::try_convert(val)?
36761
+ };
36272
36762
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
36273
36763
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
36274
36764
  // existing consumer code written in any of those styles keep working.
@@ -36349,7 +36839,7 @@ impl ConfidenceSemantics {
36349
36839
  }
36350
36840
  }
36351
36841
 
36352
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
36842
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
36353
36843
  #[serde(rename_all = "snake_case")]
36354
36844
  pub enum ContentFilterKind {
36355
36845
  Bm25,
@@ -36372,7 +36862,14 @@ impl magnus::IntoValue for ContentFilterKind {
36372
36862
 
36373
36863
  impl magnus::TryConvert for ContentFilterKind {
36374
36864
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
36375
- let s: String = magnus::TryConvert::try_convert(val)?;
36865
+ // IntoValue emits Symbols, including when this enum is a Hash key.
36866
+ // Accept that exact representation as well as String inputs; do not
36867
+ // coerce arbitrary objects through to_s.
36868
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
36869
+ symbol.name()?.into_owned()
36870
+ } else {
36871
+ magnus::TryConvert::try_convert(val)?
36872
+ };
36376
36873
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
36377
36874
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
36378
36875
  // existing consumer code written in any of those styles keep working.
@@ -36389,7 +36886,7 @@ impl magnus::TryConvert for ContentFilterKind {
36389
36886
  unsafe impl IntoValueFromNative for ContentFilterKind {}
36390
36887
  unsafe impl TryConvertOwned for ContentFilterKind {}
36391
36888
 
36392
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
36889
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
36393
36890
  #[serde(rename_all = "snake_case")]
36394
36891
  pub enum ContentLayer {
36395
36892
  Body,
@@ -36418,7 +36915,14 @@ impl magnus::IntoValue for ContentLayer {
36418
36915
 
36419
36916
  impl magnus::TryConvert for ContentLayer {
36420
36917
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
36421
- let s: String = magnus::TryConvert::try_convert(val)?;
36918
+ // IntoValue emits Symbols, including when this enum is a Hash key.
36919
+ // Accept that exact representation as well as String inputs; do not
36920
+ // coerce arbitrary objects through to_s.
36921
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
36922
+ symbol.name()?.into_owned()
36923
+ } else {
36924
+ magnus::TryConvert::try_convert(val)?
36925
+ };
36422
36926
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
36423
36927
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
36424
36928
  // existing consumer code written in any of those styles keep working.
@@ -36438,7 +36942,7 @@ impl magnus::TryConvert for ContentLayer {
36438
36942
  unsafe impl IntoValueFromNative for ContentLayer {}
36439
36943
  unsafe impl TryConvertOwned for ContentLayer {}
36440
36944
 
36441
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
36945
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
36442
36946
  #[serde(rename_all = "snake_case")]
36443
36947
  pub enum CrawlStrategyKind {
36444
36948
  Bfs,
@@ -36467,7 +36971,14 @@ impl magnus::IntoValue for CrawlStrategyKind {
36467
36971
 
36468
36972
  impl magnus::TryConvert for CrawlStrategyKind {
36469
36973
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
36470
- let s: String = magnus::TryConvert::try_convert(val)?;
36974
+ // IntoValue emits Symbols, including when this enum is a Hash key.
36975
+ // Accept that exact representation as well as String inputs; do not
36976
+ // coerce arbitrary objects through to_s.
36977
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
36978
+ symbol.name()?.into_owned()
36979
+ } else {
36980
+ magnus::TryConvert::try_convert(val)?
36981
+ };
36471
36982
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
36472
36983
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
36473
36984
  // existing consumer code written in any of those styles keep working.
@@ -36512,17 +37023,6 @@ pub enum CredentialProviderConfig {
36512
37023
  },
36513
37024
  }
36514
37025
 
36515
- impl Default for CredentialProviderConfig {
36516
- fn default() -> Self {
36517
- Self::AzureAd {
36518
- tenant_id: Default::default(),
36519
- client_id: Default::default(),
36520
- client_secret: Default::default(),
36521
- scope: Default::default(),
36522
- }
36523
- }
36524
- }
36525
-
36526
37026
  impl magnus::IntoValue for CredentialProviderConfig {
36527
37027
  fn into_value_with(self, handle: &Ruby) -> magnus::Value {
36528
37028
  match serde_json::to_value(&self) {
@@ -36534,7 +37034,8 @@ impl magnus::IntoValue for CredentialProviderConfig {
36534
37034
 
36535
37035
  impl magnus::TryConvert for CredentialProviderConfig {
36536
37036
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
36537
- // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
37037
+ // Generated Data variants carry native DTOs, not JSON-compatible display strings.
37038
+ let class_name: Option<String> = val.class().funcall("name", ())?; // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
36538
37039
  // For unit enums or when passed as a string, fall back to string-based conversion.
36539
37040
  let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
36540
37041
  s
@@ -36566,6 +37067,7 @@ impl magnus::TryConvert for CredentialProviderConfig {
36566
37067
 
36567
37068
  unsafe impl IntoValueFromNative for CredentialProviderConfig {}
36568
37069
  unsafe impl TryConvertOwned for CredentialProviderConfig {}
37070
+
36569
37071
  impl CredentialProviderConfig {}
36570
37072
 
36571
37073
  #[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
@@ -36594,7 +37096,8 @@ impl magnus::IntoValue for DiffLine {
36594
37096
 
36595
37097
  impl magnus::TryConvert for DiffLine {
36596
37098
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
36597
- // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
37099
+ // Generated Data variants carry native DTOs, not JSON-compatible display strings.
37100
+ let class_name: Option<String> = val.class().funcall("name", ())?; // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
36598
37101
  // For unit enums or when passed as a string, fall back to string-based conversion.
36599
37102
  let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
36600
37103
  s
@@ -36626,6 +37129,7 @@ impl magnus::TryConvert for DiffLine {
36626
37129
 
36627
37130
  unsafe impl IntoValueFromNative for DiffLine {}
36628
37131
  unsafe impl TryConvertOwned for DiffLine {}
37132
+
36629
37133
  impl DiffLine {
36630
37134
  pub fn context(&self) -> Option<&String> {
36631
37135
  match self {
@@ -36647,7 +37151,7 @@ impl DiffLine {
36647
37151
  }
36648
37152
  }
36649
37153
 
36650
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
37154
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
36651
37155
  #[serde(rename_all = "snake_case")]
36652
37156
  pub enum DocumentContentEncoding {
36653
37157
  Base64,
@@ -36670,7 +37174,14 @@ impl magnus::IntoValue for DocumentContentEncoding {
36670
37174
 
36671
37175
  impl magnus::TryConvert for DocumentContentEncoding {
36672
37176
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
36673
- let s: String = magnus::TryConvert::try_convert(val)?;
37177
+ // IntoValue emits Symbols, including when this enum is a Hash key.
37178
+ // Accept that exact representation as well as String inputs; do not
37179
+ // coerce arbitrary objects through to_s.
37180
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
37181
+ symbol.name()?.into_owned()
37182
+ } else {
37183
+ magnus::TryConvert::try_convert(val)?
37184
+ };
36674
37185
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
36675
37186
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
36676
37187
  // existing consumer code written in any of those styles keep working.
@@ -36687,7 +37198,7 @@ impl magnus::TryConvert for DocumentContentEncoding {
36687
37198
  unsafe impl IntoValueFromNative for DocumentContentEncoding {}
36688
37199
  unsafe impl TryConvertOwned for DocumentContentEncoding {}
36689
37200
 
36690
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
37201
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
36691
37202
  #[serde(rename_all = "snake_case")]
36692
37203
  pub enum ElementType {
36693
37204
  Title,
@@ -36732,7 +37243,14 @@ impl magnus::IntoValue for ElementType {
36732
37243
 
36733
37244
  impl magnus::TryConvert for ElementType {
36734
37245
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
36735
- let s: String = magnus::TryConvert::try_convert(val)?;
37246
+ // IntoValue emits Symbols, including when this enum is a Hash key.
37247
+ // Accept that exact representation as well as String inputs; do not
37248
+ // coerce arbitrary objects through to_s.
37249
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
37250
+ symbol.name()?.into_owned()
37251
+ } else {
37252
+ magnus::TryConvert::try_convert(val)?
37253
+ };
36736
37254
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
36737
37255
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
36738
37256
  // existing consumer code written in any of those styles keep working.
@@ -36766,7 +37284,7 @@ unsafe impl TryConvertOwned for ElementType {}
36766
37284
  pub enum EmbeddingModelType {
36767
37285
  Preset { name: String },
36768
37286
  Custom { model_id: String, dimensions: usize },
36769
- Llm { llm: LlmConfig },
37287
+ Llm { llm: Box<LlmConfig> },
36770
37288
  Plugin { name: String },
36771
37289
  }
36772
37290
 
@@ -36789,7 +37307,8 @@ impl magnus::IntoValue for EmbeddingModelType {
36789
37307
 
36790
37308
  impl magnus::TryConvert for EmbeddingModelType {
36791
37309
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
36792
- // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
37310
+ // Generated Data variants carry native DTOs, not JSON-compatible display strings.
37311
+ let class_name: Option<String> = val.class().funcall("name", ())?; // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
36793
37312
  // For unit enums or when passed as a string, fall back to string-based conversion.
36794
37313
  let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
36795
37314
  s
@@ -36821,9 +37340,10 @@ impl magnus::TryConvert for EmbeddingModelType {
36821
37340
 
36822
37341
  unsafe impl IntoValueFromNative for EmbeddingModelType {}
36823
37342
  unsafe impl TryConvertOwned for EmbeddingModelType {}
37343
+
36824
37344
  impl EmbeddingModelType {}
36825
37345
 
36826
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
37346
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
36827
37347
  #[serde(rename_all = "snake_case")]
36828
37348
  pub enum EmbeddingsEmbeddingBackend {
36829
37349
  Onnx,
@@ -36848,7 +37368,14 @@ impl magnus::IntoValue for EmbeddingsEmbeddingBackend {
36848
37368
 
36849
37369
  impl magnus::TryConvert for EmbeddingsEmbeddingBackend {
36850
37370
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
36851
- let s: String = magnus::TryConvert::try_convert(val)?;
37371
+ // IntoValue emits Symbols, including when this enum is a Hash key.
37372
+ // Accept that exact representation as well as String inputs; do not
37373
+ // coerce arbitrary objects through to_s.
37374
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
37375
+ symbol.name()?.into_owned()
37376
+ } else {
37377
+ magnus::TryConvert::try_convert(val)?
37378
+ };
36852
37379
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
36853
37380
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
36854
37381
  // existing consumer code written in any of those styles keep working.
@@ -36931,7 +37458,7 @@ impl magnus::TryConvert for EntityCategory {
36931
37458
  unsafe impl IntoValueFromNative for EntityCategory {}
36932
37459
  unsafe impl TryConvertOwned for EntityCategory {}
36933
37460
 
36934
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
37461
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
36935
37462
  #[serde(rename_all = "lowercase")]
36936
37463
  pub enum ExecutionProviderType {
36937
37464
  Auto,
@@ -36962,7 +37489,14 @@ impl magnus::IntoValue for ExecutionProviderType {
36962
37489
 
36963
37490
  impl magnus::TryConvert for ExecutionProviderType {
36964
37491
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
36965
- let s: String = magnus::TryConvert::try_convert(val)?;
37492
+ // IntoValue emits Symbols, including when this enum is a Hash key.
37493
+ // Accept that exact representation as well as String inputs; do not
37494
+ // coerce arbitrary objects through to_s.
37495
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
37496
+ symbol.name()?.into_owned()
37497
+ } else {
37498
+ magnus::TryConvert::try_convert(val)?
37499
+ };
36966
37500
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
36967
37501
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
36968
37502
  // existing consumer code written in any of those styles keep working.
@@ -36983,7 +37517,7 @@ impl magnus::TryConvert for ExecutionProviderType {
36983
37517
  unsafe impl IntoValueFromNative for ExecutionProviderType {}
36984
37518
  unsafe impl TryConvertOwned for ExecutionProviderType {}
36985
37519
 
36986
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
37520
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
36987
37521
  #[serde(rename_all = "snake_case")]
36988
37522
  pub enum ExtractInputKind {
36989
37523
  Bytes,
@@ -37008,7 +37542,14 @@ impl magnus::IntoValue for ExtractInputKind {
37008
37542
 
37009
37543
  impl magnus::TryConvert for ExtractInputKind {
37010
37544
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
37011
- let s: String = magnus::TryConvert::try_convert(val)?;
37545
+ // IntoValue emits Symbols, including when this enum is a Hash key.
37546
+ // Accept that exact representation as well as String inputs; do not
37547
+ // coerce arbitrary objects through to_s.
37548
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
37549
+ symbol.name()?.into_owned()
37550
+ } else {
37551
+ magnus::TryConvert::try_convert(val)?
37552
+ };
37012
37553
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
37013
37554
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
37014
37555
  // existing consumer code written in any of those styles keep working.
@@ -37026,7 +37567,7 @@ impl magnus::TryConvert for ExtractInputKind {
37026
37567
  unsafe impl IntoValueFromNative for ExtractInputKind {}
37027
37568
  unsafe impl TryConvertOwned for ExtractInputKind {}
37028
37569
 
37029
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
37570
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
37030
37571
  #[serde(rename_all = "snake_case")]
37031
37572
  pub enum ExtractionMethod {
37032
37573
  Native,
@@ -37053,7 +37594,14 @@ impl magnus::IntoValue for ExtractionMethod {
37053
37594
 
37054
37595
  impl magnus::TryConvert for ExtractionMethod {
37055
37596
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
37056
- let s: String = magnus::TryConvert::try_convert(val)?;
37597
+ // IntoValue emits Symbols, including when this enum is a Hash key.
37598
+ // Accept that exact representation as well as String inputs; do not
37599
+ // coerce arbitrary objects through to_s.
37600
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
37601
+ symbol.name()?.into_owned()
37602
+ } else {
37603
+ magnus::TryConvert::try_convert(val)?
37604
+ };
37057
37605
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
37058
37606
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
37059
37607
  // existing consumer code written in any of those styles keep working.
@@ -37072,7 +37620,7 @@ impl magnus::TryConvert for ExtractionMethod {
37072
37620
  unsafe impl IntoValueFromNative for ExtractionMethod {}
37073
37621
  unsafe impl TryConvertOwned for ExtractionMethod {}
37074
37622
 
37075
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
37623
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
37076
37624
  #[serde(rename_all = "snake_case")]
37077
37625
  pub enum FormFieldType {
37078
37626
  Text,
@@ -37107,7 +37655,14 @@ impl magnus::IntoValue for FormFieldType {
37107
37655
 
37108
37656
  impl magnus::TryConvert for FormFieldType {
37109
37657
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
37110
- let s: String = magnus::TryConvert::try_convert(val)?;
37658
+ // IntoValue emits Symbols, including when this enum is a Hash key.
37659
+ // Accept that exact representation as well as String inputs; do not
37660
+ // coerce arbitrary objects through to_s.
37661
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
37662
+ symbol.name()?.into_owned()
37663
+ } else {
37664
+ magnus::TryConvert::try_convert(val)?
37665
+ };
37111
37666
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
37112
37667
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
37113
37668
  // existing consumer code written in any of those styles keep working.
@@ -37140,7 +37695,7 @@ pub enum FormatMetadata {
37140
37695
  },
37141
37696
  Docx {
37142
37697
  #[serde(flatten)]
37143
- _0: DocxMetadata,
37698
+ _0: Box<DocxMetadata>,
37144
37699
  },
37145
37700
  Excel {
37146
37701
  #[serde(flatten)]
@@ -37172,7 +37727,7 @@ pub enum FormatMetadata {
37172
37727
  },
37173
37728
  Html {
37174
37729
  #[serde(flatten)]
37175
- _0: HtmlMetadata,
37730
+ _0: Box<HtmlMetadata>,
37176
37731
  },
37177
37732
  Ocr {
37178
37733
  #[serde(flatten)]
@@ -37237,7 +37792,92 @@ impl magnus::IntoValue for FormatMetadata {
37237
37792
 
37238
37793
  impl magnus::TryConvert for FormatMetadata {
37239
37794
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
37240
- // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
37795
+ // Generated Data variants carry native DTOs, not JSON-compatible display strings.
37796
+ let class_name: Option<String> = val.class().funcall("name", ())?;
37797
+ if class_name.as_deref() == Some("Xberg::FormatMetadataPdf") {
37798
+ let payload: PdfMetadata = val.funcall("value", ())?;
37799
+ return Ok(Self::Pdf { _0: payload });
37800
+ }
37801
+ if class_name.as_deref() == Some("Xberg::FormatMetadataDocx") {
37802
+ let payload: DocxMetadata = val.funcall("value", ())?;
37803
+ return Ok(Self::Docx { _0: Box::new(payload) });
37804
+ }
37805
+ if class_name.as_deref() == Some("Xberg::FormatMetadataExcel") {
37806
+ let payload: ExcelMetadata = val.funcall("value", ())?;
37807
+ return Ok(Self::Excel { _0: payload });
37808
+ }
37809
+ if class_name.as_deref() == Some("Xberg::FormatMetadataEmail") {
37810
+ let payload: EmailMetadata = val.funcall("value", ())?;
37811
+ return Ok(Self::Email { _0: payload });
37812
+ }
37813
+ if class_name.as_deref() == Some("Xberg::FormatMetadataPptx") {
37814
+ let payload: PptxMetadata = val.funcall("value", ())?;
37815
+ return Ok(Self::Pptx { _0: payload });
37816
+ }
37817
+ if class_name.as_deref() == Some("Xberg::FormatMetadataArchive") {
37818
+ let payload: ArchiveMetadata = val.funcall("value", ())?;
37819
+ return Ok(Self::Archive { _0: payload });
37820
+ }
37821
+ if class_name.as_deref() == Some("Xberg::FormatMetadataImage") {
37822
+ let payload: ImageMetadata = val.funcall("value", ())?;
37823
+ return Ok(Self::Image { _0: payload });
37824
+ }
37825
+ if class_name.as_deref() == Some("Xberg::FormatMetadataXml") {
37826
+ let payload: XmlMetadata = val.funcall("value", ())?;
37827
+ return Ok(Self::Xml { _0: payload });
37828
+ }
37829
+ if class_name.as_deref() == Some("Xberg::FormatMetadataText") {
37830
+ let payload: TextMetadata = val.funcall("value", ())?;
37831
+ return Ok(Self::Text { _0: payload });
37832
+ }
37833
+ if class_name.as_deref() == Some("Xberg::FormatMetadataHtml") {
37834
+ let payload: HtmlMetadata = val.funcall("value", ())?;
37835
+ return Ok(Self::Html { _0: Box::new(payload) });
37836
+ }
37837
+ if class_name.as_deref() == Some("Xberg::FormatMetadataOcr") {
37838
+ let payload: OcrMetadata = val.funcall("value", ())?;
37839
+ return Ok(Self::Ocr { _0: payload });
37840
+ }
37841
+ if class_name.as_deref() == Some("Xberg::FormatMetadataCsv") {
37842
+ let payload: CsvMetadata = val.funcall("value", ())?;
37843
+ return Ok(Self::Csv { _0: payload });
37844
+ }
37845
+ if class_name.as_deref() == Some("Xberg::FormatMetadataBibtex") {
37846
+ let payload: BibtexMetadata = val.funcall("value", ())?;
37847
+ return Ok(Self::Bibtex { _0: payload });
37848
+ }
37849
+ if class_name.as_deref() == Some("Xberg::FormatMetadataCitation") {
37850
+ let payload: CitationMetadata = val.funcall("value", ())?;
37851
+ return Ok(Self::Citation { _0: payload });
37852
+ }
37853
+ if class_name.as_deref() == Some("Xberg::FormatMetadataFictionBook") {
37854
+ let payload: FictionBookMetadata = val.funcall("value", ())?;
37855
+ return Ok(Self::FictionBook { _0: payload });
37856
+ }
37857
+ if class_name.as_deref() == Some("Xberg::FormatMetadataDbf") {
37858
+ let payload: DbfMetadata = val.funcall("value", ())?;
37859
+ return Ok(Self::Dbf { _0: payload });
37860
+ }
37861
+ if class_name.as_deref() == Some("Xberg::FormatMetadataJats") {
37862
+ let payload: JatsMetadata = val.funcall("value", ())?;
37863
+ return Ok(Self::Jats { _0: payload });
37864
+ }
37865
+ if class_name.as_deref() == Some("Xberg::FormatMetadataEpub") {
37866
+ let payload: EpubMetadata = val.funcall("value", ())?;
37867
+ return Ok(Self::Epub { _0: payload });
37868
+ }
37869
+ if class_name.as_deref() == Some("Xberg::FormatMetadataPst") {
37870
+ let payload: PstMetadata = val.funcall("value", ())?;
37871
+ return Ok(Self::Pst { _0: payload });
37872
+ }
37873
+ if class_name.as_deref() == Some("Xberg::FormatMetadataAudio") {
37874
+ let payload: AudioMetadata = val.funcall("value", ())?;
37875
+ return Ok(Self::Audio { _0: payload });
37876
+ }
37877
+ if class_name.as_deref() == Some("Xberg::FormatMetadataCode") {
37878
+ let payload: CodeMetadata = val.funcall("value", ())?;
37879
+ return Ok(Self::Code { _0: payload });
37880
+ } // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
37241
37881
  // For unit enums or when passed as a string, fall back to string-based conversion.
37242
37882
  let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
37243
37883
  s
@@ -37269,6 +37909,7 @@ impl magnus::TryConvert for FormatMetadata {
37269
37909
 
37270
37910
  unsafe impl IntoValueFromNative for FormatMetadata {}
37271
37911
  unsafe impl TryConvertOwned for FormatMetadata {}
37912
+
37272
37913
  impl FormatMetadata {
37273
37914
  pub fn pdf(&self) -> Option<&PdfMetadata> {
37274
37915
  match self {
@@ -37278,7 +37919,7 @@ impl FormatMetadata {
37278
37919
  }
37279
37920
  pub fn docx(&self) -> Option<&DocxMetadata> {
37280
37921
  match self {
37281
- Self::Docx { _0 } => Some(_0),
37922
+ Self::Docx { _0 } => Some(&**_0),
37282
37923
  _ => None,
37283
37924
  }
37284
37925
  }
@@ -37326,7 +37967,7 @@ impl FormatMetadata {
37326
37967
  }
37327
37968
  pub fn html(&self) -> Option<&HtmlMetadata> {
37328
37969
  match self {
37329
- Self::Html { _0 } => Some(_0),
37970
+ Self::Html { _0 } => Some(&**_0),
37330
37971
  _ => None,
37331
37972
  }
37332
37973
  }
@@ -37398,7 +38039,7 @@ impl FormatMetadata {
37398
38039
  }
37399
38040
  }
37400
38041
 
37401
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
38042
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
37402
38043
  #[serde(rename_all = "snake_case")]
37403
38044
  pub enum FormulaModel {
37404
38045
  LatexOcr,
@@ -37421,7 +38062,14 @@ impl magnus::IntoValue for FormulaModel {
37421
38062
 
37422
38063
  impl magnus::TryConvert for FormulaModel {
37423
38064
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
37424
- let s: String = magnus::TryConvert::try_convert(val)?;
38065
+ // IntoValue emits Symbols, including when this enum is a Hash key.
38066
+ // Accept that exact representation as well as String inputs; do not
38067
+ // coerce arbitrary objects through to_s.
38068
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
38069
+ symbol.name()?.into_owned()
38070
+ } else {
38071
+ magnus::TryConvert::try_convert(val)?
38072
+ };
37425
38073
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
37426
38074
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
37427
38075
  // existing consumer code written in any of those styles keep working.
@@ -37438,7 +38086,7 @@ impl magnus::TryConvert for FormulaModel {
37438
38086
  unsafe impl IntoValueFromNative for FormulaModel {}
37439
38087
  unsafe impl TryConvertOwned for FormulaModel {}
37440
38088
 
37441
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
38089
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
37442
38090
  #[serde(rename_all = "snake_case")]
37443
38091
  pub enum GlmOcrLayoutMode {
37444
38092
  WholePage,
@@ -37463,7 +38111,14 @@ impl magnus::IntoValue for GlmOcrLayoutMode {
37463
38111
 
37464
38112
  impl magnus::TryConvert for GlmOcrLayoutMode {
37465
38113
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
37466
- let s: String = magnus::TryConvert::try_convert(val)?;
38114
+ // IntoValue emits Symbols, including when this enum is a Hash key.
38115
+ // Accept that exact representation as well as String inputs; do not
38116
+ // coerce arbitrary objects through to_s.
38117
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
38118
+ symbol.name()?.into_owned()
38119
+ } else {
38120
+ magnus::TryConvert::try_convert(val)?
38121
+ };
37467
38122
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
37468
38123
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
37469
38124
  // existing consumer code written in any of those styles keep working.
@@ -37481,7 +38136,7 @@ impl magnus::TryConvert for GlmOcrLayoutMode {
37481
38136
  unsafe impl IntoValueFromNative for GlmOcrLayoutMode {}
37482
38137
  unsafe impl TryConvertOwned for GlmOcrLayoutMode {}
37483
38138
 
37484
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
38139
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
37485
38140
  #[serde(rename_all = "lowercase")]
37486
38141
  pub enum GlmOcrTaskKind {
37487
38142
  Ocr,
@@ -37512,7 +38167,14 @@ impl magnus::IntoValue for GlmOcrTaskKind {
37512
38167
 
37513
38168
  impl magnus::TryConvert for GlmOcrTaskKind {
37514
38169
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
37515
- let s: String = magnus::TryConvert::try_convert(val)?;
38170
+ // IntoValue emits Symbols, including when this enum is a Hash key.
38171
+ // Accept that exact representation as well as String inputs; do not
38172
+ // coerce arbitrary objects through to_s.
38173
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
38174
+ symbol.name()?.into_owned()
38175
+ } else {
38176
+ magnus::TryConvert::try_convert(val)?
38177
+ };
37516
38178
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
37517
38179
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
37518
38180
  // existing consumer code written in any of those styles keep working.
@@ -37533,7 +38195,7 @@ impl magnus::TryConvert for GlmOcrTaskKind {
37533
38195
  unsafe impl IntoValueFromNative for GlmOcrTaskKind {}
37534
38196
  unsafe impl TryConvertOwned for GlmOcrTaskKind {}
37535
38197
 
37536
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
38198
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
37537
38199
  pub enum HeadingStyle {
37538
38200
  Underlined,
37539
38201
  Atx,
@@ -37559,7 +38221,14 @@ impl magnus::IntoValue for HeadingStyle {
37559
38221
 
37560
38222
  impl magnus::TryConvert for HeadingStyle {
37561
38223
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
37562
- let s: String = magnus::TryConvert::try_convert(val)?;
38224
+ // IntoValue emits Symbols, including when this enum is a Hash key.
38225
+ // Accept that exact representation as well as String inputs; do not
38226
+ // coerce arbitrary objects through to_s.
38227
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
38228
+ symbol.name()?.into_owned()
38229
+ } else {
38230
+ magnus::TryConvert::try_convert(val)?
38231
+ };
37563
38232
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
37564
38233
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
37565
38234
  // existing consumer code written in any of those styles keep working.
@@ -37578,7 +38247,7 @@ impl magnus::TryConvert for HeadingStyle {
37578
38247
  unsafe impl IntoValueFromNative for HeadingStyle {}
37579
38248
  unsafe impl TryConvertOwned for HeadingStyle {}
37580
38249
 
37581
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
38250
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
37582
38251
  pub enum HighlightStyle {
37583
38252
  DoubleEqual,
37584
38253
  Html,
@@ -37606,7 +38275,14 @@ impl magnus::IntoValue for HighlightStyle {
37606
38275
 
37607
38276
  impl magnus::TryConvert for HighlightStyle {
37608
38277
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
37609
- let s: String = magnus::TryConvert::try_convert(val)?;
38278
+ // IntoValue emits Symbols, including when this enum is a Hash key.
38279
+ // Accept that exact representation as well as String inputs; do not
38280
+ // coerce arbitrary objects through to_s.
38281
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
38282
+ symbol.name()?.into_owned()
38283
+ } else {
38284
+ magnus::TryConvert::try_convert(val)?
38285
+ };
37610
38286
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
37611
38287
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
37612
38288
  // existing consumer code written in any of those styles keep working.
@@ -37635,14 +38311,6 @@ pub enum HostMatcher {
37635
38311
  Cidr { value: String },
37636
38312
  }
37637
38313
 
37638
- impl Default for HostMatcher {
37639
- fn default() -> Self {
37640
- Self::Exact {
37641
- value: Default::default(),
37642
- }
37643
- }
37644
- }
37645
-
37646
38314
  impl magnus::IntoValue for HostMatcher {
37647
38315
  fn into_value_with(self, handle: &Ruby) -> magnus::Value {
37648
38316
  match serde_json::to_value(&self) {
@@ -37654,7 +38322,8 @@ impl magnus::IntoValue for HostMatcher {
37654
38322
 
37655
38323
  impl magnus::TryConvert for HostMatcher {
37656
38324
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
37657
- // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
38325
+ // Generated Data variants carry native DTOs, not JSON-compatible display strings.
38326
+ let class_name: Option<String> = val.class().funcall("name", ())?; // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
37658
38327
  // For unit enums or when passed as a string, fall back to string-based conversion.
37659
38328
  let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
37660
38329
  s
@@ -37686,9 +38355,10 @@ impl magnus::TryConvert for HostMatcher {
37686
38355
 
37687
38356
  unsafe impl IntoValueFromNative for HostMatcher {}
37688
38357
  unsafe impl TryConvertOwned for HostMatcher {}
38358
+
37689
38359
  impl HostMatcher {}
37690
38360
 
37691
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
38361
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
37692
38362
  #[serde(rename_all = "lowercase")]
37693
38363
  pub enum HtmlTheme {
37694
38364
  Default,
@@ -37719,7 +38389,14 @@ impl magnus::IntoValue for HtmlTheme {
37719
38389
 
37720
38390
  impl magnus::TryConvert for HtmlTheme {
37721
38391
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
37722
- let s: String = magnus::TryConvert::try_convert(val)?;
38392
+ // IntoValue emits Symbols, including when this enum is a Hash key.
38393
+ // Accept that exact representation as well as String inputs; do not
38394
+ // coerce arbitrary objects through to_s.
38395
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
38396
+ symbol.name()?.into_owned()
38397
+ } else {
38398
+ magnus::TryConvert::try_convert(val)?
38399
+ };
37723
38400
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
37724
38401
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
37725
38402
  // existing consumer code written in any of those styles keep working.
@@ -37740,7 +38417,7 @@ impl magnus::TryConvert for HtmlTheme {
37740
38417
  unsafe impl IntoValueFromNative for HtmlTheme {}
37741
38418
  unsafe impl TryConvertOwned for HtmlTheme {}
37742
38419
 
37743
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
38420
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
37744
38421
  pub enum HtmlToMarkdownRsOutputFormat {
37745
38422
  Markdown,
37746
38423
  Djot,
@@ -37766,7 +38443,14 @@ impl magnus::IntoValue for HtmlToMarkdownRsOutputFormat {
37766
38443
 
37767
38444
  impl magnus::TryConvert for HtmlToMarkdownRsOutputFormat {
37768
38445
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
37769
- let s: String = magnus::TryConvert::try_convert(val)?;
38446
+ // IntoValue emits Symbols, including when this enum is a Hash key.
38447
+ // Accept that exact representation as well as String inputs; do not
38448
+ // coerce arbitrary objects through to_s.
38449
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
38450
+ symbol.name()?.into_owned()
38451
+ } else {
38452
+ magnus::TryConvert::try_convert(val)?
38453
+ };
37770
38454
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
37771
38455
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
37772
38456
  // existing consumer code written in any of those styles keep working.
@@ -37785,7 +38469,7 @@ impl magnus::TryConvert for HtmlToMarkdownRsOutputFormat {
37785
38469
  unsafe impl IntoValueFromNative for HtmlToMarkdownRsOutputFormat {}
37786
38470
  unsafe impl TryConvertOwned for HtmlToMarkdownRsOutputFormat {}
37787
38471
 
37788
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
38472
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
37789
38473
  #[serde(rename_all = "snake_case")]
37790
38474
  pub enum ImageKind {
37791
38475
  Photograph,
@@ -37830,7 +38514,14 @@ impl magnus::IntoValue for ImageKind {
37830
38514
 
37831
38515
  impl magnus::TryConvert for ImageKind {
37832
38516
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
37833
- let s: String = magnus::TryConvert::try_convert(val)?;
38517
+ // IntoValue emits Symbols, including when this enum is a Hash key.
38518
+ // Accept that exact representation as well as String inputs; do not
38519
+ // coerce arbitrary objects through to_s.
38520
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
38521
+ symbol.name()?.into_owned()
38522
+ } else {
38523
+ magnus::TryConvert::try_convert(val)?
38524
+ };
37834
38525
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
37835
38526
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
37836
38527
  // existing consumer code written in any of those styles keep working.
@@ -37887,7 +38578,8 @@ impl magnus::IntoValue for ImageOutputFormat {
37887
38578
 
37888
38579
  impl magnus::TryConvert for ImageOutputFormat {
37889
38580
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
37890
- // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
38581
+ // Generated Data variants carry native DTOs, not JSON-compatible display strings.
38582
+ let class_name: Option<String> = val.class().funcall("name", ())?; // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
37891
38583
  // For unit enums or when passed as a string, fall back to string-based conversion.
37892
38584
  let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
37893
38585
  s
@@ -37919,9 +38611,10 @@ impl magnus::TryConvert for ImageOutputFormat {
37919
38611
 
37920
38612
  unsafe impl IntoValueFromNative for ImageOutputFormat {}
37921
38613
  unsafe impl TryConvertOwned for ImageOutputFormat {}
38614
+
37922
38615
  impl ImageOutputFormat {}
37923
38616
 
37924
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
38617
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
37925
38618
  #[serde(rename_all = "lowercase")]
37926
38619
  pub enum ImageType {
37927
38620
  #[serde(rename = "data-uri")]
@@ -37952,7 +38645,14 @@ impl magnus::IntoValue for ImageType {
37952
38645
 
37953
38646
  impl magnus::TryConvert for ImageType {
37954
38647
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
37955
- let s: String = magnus::TryConvert::try_convert(val)?;
38648
+ // IntoValue emits Symbols, including when this enum is a Hash key.
38649
+ // Accept that exact representation as well as String inputs; do not
38650
+ // coerce arbitrary objects through to_s.
38651
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
38652
+ symbol.name()?.into_owned()
38653
+ } else {
38654
+ magnus::TryConvert::try_convert(val)?
38655
+ };
37956
38656
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
37957
38657
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
37958
38658
  // existing consumer code written in any of those styles keep working.
@@ -37972,7 +38672,7 @@ impl magnus::TryConvert for ImageType {
37972
38672
  unsafe impl IntoValueFromNative for ImageType {}
37973
38673
  unsafe impl TryConvertOwned for ImageType {}
37974
38674
 
37975
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
38675
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
37976
38676
  #[serde(rename_all = "snake_case")]
37977
38677
  pub enum InlineType {
37978
38678
  Text,
@@ -38025,7 +38725,14 @@ impl magnus::IntoValue for InlineType {
38025
38725
 
38026
38726
  impl magnus::TryConvert for InlineType {
38027
38727
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
38028
- let s: String = magnus::TryConvert::try_convert(val)?;
38728
+ // IntoValue emits Symbols, including when this enum is a Hash key.
38729
+ // Accept that exact representation as well as String inputs; do not
38730
+ // coerce arbitrary objects through to_s.
38731
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
38732
+ symbol.name()?.into_owned()
38733
+ } else {
38734
+ magnus::TryConvert::try_convert(val)?
38735
+ };
38029
38736
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
38030
38737
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
38031
38738
  // existing consumer code written in any of those styles keep working.
@@ -38057,7 +38764,7 @@ impl magnus::TryConvert for InlineType {
38057
38764
  unsafe impl IntoValueFromNative for InlineType {}
38058
38765
  unsafe impl TryConvertOwned for InlineType {}
38059
38766
 
38060
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
38767
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
38061
38768
  #[serde(rename_all = "lowercase")]
38062
38769
  pub enum JupyterCellRendering {
38063
38770
  Source,
@@ -38084,7 +38791,14 @@ impl magnus::IntoValue for JupyterCellRendering {
38084
38791
 
38085
38792
  impl magnus::TryConvert for JupyterCellRendering {
38086
38793
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
38087
- let s: String = magnus::TryConvert::try_convert(val)?;
38794
+ // IntoValue emits Symbols, including when this enum is a Hash key.
38795
+ // Accept that exact representation as well as String inputs; do not
38796
+ // coerce arbitrary objects through to_s.
38797
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
38798
+ symbol.name()?.into_owned()
38799
+ } else {
38800
+ magnus::TryConvert::try_convert(val)?
38801
+ };
38088
38802
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
38089
38803
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
38090
38804
  // existing consumer code written in any of those styles keep working.
@@ -38103,7 +38817,7 @@ impl magnus::TryConvert for JupyterCellRendering {
38103
38817
  unsafe impl IntoValueFromNative for JupyterCellRendering {}
38104
38818
  unsafe impl TryConvertOwned for JupyterCellRendering {}
38105
38819
 
38106
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
38820
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
38107
38821
  #[serde(rename_all = "lowercase")]
38108
38822
  pub enum KeywordAlgorithm {
38109
38823
  Yake,
@@ -38128,7 +38842,14 @@ impl magnus::IntoValue for KeywordAlgorithm {
38128
38842
 
38129
38843
  impl magnus::TryConvert for KeywordAlgorithm {
38130
38844
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
38131
- let s: String = magnus::TryConvert::try_convert(val)?;
38845
+ // IntoValue emits Symbols, including when this enum is a Hash key.
38846
+ // Accept that exact representation as well as String inputs; do not
38847
+ // coerce arbitrary objects through to_s.
38848
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
38849
+ symbol.name()?.into_owned()
38850
+ } else {
38851
+ magnus::TryConvert::try_convert(val)?
38852
+ };
38132
38853
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
38133
38854
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
38134
38855
  // existing consumer code written in any of those styles keep working.
@@ -38183,7 +38904,8 @@ impl magnus::IntoValue for LateInteractionModelType {
38183
38904
 
38184
38905
  impl magnus::TryConvert for LateInteractionModelType {
38185
38906
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
38186
- // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
38907
+ // Generated Data variants carry native DTOs, not JSON-compatible display strings.
38908
+ let class_name: Option<String> = val.class().funcall("name", ())?; // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
38187
38909
  // For unit enums or when passed as a string, fall back to string-based conversion.
38188
38910
  let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
38189
38911
  s
@@ -38215,9 +38937,10 @@ impl magnus::TryConvert for LateInteractionModelType {
38215
38937
 
38216
38938
  unsafe impl IntoValueFromNative for LateInteractionModelType {}
38217
38939
  unsafe impl TryConvertOwned for LateInteractionModelType {}
38940
+
38218
38941
  impl LateInteractionModelType {}
38219
38942
 
38220
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
38943
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
38221
38944
  #[serde(rename_all = "snake_case")]
38222
38945
  pub enum LayoutClass {
38223
38946
  Caption,
@@ -38274,7 +38997,14 @@ impl magnus::IntoValue for LayoutClass {
38274
38997
 
38275
38998
  impl magnus::TryConvert for LayoutClass {
38276
38999
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
38277
- let s: String = magnus::TryConvert::try_convert(val)?;
39000
+ // IntoValue emits Symbols, including when this enum is a Hash key.
39001
+ // Accept that exact representation as well as String inputs; do not
39002
+ // coerce arbitrary objects through to_s.
39003
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
39004
+ symbol.name()?.into_owned()
39005
+ } else {
39006
+ magnus::TryConvert::try_convert(val)?
39007
+ };
38278
39008
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
38279
39009
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
38280
39010
  // existing consumer code written in any of those styles keep working.
@@ -38308,7 +39038,7 @@ impl magnus::TryConvert for LayoutClass {
38308
39038
  unsafe impl IntoValueFromNative for LayoutClass {}
38309
39039
  unsafe impl TryConvertOwned for LayoutClass {}
38310
39040
 
38311
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
39041
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
38312
39042
  #[serde(rename_all = "snake_case")]
38313
39043
  pub enum LayoutStrategy {
38314
39044
  Always,
@@ -38333,7 +39063,14 @@ impl magnus::IntoValue for LayoutStrategy {
38333
39063
 
38334
39064
  impl magnus::TryConvert for LayoutStrategy {
38335
39065
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
38336
- let s: String = magnus::TryConvert::try_convert(val)?;
39066
+ // IntoValue emits Symbols, including when this enum is a Hash key.
39067
+ // Accept that exact representation as well as String inputs; do not
39068
+ // coerce arbitrary objects through to_s.
39069
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
39070
+ symbol.name()?.into_owned()
39071
+ } else {
39072
+ magnus::TryConvert::try_convert(val)?
39073
+ };
38337
39074
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
38338
39075
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
38339
39076
  // existing consumer code written in any of those styles keep working.
@@ -38351,7 +39088,7 @@ impl magnus::TryConvert for LayoutStrategy {
38351
39088
  unsafe impl IntoValueFromNative for LayoutStrategy {}
38352
39089
  unsafe impl TryConvertOwned for LayoutStrategy {}
38353
39090
 
38354
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
39091
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
38355
39092
  pub enum LinkStyle {
38356
39093
  Inline,
38357
39094
  Reference,
@@ -38375,7 +39112,14 @@ impl magnus::IntoValue for LinkStyle {
38375
39112
 
38376
39113
  impl magnus::TryConvert for LinkStyle {
38377
39114
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
38378
- let s: String = magnus::TryConvert::try_convert(val)?;
39115
+ // IntoValue emits Symbols, including when this enum is a Hash key.
39116
+ // Accept that exact representation as well as String inputs; do not
39117
+ // coerce arbitrary objects through to_s.
39118
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
39119
+ symbol.name()?.into_owned()
39120
+ } else {
39121
+ magnus::TryConvert::try_convert(val)?
39122
+ };
38379
39123
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
38380
39124
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
38381
39125
  // existing consumer code written in any of those styles keep working.
@@ -38393,7 +39137,7 @@ impl magnus::TryConvert for LinkStyle {
38393
39137
  unsafe impl IntoValueFromNative for LinkStyle {}
38394
39138
  unsafe impl TryConvertOwned for LinkStyle {}
38395
39139
 
38396
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
39140
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
38397
39141
  #[serde(rename_all = "lowercase")]
38398
39142
  pub enum LinkType {
38399
39143
  Anchor,
@@ -38426,7 +39170,14 @@ impl magnus::IntoValue for LinkType {
38426
39170
 
38427
39171
  impl magnus::TryConvert for LinkType {
38428
39172
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
38429
- let s: String = magnus::TryConvert::try_convert(val)?;
39173
+ // IntoValue emits Symbols, including when this enum is a Hash key.
39174
+ // Accept that exact representation as well as String inputs; do not
39175
+ // coerce arbitrary objects through to_s.
39176
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
39177
+ symbol.name()?.into_owned()
39178
+ } else {
39179
+ magnus::TryConvert::try_convert(val)?
39180
+ };
38430
39181
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
38431
39182
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
38432
39183
  // existing consumer code written in any of those styles keep working.
@@ -38448,7 +39199,7 @@ impl magnus::TryConvert for LinkType {
38448
39199
  unsafe impl IntoValueFromNative for LinkType {}
38449
39200
  unsafe impl TryConvertOwned for LinkType {}
38450
39201
 
38451
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
39202
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
38452
39203
  pub enum ListIndentType {
38453
39204
  Spaces,
38454
39205
  Tabs,
@@ -38472,7 +39223,14 @@ impl magnus::IntoValue for ListIndentType {
38472
39223
 
38473
39224
  impl magnus::TryConvert for ListIndentType {
38474
39225
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
38475
- let s: String = magnus::TryConvert::try_convert(val)?;
39226
+ // IntoValue emits Symbols, including when this enum is a Hash key.
39227
+ // Accept that exact representation as well as String inputs; do not
39228
+ // coerce arbitrary objects through to_s.
39229
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
39230
+ symbol.name()?.into_owned()
39231
+ } else {
39232
+ magnus::TryConvert::try_convert(val)?
39233
+ };
38476
39234
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
38477
39235
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
38478
39236
  // existing consumer code written in any of those styles keep working.
@@ -38490,7 +39248,7 @@ impl magnus::TryConvert for ListIndentType {
38490
39248
  unsafe impl IntoValueFromNative for ListIndentType {}
38491
39249
  unsafe impl TryConvertOwned for ListIndentType {}
38492
39250
 
38493
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
39251
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
38494
39252
  pub enum ListType {
38495
39253
  Bullet,
38496
39254
  Numbered,
@@ -38518,7 +39276,14 @@ impl magnus::IntoValue for ListType {
38518
39276
 
38519
39277
  impl magnus::TryConvert for ListType {
38520
39278
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
38521
- let s: String = magnus::TryConvert::try_convert(val)?;
39279
+ // IntoValue emits Symbols, including when this enum is a Hash key.
39280
+ // Accept that exact representation as well as String inputs; do not
39281
+ // coerce arbitrary objects through to_s.
39282
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
39283
+ symbol.name()?.into_owned()
39284
+ } else {
39285
+ magnus::TryConvert::try_convert(val)?
39286
+ };
38522
39287
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
38523
39288
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
38524
39289
  // existing consumer code written in any of those styles keep working.
@@ -38538,7 +39303,7 @@ impl magnus::TryConvert for ListType {
38538
39303
  unsafe impl IntoValueFromNative for ListType {}
38539
39304
  unsafe impl TryConvertOwned for ListType {}
38540
39305
 
38541
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
39306
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
38542
39307
  #[serde(rename_all = "snake_case")]
38543
39308
  pub enum MergeMode {
38544
39309
  ObjectMerge,
@@ -38565,7 +39330,14 @@ impl magnus::IntoValue for MergeMode {
38565
39330
 
38566
39331
  impl magnus::TryConvert for MergeMode {
38567
39332
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
38568
- let s: String = magnus::TryConvert::try_convert(val)?;
39333
+ // IntoValue emits Symbols, including when this enum is a Hash key.
39334
+ // Accept that exact representation as well as String inputs; do not
39335
+ // coerce arbitrary objects through to_s.
39336
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
39337
+ symbol.name()?.into_owned()
39338
+ } else {
39339
+ magnus::TryConvert::try_convert(val)?
39340
+ };
38569
39341
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
38570
39342
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
38571
39343
  // existing consumer code written in any of those styles keep working.
@@ -38584,7 +39356,7 @@ impl magnus::TryConvert for MergeMode {
38584
39356
  unsafe impl IntoValueFromNative for MergeMode {}
38585
39357
  unsafe impl TryConvertOwned for MergeMode {}
38586
39358
 
38587
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
39359
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
38588
39360
  #[serde(rename_all = "snake_case")]
38589
39361
  pub enum MimeDetectionPolicy {
38590
39362
  PreferContent,
@@ -38611,7 +39383,14 @@ impl magnus::IntoValue for MimeDetectionPolicy {
38611
39383
 
38612
39384
  impl magnus::TryConvert for MimeDetectionPolicy {
38613
39385
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
38614
- let s: String = magnus::TryConvert::try_convert(val)?;
39386
+ // IntoValue emits Symbols, including when this enum is a Hash key.
39387
+ // Accept that exact representation as well as String inputs; do not
39388
+ // coerce arbitrary objects through to_s.
39389
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
39390
+ symbol.name()?.into_owned()
39391
+ } else {
39392
+ magnus::TryConvert::try_convert(val)?
39393
+ };
38615
39394
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
38616
39395
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
38617
39396
  // existing consumer code written in any of those styles keep working.
@@ -38630,7 +39409,7 @@ impl magnus::TryConvert for MimeDetectionPolicy {
38630
39409
  unsafe impl IntoValueFromNative for MimeDetectionPolicy {}
38631
39410
  unsafe impl TryConvertOwned for MimeDetectionPolicy {}
38632
39411
 
38633
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
39412
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
38634
39413
  #[serde(rename_all = "snake_case")]
38635
39414
  pub enum NerBackendKind {
38636
39415
  Onnx,
@@ -38655,7 +39434,14 @@ impl magnus::IntoValue for NerBackendKind {
38655
39434
 
38656
39435
  impl magnus::TryConvert for NerBackendKind {
38657
39436
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
38658
- let s: String = magnus::TryConvert::try_convert(val)?;
39437
+ // IntoValue emits Symbols, including when this enum is a Hash key.
39438
+ // Accept that exact representation as well as String inputs; do not
39439
+ // coerce arbitrary objects through to_s.
39440
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
39441
+ symbol.name()?.into_owned()
39442
+ } else {
39443
+ magnus::TryConvert::try_convert(val)?
39444
+ };
38659
39445
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
38660
39446
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
38661
39447
  // existing consumer code written in any of those styles keep working.
@@ -38673,7 +39459,7 @@ impl magnus::TryConvert for NerBackendKind {
38673
39459
  unsafe impl IntoValueFromNative for NerBackendKind {}
38674
39460
  unsafe impl TryConvertOwned for NerBackendKind {}
38675
39461
 
38676
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
39462
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
38677
39463
  pub enum NewlineStyle {
38678
39464
  Spaces,
38679
39465
  Backslash,
@@ -38697,7 +39483,14 @@ impl magnus::IntoValue for NewlineStyle {
38697
39483
 
38698
39484
  impl magnus::TryConvert for NewlineStyle {
38699
39485
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
38700
- let s: String = magnus::TryConvert::try_convert(val)?;
39486
+ // IntoValue emits Symbols, including when this enum is a Hash key.
39487
+ // Accept that exact representation as well as String inputs; do not
39488
+ // coerce arbitrary objects through to_s.
39489
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
39490
+ symbol.name()?.into_owned()
39491
+ } else {
39492
+ magnus::TryConvert::try_convert(val)?
39493
+ };
38701
39494
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
38702
39495
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
38703
39496
  // existing consumer code written in any of those styles keep working.
@@ -38754,7 +39547,8 @@ impl magnus::IntoValue for NoChunkingReason {
38754
39547
 
38755
39548
  impl magnus::TryConvert for NoChunkingReason {
38756
39549
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
38757
- // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
39550
+ // Generated Data variants carry native DTOs, not JSON-compatible display strings.
39551
+ let class_name: Option<String> = val.class().funcall("name", ())?; // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
38758
39552
  // For unit enums or when passed as a string, fall back to string-based conversion.
38759
39553
  let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
38760
39554
  s
@@ -38786,6 +39580,7 @@ impl magnus::TryConvert for NoChunkingReason {
38786
39580
 
38787
39581
  unsafe impl IntoValueFromNative for NoChunkingReason {}
38788
39582
  unsafe impl TryConvertOwned for NoChunkingReason {}
39583
+
38789
39584
  impl NoChunkingReason {}
38790
39585
 
38791
39586
  #[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
@@ -38881,7 +39676,8 @@ impl magnus::IntoValue for NodeContent {
38881
39676
 
38882
39677
  impl magnus::TryConvert for NodeContent {
38883
39678
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
38884
- // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
39679
+ // Generated Data variants carry native DTOs, not JSON-compatible display strings.
39680
+ let class_name: Option<String> = val.class().funcall("name", ())?; // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
38885
39681
  // For unit enums or when passed as a string, fall back to string-based conversion.
38886
39682
  let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
38887
39683
  s
@@ -38913,9 +39709,10 @@ impl magnus::TryConvert for NodeContent {
38913
39709
 
38914
39710
  unsafe impl IntoValueFromNative for NodeContent {}
38915
39711
  unsafe impl TryConvertOwned for NodeContent {}
39712
+
38916
39713
  impl NodeContent {}
38917
39714
 
38918
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
39715
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
38919
39716
  pub enum OcrBackendType {
38920
39717
  Tesseract,
38921
39718
  PaddleOCR,
@@ -38943,7 +39740,14 @@ impl magnus::IntoValue for OcrBackendType {
38943
39740
 
38944
39741
  impl magnus::TryConvert for OcrBackendType {
38945
39742
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
38946
- let s: String = magnus::TryConvert::try_convert(val)?;
39743
+ // IntoValue emits Symbols, including when this enum is a Hash key.
39744
+ // Accept that exact representation as well as String inputs; do not
39745
+ // coerce arbitrary objects through to_s.
39746
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
39747
+ symbol.name()?.into_owned()
39748
+ } else {
39749
+ magnus::TryConvert::try_convert(val)?
39750
+ };
38947
39751
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
38948
39752
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
38949
39753
  // existing consumer code written in any of those styles keep working.
@@ -39000,7 +39804,8 @@ impl magnus::IntoValue for OcrBoundingGeometry {
39000
39804
 
39001
39805
  impl magnus::TryConvert for OcrBoundingGeometry {
39002
39806
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
39003
- // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
39807
+ // Generated Data variants carry native DTOs, not JSON-compatible display strings.
39808
+ let class_name: Option<String> = val.class().funcall("name", ())?; // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
39004
39809
  // For unit enums or when passed as a string, fall back to string-based conversion.
39005
39810
  let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
39006
39811
  s
@@ -39032,9 +39837,10 @@ impl magnus::TryConvert for OcrBoundingGeometry {
39032
39837
 
39033
39838
  unsafe impl IntoValueFromNative for OcrBoundingGeometry {}
39034
39839
  unsafe impl TryConvertOwned for OcrBoundingGeometry {}
39840
+
39035
39841
  impl OcrBoundingGeometry {}
39036
39842
 
39037
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
39843
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
39038
39844
  #[serde(rename_all = "snake_case")]
39039
39845
  pub enum OcrElementLevel {
39040
39846
  Word,
@@ -39063,7 +39869,14 @@ impl magnus::IntoValue for OcrElementLevel {
39063
39869
 
39064
39870
  impl magnus::TryConvert for OcrElementLevel {
39065
39871
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
39066
- let s: String = magnus::TryConvert::try_convert(val)?;
39872
+ // IntoValue emits Symbols, including when this enum is a Hash key.
39873
+ // Accept that exact representation as well as String inputs; do not
39874
+ // coerce arbitrary objects through to_s.
39875
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
39876
+ symbol.name()?.into_owned()
39877
+ } else {
39878
+ magnus::TryConvert::try_convert(val)?
39879
+ };
39067
39880
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
39068
39881
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
39069
39882
  // existing consumer code written in any of those styles keep working.
@@ -39108,7 +39921,8 @@ impl magnus::IntoValue for OcrStrategy {
39108
39921
 
39109
39922
  impl magnus::TryConvert for OcrStrategy {
39110
39923
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
39111
- // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
39924
+ // Generated Data variants carry native DTOs, not JSON-compatible display strings.
39925
+ let class_name: Option<String> = val.class().funcall("name", ())?; // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
39112
39926
  // For unit enums or when passed as a string, fall back to string-based conversion.
39113
39927
  let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
39114
39928
  s
@@ -39140,6 +39954,7 @@ impl magnus::TryConvert for OcrStrategy {
39140
39954
 
39141
39955
  unsafe impl IntoValueFromNative for OcrStrategy {}
39142
39956
  unsafe impl TryConvertOwned for OcrStrategy {}
39957
+
39143
39958
  impl OcrStrategy {}
39144
39959
 
39145
39960
  #[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
@@ -39203,7 +40018,7 @@ impl magnus::TryConvert for OutputFormat {
39203
40018
  unsafe impl IntoValueFromNative for OutputFormat {}
39204
40019
  unsafe impl TryConvertOwned for OutputFormat {}
39205
40020
 
39206
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
40021
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
39207
40022
  pub enum PSMMode {
39208
40023
  OsdOnly,
39209
40024
  AutoOsd,
@@ -39245,7 +40060,14 @@ impl magnus::IntoValue for PSMMode {
39245
40060
 
39246
40061
  impl magnus::TryConvert for PSMMode {
39247
40062
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
39248
- let s: String = magnus::TryConvert::try_convert(val)?;
40063
+ // IntoValue emits Symbols, including when this enum is a Hash key.
40064
+ // Accept that exact representation as well as String inputs; do not
40065
+ // coerce arbitrary objects through to_s.
40066
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
40067
+ symbol.name()?.into_owned()
40068
+ } else {
40069
+ magnus::TryConvert::try_convert(val)?
40070
+ };
39249
40071
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
39250
40072
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
39251
40073
  // existing consumer code written in any of those styles keep working.
@@ -39272,7 +40094,7 @@ impl magnus::TryConvert for PSMMode {
39272
40094
  unsafe impl IntoValueFromNative for PSMMode {}
39273
40095
  unsafe impl TryConvertOwned for PSMMode {}
39274
40096
 
39275
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
40097
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
39276
40098
  #[serde(rename_all = "snake_case")]
39277
40099
  pub enum PaddleInferenceBackend {
39278
40100
  Ort,
@@ -39297,7 +40119,14 @@ impl magnus::IntoValue for PaddleInferenceBackend {
39297
40119
 
39298
40120
  impl magnus::TryConvert for PaddleInferenceBackend {
39299
40121
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
39300
- let s: String = magnus::TryConvert::try_convert(val)?;
40122
+ // IntoValue emits Symbols, including when this enum is a Hash key.
40123
+ // Accept that exact representation as well as String inputs; do not
40124
+ // coerce arbitrary objects through to_s.
40125
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
40126
+ symbol.name()?.into_owned()
40127
+ } else {
40128
+ magnus::TryConvert::try_convert(val)?
40129
+ };
39301
40130
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
39302
40131
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
39303
40132
  // existing consumer code written in any of those styles keep working.
@@ -39315,7 +40144,7 @@ impl magnus::TryConvert for PaddleInferenceBackend {
39315
40144
  unsafe impl IntoValueFromNative for PaddleInferenceBackend {}
39316
40145
  unsafe impl TryConvertOwned for PaddleInferenceBackend {}
39317
40146
 
39318
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
40147
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
39319
40148
  pub enum PaddleLanguage {
39320
40149
  English,
39321
40150
  Chinese,
@@ -39367,7 +40196,14 @@ impl magnus::IntoValue for PaddleLanguage {
39367
40196
 
39368
40197
  impl magnus::TryConvert for PaddleLanguage {
39369
40198
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
39370
- let s: String = magnus::TryConvert::try_convert(val)?;
40199
+ // IntoValue emits Symbols, including when this enum is a Hash key.
40200
+ // Accept that exact representation as well as String inputs; do not
40201
+ // coerce arbitrary objects through to_s.
40202
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
40203
+ symbol.name()?.into_owned()
40204
+ } else {
40205
+ magnus::TryConvert::try_convert(val)?
40206
+ };
39371
40207
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
39372
40208
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
39373
40209
  // existing consumer code written in any of those styles keep working.
@@ -39399,7 +40235,7 @@ impl magnus::TryConvert for PaddleLanguage {
39399
40235
  unsafe impl IntoValueFromNative for PaddleLanguage {}
39400
40236
  unsafe impl TryConvertOwned for PaddleLanguage {}
39401
40237
 
39402
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
40238
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
39403
40239
  #[serde(rename_all = "lowercase")]
39404
40240
  pub enum PaddleOcrVlTaskKind {
39405
40241
  Ocr,
@@ -39428,7 +40264,14 @@ impl magnus::IntoValue for PaddleOcrVlTaskKind {
39428
40264
 
39429
40265
  impl magnus::TryConvert for PaddleOcrVlTaskKind {
39430
40266
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
39431
- let s: String = magnus::TryConvert::try_convert(val)?;
40267
+ // IntoValue emits Symbols, including when this enum is a Hash key.
40268
+ // Accept that exact representation as well as String inputs; do not
40269
+ // coerce arbitrary objects through to_s.
40270
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
40271
+ symbol.name()?.into_owned()
40272
+ } else {
40273
+ magnus::TryConvert::try_convert(val)?
40274
+ };
39432
40275
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
39433
40276
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
39434
40277
  // existing consumer code written in any of those styles keep working.
@@ -39448,7 +40291,7 @@ impl magnus::TryConvert for PaddleOcrVlTaskKind {
39448
40291
  unsafe impl IntoValueFromNative for PaddleOcrVlTaskKind {}
39449
40292
  unsafe impl TryConvertOwned for PaddleOcrVlTaskKind {}
39450
40293
 
39451
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
40294
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
39452
40295
  pub enum PageOrientationHandling {
39453
40296
  SelfCorrecting,
39454
40297
  RecognisesRotatedText,
@@ -39474,7 +40317,14 @@ impl magnus::IntoValue for PageOrientationHandling {
39474
40317
 
39475
40318
  impl magnus::TryConvert for PageOrientationHandling {
39476
40319
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
39477
- let s: String = magnus::TryConvert::try_convert(val)?;
40320
+ // IntoValue emits Symbols, including when this enum is a Hash key.
40321
+ // Accept that exact representation as well as String inputs; do not
40322
+ // coerce arbitrary objects through to_s.
40323
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
40324
+ symbol.name()?.into_owned()
40325
+ } else {
40326
+ magnus::TryConvert::try_convert(val)?
40327
+ };
39478
40328
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
39479
40329
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
39480
40330
  // existing consumer code written in any of those styles keep working.
@@ -39493,7 +40343,7 @@ impl magnus::TryConvert for PageOrientationHandling {
39493
40343
  unsafe impl IntoValueFromNative for PageOrientationHandling {}
39494
40344
  unsafe impl TryConvertOwned for PageOrientationHandling {}
39495
40345
 
39496
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
40346
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
39497
40347
  #[serde(rename_all = "snake_case")]
39498
40348
  pub enum PageUnitType {
39499
40349
  Page,
@@ -39520,7 +40370,14 @@ impl magnus::IntoValue for PageUnitType {
39520
40370
 
39521
40371
  impl magnus::TryConvert for PageUnitType {
39522
40372
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
39523
- let s: String = magnus::TryConvert::try_convert(val)?;
40373
+ // IntoValue emits Symbols, including when this enum is a Hash key.
40374
+ // Accept that exact representation as well as String inputs; do not
40375
+ // coerce arbitrary objects through to_s.
40376
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
40377
+ symbol.name()?.into_owned()
40378
+ } else {
40379
+ magnus::TryConvert::try_convert(val)?
40380
+ };
39524
40381
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
39525
40382
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
39526
40383
  // existing consumer code written in any of those styles keep working.
@@ -39539,7 +40396,7 @@ impl magnus::TryConvert for PageUnitType {
39539
40396
  unsafe impl IntoValueFromNative for PageUnitType {}
39540
40397
  unsafe impl TryConvertOwned for PageUnitType {}
39541
40398
 
39542
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
40399
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
39543
40400
  #[serde(rename_all = "snake_case")]
39544
40401
  pub enum PdfAnnotationType {
39545
40402
  Text,
@@ -39596,7 +40453,14 @@ impl magnus::IntoValue for PdfAnnotationType {
39596
40453
 
39597
40454
  impl magnus::TryConvert for PdfAnnotationType {
39598
40455
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
39599
- let s: String = magnus::TryConvert::try_convert(val)?;
40456
+ // IntoValue emits Symbols, including when this enum is a Hash key.
40457
+ // Accept that exact representation as well as String inputs; do not
40458
+ // coerce arbitrary objects through to_s.
40459
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
40460
+ symbol.name()?.into_owned()
40461
+ } else {
40462
+ magnus::TryConvert::try_convert(val)?
40463
+ };
39600
40464
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
39601
40465
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
39602
40466
  // existing consumer code written in any of those styles keep working.
@@ -39630,7 +40494,7 @@ impl magnus::TryConvert for PdfAnnotationType {
39630
40494
  unsafe impl IntoValueFromNative for PdfAnnotationType {}
39631
40495
  unsafe impl TryConvertOwned for PdfAnnotationType {}
39632
40496
 
39633
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
40497
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
39634
40498
  #[serde(rename_all = "snake_case")]
39635
40499
  pub enum PdfBackend {
39636
40500
  Native,
@@ -39655,7 +40519,14 @@ impl magnus::IntoValue for PdfBackend {
39655
40519
 
39656
40520
  impl magnus::TryConvert for PdfBackend {
39657
40521
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
39658
- let s: String = magnus::TryConvert::try_convert(val)?;
40522
+ // IntoValue emits Symbols, including when this enum is a Hash key.
40523
+ // Accept that exact representation as well as String inputs; do not
40524
+ // coerce arbitrary objects through to_s.
40525
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
40526
+ symbol.name()?.into_owned()
40527
+ } else {
40528
+ magnus::TryConvert::try_convert(val)?
40529
+ };
39659
40530
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
39660
40531
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
39661
40532
  // existing consumer code written in any of those styles keep working.
@@ -39740,7 +40611,7 @@ impl magnus::TryConvert for PiiCategory {
39740
40611
  unsafe impl IntoValueFromNative for PiiCategory {}
39741
40612
  unsafe impl TryConvertOwned for PiiCategory {}
39742
40613
 
39743
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
40614
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
39744
40615
  pub enum PreprocessingPreset {
39745
40616
  Minimal,
39746
40617
  Standard,
@@ -39766,7 +40637,14 @@ impl magnus::IntoValue for PreprocessingPreset {
39766
40637
 
39767
40638
  impl magnus::TryConvert for PreprocessingPreset {
39768
40639
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
39769
- let s: String = magnus::TryConvert::try_convert(val)?;
40640
+ // IntoValue emits Symbols, including when this enum is a Hash key.
40641
+ // Accept that exact representation as well as String inputs; do not
40642
+ // coerce arbitrary objects through to_s.
40643
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
40644
+ symbol.name()?.into_owned()
40645
+ } else {
40646
+ magnus::TryConvert::try_convert(val)?
40647
+ };
39770
40648
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
39771
40649
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
39772
40650
  // existing consumer code written in any of those styles keep working.
@@ -39785,7 +40663,7 @@ impl magnus::TryConvert for PreprocessingPreset {
39785
40663
  unsafe impl IntoValueFromNative for PreprocessingPreset {}
39786
40664
  unsafe impl TryConvertOwned for PreprocessingPreset {}
39787
40665
 
39788
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
40666
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
39789
40667
  #[serde(rename_all = "snake_case")]
39790
40668
  pub enum PresetCategory {
39791
40669
  Finance,
@@ -39820,7 +40698,14 @@ impl magnus::IntoValue for PresetCategory {
39820
40698
 
39821
40699
  impl magnus::TryConvert for PresetCategory {
39822
40700
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
39823
- let s: String = magnus::TryConvert::try_convert(val)?;
40701
+ // IntoValue emits Symbols, including when this enum is a Hash key.
40702
+ // Accept that exact representation as well as String inputs; do not
40703
+ // coerce arbitrary objects through to_s.
40704
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
40705
+ symbol.name()?.into_owned()
40706
+ } else {
40707
+ magnus::TryConvert::try_convert(val)?
40708
+ };
39824
40709
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
39825
40710
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
39826
40711
  // existing consumer code written in any of those styles keep working.
@@ -39843,7 +40728,7 @@ impl magnus::TryConvert for PresetCategory {
39843
40728
  unsafe impl IntoValueFromNative for PresetCategory {}
39844
40729
  unsafe impl TryConvertOwned for PresetCategory {}
39845
40730
 
39846
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
40731
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
39847
40732
  #[serde(rename_all = "lowercase")]
39848
40733
  pub enum ProbeStatus {
39849
40734
  Pass,
@@ -39872,7 +40757,14 @@ impl magnus::IntoValue for ProbeStatus {
39872
40757
 
39873
40758
  impl magnus::TryConvert for ProbeStatus {
39874
40759
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
39875
- let s: String = magnus::TryConvert::try_convert(val)?;
40760
+ // IntoValue emits Symbols, including when this enum is a Hash key.
40761
+ // Accept that exact representation as well as String inputs; do not
40762
+ // coerce arbitrary objects through to_s.
40763
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
40764
+ symbol.name()?.into_owned()
40765
+ } else {
40766
+ magnus::TryConvert::try_convert(val)?
40767
+ };
39876
40768
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
39877
40769
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
39878
40770
  // existing consumer code written in any of those styles keep working.
@@ -39892,7 +40784,7 @@ impl magnus::TryConvert for ProbeStatus {
39892
40784
  unsafe impl IntoValueFromNative for ProbeStatus {}
39893
40785
  unsafe impl TryConvertOwned for ProbeStatus {}
39894
40786
 
39895
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
40787
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
39896
40788
  pub enum ProcessingStage {
39897
40789
  Early,
39898
40790
  Middle,
@@ -39918,7 +40810,14 @@ impl magnus::IntoValue for ProcessingStage {
39918
40810
 
39919
40811
  impl magnus::TryConvert for ProcessingStage {
39920
40812
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
39921
- let s: String = magnus::TryConvert::try_convert(val)?;
40813
+ // IntoValue emits Symbols, including when this enum is a Hash key.
40814
+ // Accept that exact representation as well as String inputs; do not
40815
+ // coerce arbitrary objects through to_s.
40816
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
40817
+ symbol.name()?.into_owned()
40818
+ } else {
40819
+ magnus::TryConvert::try_convert(val)?
40820
+ };
39922
40821
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
39923
40822
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
39924
40823
  // existing consumer code written in any of those styles keep working.
@@ -39937,7 +40836,7 @@ impl magnus::TryConvert for ProcessingStage {
39937
40836
  unsafe impl IntoValueFromNative for ProcessingStage {}
39938
40837
  unsafe impl TryConvertOwned for ProcessingStage {}
39939
40838
 
39940
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
40839
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
39941
40840
  #[serde(rename_all = "snake_case")]
39942
40841
  pub enum RedactionStrategy {
39943
40842
  Mask,
@@ -39966,7 +40865,14 @@ impl magnus::IntoValue for RedactionStrategy {
39966
40865
 
39967
40866
  impl magnus::TryConvert for RedactionStrategy {
39968
40867
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
39969
- let s: String = magnus::TryConvert::try_convert(val)?;
40868
+ // IntoValue emits Symbols, including when this enum is a Hash key.
40869
+ // Accept that exact representation as well as String inputs; do not
40870
+ // coerce arbitrary objects through to_s.
40871
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
40872
+ symbol.name()?.into_owned()
40873
+ } else {
40874
+ magnus::TryConvert::try_convert(val)?
40875
+ };
39970
40876
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
39971
40877
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
39972
40878
  // existing consumer code written in any of those styles keep working.
@@ -39986,7 +40892,7 @@ impl magnus::TryConvert for RedactionStrategy {
39986
40892
  unsafe impl IntoValueFromNative for RedactionStrategy {}
39987
40893
  unsafe impl TryConvertOwned for RedactionStrategy {}
39988
40894
 
39989
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
40895
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
39990
40896
  pub enum ReductionLevel {
39991
40897
  Off,
39992
40898
  Light,
@@ -40016,7 +40922,14 @@ impl magnus::IntoValue for ReductionLevel {
40016
40922
 
40017
40923
  impl magnus::TryConvert for ReductionLevel {
40018
40924
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
40019
- let s: String = magnus::TryConvert::try_convert(val)?;
40925
+ // IntoValue emits Symbols, including when this enum is a Hash key.
40926
+ // Accept that exact representation as well as String inputs; do not
40927
+ // coerce arbitrary objects through to_s.
40928
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
40929
+ symbol.name()?.into_owned()
40930
+ } else {
40931
+ magnus::TryConvert::try_convert(val)?
40932
+ };
40020
40933
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
40021
40934
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
40022
40935
  // existing consumer code written in any of those styles keep working.
@@ -40037,7 +40950,7 @@ impl magnus::TryConvert for ReductionLevel {
40037
40950
  unsafe impl IntoValueFromNative for ReductionLevel {}
40038
40951
  unsafe impl TryConvertOwned for ReductionLevel {}
40039
40952
 
40040
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
40953
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
40041
40954
  pub enum RegionKind {
40042
40955
  Figure,
40043
40956
  DenseTable,
@@ -40065,7 +40978,14 @@ impl magnus::IntoValue for RegionKind {
40065
40978
 
40066
40979
  impl magnus::TryConvert for RegionKind {
40067
40980
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
40068
- let s: String = magnus::TryConvert::try_convert(val)?;
40981
+ // IntoValue emits Symbols, including when this enum is a Hash key.
40982
+ // Accept that exact representation as well as String inputs; do not
40983
+ // coerce arbitrary objects through to_s.
40984
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
40985
+ symbol.name()?.into_owned()
40986
+ } else {
40987
+ magnus::TryConvert::try_convert(val)?
40988
+ };
40069
40989
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
40070
40990
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
40071
40991
  // existing consumer code written in any of those styles keep working.
@@ -40085,7 +41005,7 @@ impl magnus::TryConvert for RegionKind {
40085
41005
  unsafe impl IntoValueFromNative for RegionKind {}
40086
41006
  unsafe impl TryConvertOwned for RegionKind {}
40087
41007
 
40088
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
41008
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
40089
41009
  #[serde(rename_all = "snake_case")]
40090
41010
  pub enum RelationshipKind {
40091
41011
  FootnoteReference,
@@ -40120,7 +41040,14 @@ impl magnus::IntoValue for RelationshipKind {
40120
41040
 
40121
41041
  impl magnus::TryConvert for RelationshipKind {
40122
41042
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
40123
- let s: String = magnus::TryConvert::try_convert(val)?;
41043
+ // IntoValue emits Symbols, including when this enum is a Hash key.
41044
+ // Accept that exact representation as well as String inputs; do not
41045
+ // coerce arbitrary objects through to_s.
41046
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
41047
+ symbol.name()?.into_owned()
41048
+ } else {
41049
+ magnus::TryConvert::try_convert(val)?
41050
+ };
40124
41051
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
40125
41052
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
40126
41053
  // existing consumer code written in any of those styles keep working.
@@ -40143,7 +41070,7 @@ impl magnus::TryConvert for RelationshipKind {
40143
41070
  unsafe impl IntoValueFromNative for RelationshipKind {}
40144
41071
  unsafe impl TryConvertOwned for RelationshipKind {}
40145
41072
 
40146
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
41073
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
40147
41074
  #[serde(rename_all = "snake_case")]
40148
41075
  pub enum RerankerHead {
40149
41076
  CrossEncoder,
@@ -40168,7 +41095,14 @@ impl magnus::IntoValue for RerankerHead {
40168
41095
 
40169
41096
  impl magnus::TryConvert for RerankerHead {
40170
41097
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
40171
- let s: String = magnus::TryConvert::try_convert(val)?;
41098
+ // IntoValue emits Symbols, including when this enum is a Hash key.
41099
+ // Accept that exact representation as well as String inputs; do not
41100
+ // coerce arbitrary objects through to_s.
41101
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
41102
+ symbol.name()?.into_owned()
41103
+ } else {
41104
+ magnus::TryConvert::try_convert(val)?
41105
+ };
40172
41106
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
40173
41107
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
40174
41108
  // existing consumer code written in any of those styles keep working.
@@ -40201,7 +41135,7 @@ pub enum RerankerModelType {
40201
41135
  head: RerankerHead,
40202
41136
  },
40203
41137
  Llm {
40204
- llm: LlmConfig,
41138
+ llm: Box<LlmConfig>,
40205
41139
  },
40206
41140
  Plugin {
40207
41141
  name: String,
@@ -40227,7 +41161,8 @@ impl magnus::IntoValue for RerankerModelType {
40227
41161
 
40228
41162
  impl magnus::TryConvert for RerankerModelType {
40229
41163
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
40230
- // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
41164
+ // Generated Data variants carry native DTOs, not JSON-compatible display strings.
41165
+ let class_name: Option<String> = val.class().funcall("name", ())?; // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
40231
41166
  // For unit enums or when passed as a string, fall back to string-based conversion.
40232
41167
  let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
40233
41168
  s
@@ -40259,9 +41194,10 @@ impl magnus::TryConvert for RerankerModelType {
40259
41194
 
40260
41195
  unsafe impl IntoValueFromNative for RerankerModelType {}
40261
41196
  unsafe impl TryConvertOwned for RerankerModelType {}
41197
+
40262
41198
  impl RerankerModelType {}
40263
41199
 
40264
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
41200
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
40265
41201
  #[serde(rename_all = "snake_case")]
40266
41202
  pub enum ResultFormat {
40267
41203
  Unified,
@@ -40286,7 +41222,14 @@ impl magnus::IntoValue for ResultFormat {
40286
41222
 
40287
41223
  impl magnus::TryConvert for ResultFormat {
40288
41224
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
40289
- let s: String = magnus::TryConvert::try_convert(val)?;
41225
+ // IntoValue emits Symbols, including when this enum is a Hash key.
41226
+ // Accept that exact representation as well as String inputs; do not
41227
+ // coerce arbitrary objects through to_s.
41228
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
41229
+ symbol.name()?.into_owned()
41230
+ } else {
41231
+ magnus::TryConvert::try_convert(val)?
41232
+ };
40290
41233
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
40291
41234
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
40292
41235
  // existing consumer code written in any of those styles keep working.
@@ -40334,7 +41277,8 @@ impl magnus::IntoValue for RevisionAnchor {
40334
41277
 
40335
41278
  impl magnus::TryConvert for RevisionAnchor {
40336
41279
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
40337
- // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
41280
+ // Generated Data variants carry native DTOs, not JSON-compatible display strings.
41281
+ let class_name: Option<String> = val.class().funcall("name", ())?; // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
40338
41282
  // For unit enums or when passed as a string, fall back to string-based conversion.
40339
41283
  let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
40340
41284
  s
@@ -40366,9 +41310,10 @@ impl magnus::TryConvert for RevisionAnchor {
40366
41310
 
40367
41311
  unsafe impl IntoValueFromNative for RevisionAnchor {}
40368
41312
  unsafe impl TryConvertOwned for RevisionAnchor {}
41313
+
40369
41314
  impl RevisionAnchor {}
40370
41315
 
40371
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
41316
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
40372
41317
  #[serde(rename_all = "snake_case")]
40373
41318
  pub enum RevisionKind {
40374
41319
  Insertion,
@@ -40397,7 +41342,14 @@ impl magnus::IntoValue for RevisionKind {
40397
41342
 
40398
41343
  impl magnus::TryConvert for RevisionKind {
40399
41344
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
40400
- let s: String = magnus::TryConvert::try_convert(val)?;
41345
+ // IntoValue emits Symbols, including when this enum is a Hash key.
41346
+ // Accept that exact representation as well as String inputs; do not
41347
+ // coerce arbitrary objects through to_s.
41348
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
41349
+ symbol.name()?.into_owned()
41350
+ } else {
41351
+ magnus::TryConvert::try_convert(val)?
41352
+ };
40401
41353
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
40402
41354
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
40403
41355
  // existing consumer code written in any of those styles keep working.
@@ -40417,7 +41369,7 @@ impl magnus::TryConvert for RevisionKind {
40417
41369
  unsafe impl IntoValueFromNative for RevisionKind {}
40418
41370
  unsafe impl TryConvertOwned for RevisionKind {}
40419
41371
 
40420
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
41372
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
40421
41373
  #[serde(rename_all = "snake_case")]
40422
41374
  pub enum SchemaCompliance {
40423
41375
  AllValid,
@@ -40444,7 +41396,14 @@ impl magnus::IntoValue for SchemaCompliance {
40444
41396
 
40445
41397
  impl magnus::TryConvert for SchemaCompliance {
40446
41398
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
40447
- let s: String = magnus::TryConvert::try_convert(val)?;
41399
+ // IntoValue emits Symbols, including when this enum is a Hash key.
41400
+ // Accept that exact representation as well as String inputs; do not
41401
+ // coerce arbitrary objects through to_s.
41402
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
41403
+ symbol.name()?.into_owned()
41404
+ } else {
41405
+ magnus::TryConvert::try_convert(val)?
41406
+ };
40448
41407
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
40449
41408
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
40450
41409
  // existing consumer code written in any of those styles keep working.
@@ -40500,7 +41459,8 @@ impl magnus::IntoValue for SparseEmbeddingModelType {
40500
41459
 
40501
41460
  impl magnus::TryConvert for SparseEmbeddingModelType {
40502
41461
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
40503
- // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
41462
+ // Generated Data variants carry native DTOs, not JSON-compatible display strings.
41463
+ let class_name: Option<String> = val.class().funcall("name", ())?; // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
40504
41464
  // For unit enums or when passed as a string, fall back to string-based conversion.
40505
41465
  let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
40506
41466
  s
@@ -40532,9 +41492,10 @@ impl magnus::TryConvert for SparseEmbeddingModelType {
40532
41492
 
40533
41493
  unsafe impl IntoValueFromNative for SparseEmbeddingModelType {}
40534
41494
  unsafe impl TryConvertOwned for SparseEmbeddingModelType {}
41495
+
40535
41496
  impl SparseEmbeddingModelType {}
40536
41497
 
40537
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
41498
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
40538
41499
  #[serde(rename_all = "lowercase")]
40539
41500
  pub enum StructuredDataType {
40540
41501
  #[serde(rename = "json-ld")]
@@ -40563,7 +41524,14 @@ impl magnus::IntoValue for StructuredDataType {
40563
41524
 
40564
41525
  impl magnus::TryConvert for StructuredDataType {
40565
41526
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
40566
- let s: String = magnus::TryConvert::try_convert(val)?;
41527
+ // IntoValue emits Symbols, including when this enum is a Hash key.
41528
+ // Accept that exact representation as well as String inputs; do not
41529
+ // coerce arbitrary objects through to_s.
41530
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
41531
+ symbol.name()?.into_owned()
41532
+ } else {
41533
+ magnus::TryConvert::try_convert(val)?
41534
+ };
40567
41535
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
40568
41536
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
40569
41537
  // existing consumer code written in any of those styles keep working.
@@ -40582,7 +41550,7 @@ impl magnus::TryConvert for StructuredDataType {
40582
41550
  unsafe impl IntoValueFromNative for StructuredDataType {}
40583
41551
  unsafe impl TryConvertOwned for StructuredDataType {}
40584
41552
 
40585
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
41553
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
40586
41554
  #[serde(rename_all = "snake_case")]
40587
41555
  pub enum SummaryStrategy {
40588
41556
  Extractive,
@@ -40607,7 +41575,14 @@ impl magnus::IntoValue for SummaryStrategy {
40607
41575
 
40608
41576
  impl magnus::TryConvert for SummaryStrategy {
40609
41577
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
40610
- let s: String = magnus::TryConvert::try_convert(val)?;
41578
+ // IntoValue emits Symbols, including when this enum is a Hash key.
41579
+ // Accept that exact representation as well as String inputs; do not
41580
+ // coerce arbitrary objects through to_s.
41581
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
41582
+ symbol.name()?.into_owned()
41583
+ } else {
41584
+ magnus::TryConvert::try_convert(val)?
41585
+ };
40611
41586
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
40612
41587
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
40613
41588
  // existing consumer code written in any of those styles keep working.
@@ -40625,7 +41600,7 @@ impl magnus::TryConvert for SummaryStrategy {
40625
41600
  unsafe impl IntoValueFromNative for SummaryStrategy {}
40626
41601
  unsafe impl TryConvertOwned for SummaryStrategy {}
40627
41602
 
40628
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
41603
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
40629
41604
  #[serde(rename_all = "snake_case")]
40630
41605
  pub enum TableChunkingMode {
40631
41606
  Split,
@@ -40650,7 +41625,14 @@ impl magnus::IntoValue for TableChunkingMode {
40650
41625
 
40651
41626
  impl magnus::TryConvert for TableChunkingMode {
40652
41627
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
40653
- let s: String = magnus::TryConvert::try_convert(val)?;
41628
+ // IntoValue emits Symbols, including when this enum is a Hash key.
41629
+ // Accept that exact representation as well as String inputs; do not
41630
+ // coerce arbitrary objects through to_s.
41631
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
41632
+ symbol.name()?.into_owned()
41633
+ } else {
41634
+ magnus::TryConvert::try_convert(val)?
41635
+ };
40654
41636
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
40655
41637
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
40656
41638
  // existing consumer code written in any of those styles keep working.
@@ -40668,7 +41650,7 @@ impl magnus::TryConvert for TableChunkingMode {
40668
41650
  unsafe impl IntoValueFromNative for TableChunkingMode {}
40669
41651
  unsafe impl TryConvertOwned for TableChunkingMode {}
40670
41652
 
40671
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
41653
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
40672
41654
  #[serde(rename_all = "snake_case")]
40673
41655
  pub enum TableModel {
40674
41656
  Tatr,
@@ -40701,7 +41683,14 @@ impl magnus::IntoValue for TableModel {
40701
41683
 
40702
41684
  impl magnus::TryConvert for TableModel {
40703
41685
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
40704
- let s: String = magnus::TryConvert::try_convert(val)?;
41686
+ // IntoValue emits Symbols, including when this enum is a Hash key.
41687
+ // Accept that exact representation as well as String inputs; do not
41688
+ // coerce arbitrary objects through to_s.
41689
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
41690
+ symbol.name()?.into_owned()
41691
+ } else {
41692
+ magnus::TryConvert::try_convert(val)?
41693
+ };
40705
41694
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
40706
41695
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
40707
41696
  // existing consumer code written in any of those styles keep working.
@@ -40723,7 +41712,7 @@ impl magnus::TryConvert for TableModel {
40723
41712
  unsafe impl IntoValueFromNative for TableModel {}
40724
41713
  unsafe impl TryConvertOwned for TableModel {}
40725
41714
 
40726
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
41715
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
40727
41716
  #[serde(rename_all = "snake_case")]
40728
41717
  pub enum TableOverlapPreference {
40729
41718
  Content,
@@ -40750,7 +41739,14 @@ impl magnus::IntoValue for TableOverlapPreference {
40750
41739
 
40751
41740
  impl magnus::TryConvert for TableOverlapPreference {
40752
41741
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
40753
- let s: String = magnus::TryConvert::try_convert(val)?;
41742
+ // IntoValue emits Symbols, including when this enum is a Hash key.
41743
+ // Accept that exact representation as well as String inputs; do not
41744
+ // coerce arbitrary objects through to_s.
41745
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
41746
+ symbol.name()?.into_owned()
41747
+ } else {
41748
+ magnus::TryConvert::try_convert(val)?
41749
+ };
40754
41750
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
40755
41751
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
40756
41752
  // existing consumer code written in any of those styles keep working.
@@ -40769,7 +41765,7 @@ impl magnus::TryConvert for TableOverlapPreference {
40769
41765
  unsafe impl IntoValueFromNative for TableOverlapPreference {}
40770
41766
  unsafe impl TryConvertOwned for TableOverlapPreference {}
40771
41767
 
40772
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
41768
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
40773
41769
  #[serde(rename_all = "lowercase")]
40774
41770
  pub enum TextDirection {
40775
41771
  #[serde(rename = "ltr")]
@@ -40799,7 +41795,14 @@ impl magnus::IntoValue for TextDirection {
40799
41795
 
40800
41796
  impl magnus::TryConvert for TextDirection {
40801
41797
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
40802
- let s: String = magnus::TryConvert::try_convert(val)?;
41798
+ // IntoValue emits Symbols, including when this enum is a Hash key.
41799
+ // Accept that exact representation as well as String inputs; do not
41800
+ // coerce arbitrary objects through to_s.
41801
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
41802
+ symbol.name()?.into_owned()
41803
+ } else {
41804
+ magnus::TryConvert::try_convert(val)?
41805
+ };
40803
41806
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
40804
41807
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
40805
41808
  // existing consumer code written in any of those styles keep working.
@@ -40818,7 +41821,7 @@ impl magnus::TryConvert for TextDirection {
40818
41821
  unsafe impl IntoValueFromNative for TextDirection {}
40819
41822
  unsafe impl TryConvertOwned for TextDirection {}
40820
41823
 
40821
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
41824
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
40822
41825
  #[serde(rename_all = "snake_case")]
40823
41826
  pub enum TierStrategy {
40824
41827
  Auto,
@@ -40843,7 +41846,14 @@ impl magnus::IntoValue for TierStrategy {
40843
41846
 
40844
41847
  impl magnus::TryConvert for TierStrategy {
40845
41848
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
40846
- let s: String = magnus::TryConvert::try_convert(val)?;
41849
+ // IntoValue emits Symbols, including when this enum is a Hash key.
41850
+ // Accept that exact representation as well as String inputs; do not
41851
+ // coerce arbitrary objects through to_s.
41852
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
41853
+ symbol.name()?.into_owned()
41854
+ } else {
41855
+ magnus::TryConvert::try_convert(val)?
41856
+ };
40847
41857
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
40848
41858
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
40849
41859
  // existing consumer code written in any of those styles keep working.
@@ -40861,7 +41871,7 @@ impl magnus::TryConvert for TierStrategy {
40861
41871
  unsafe impl IntoValueFromNative for TierStrategy {}
40862
41872
  unsafe impl TryConvertOwned for TierStrategy {}
40863
41873
 
40864
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
41874
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
40865
41875
  #[serde(rename_all = "snake_case")]
40866
41876
  pub enum UriKind {
40867
41877
  Hyperlink,
@@ -40894,7 +41904,14 @@ impl magnus::IntoValue for UriKind {
40894
41904
 
40895
41905
  impl magnus::TryConvert for UriKind {
40896
41906
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
40897
- let s: String = magnus::TryConvert::try_convert(val)?;
41907
+ // IntoValue emits Symbols, including when this enum is a Hash key.
41908
+ // Accept that exact representation as well as String inputs; do not
41909
+ // coerce arbitrary objects through to_s.
41910
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
41911
+ symbol.name()?.into_owned()
41912
+ } else {
41913
+ magnus::TryConvert::try_convert(val)?
41914
+ };
40898
41915
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
40899
41916
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
40900
41917
  // existing consumer code written in any of those styles keep working.
@@ -40916,7 +41933,7 @@ impl magnus::TryConvert for UriKind {
40916
41933
  unsafe impl IntoValueFromNative for UriKind {}
40917
41934
  unsafe impl TryConvertOwned for UriKind {}
40918
41935
 
40919
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
41936
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
40920
41937
  pub enum UrlEscapeStyle {
40921
41938
  Angle,
40922
41939
  Percent,
@@ -40940,7 +41957,14 @@ impl magnus::IntoValue for UrlEscapeStyle {
40940
41957
 
40941
41958
  impl magnus::TryConvert for UrlEscapeStyle {
40942
41959
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
40943
- let s: String = magnus::TryConvert::try_convert(val)?;
41960
+ // IntoValue emits Symbols, including when this enum is a Hash key.
41961
+ // Accept that exact representation as well as String inputs; do not
41962
+ // coerce arbitrary objects through to_s.
41963
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
41964
+ symbol.name()?.into_owned()
41965
+ } else {
41966
+ magnus::TryConvert::try_convert(val)?
41967
+ };
40944
41968
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
40945
41969
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
40946
41970
  // existing consumer code written in any of those styles keep working.
@@ -40958,7 +41982,7 @@ impl magnus::TryConvert for UrlEscapeStyle {
40958
41982
  unsafe impl IntoValueFromNative for UrlEscapeStyle {}
40959
41983
  unsafe impl TryConvertOwned for UrlEscapeStyle {}
40960
41984
 
40961
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
41985
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
40962
41986
  #[serde(rename_all = "snake_case")]
40963
41987
  pub enum UrlExtractionMode {
40964
41988
  Auto,
@@ -40985,7 +42009,14 @@ impl magnus::IntoValue for UrlExtractionMode {
40985
42009
 
40986
42010
  impl magnus::TryConvert for UrlExtractionMode {
40987
42011
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
40988
- let s: String = magnus::TryConvert::try_convert(val)?;
42012
+ // IntoValue emits Symbols, including when this enum is a Hash key.
42013
+ // Accept that exact representation as well as String inputs; do not
42014
+ // coerce arbitrary objects through to_s.
42015
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
42016
+ symbol.name()?.into_owned()
42017
+ } else {
42018
+ magnus::TryConvert::try_convert(val)?
42019
+ };
40989
42020
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
40990
42021
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
40991
42022
  // existing consumer code written in any of those styles keep working.
@@ -41030,7 +42061,8 @@ impl magnus::IntoValue for VlmFallbackPolicy {
41030
42061
 
41031
42062
  impl magnus::TryConvert for VlmFallbackPolicy {
41032
42063
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
41033
- // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
42064
+ // Generated Data variants carry native DTOs, not JSON-compatible display strings.
42065
+ let class_name: Option<String> = val.class().funcall("name", ())?; // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
41034
42066
  // For unit enums or when passed as a string, fall back to string-based conversion.
41035
42067
  let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
41036
42068
  s
@@ -41062,9 +42094,10 @@ impl magnus::TryConvert for VlmFallbackPolicy {
41062
42094
 
41063
42095
  unsafe impl IntoValueFromNative for VlmFallbackPolicy {}
41064
42096
  unsafe impl TryConvertOwned for VlmFallbackPolicy {}
42097
+
41065
42098
  impl VlmFallbackPolicy {}
41066
42099
 
41067
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
42100
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
41068
42101
  #[serde(rename_all = "snake_case")]
41069
42102
  pub enum WhisperModel {
41070
42103
  Tiny,
@@ -41095,7 +42128,14 @@ impl magnus::IntoValue for WhisperModel {
41095
42128
 
41096
42129
  impl magnus::TryConvert for WhisperModel {
41097
42130
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
41098
- let s: String = magnus::TryConvert::try_convert(val)?;
42131
+ // IntoValue emits Symbols, including when this enum is a Hash key.
42132
+ // Accept that exact representation as well as String inputs; do not
42133
+ // coerce arbitrary objects through to_s.
42134
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
42135
+ symbol.name()?.into_owned()
42136
+ } else {
42137
+ magnus::TryConvert::try_convert(val)?
42138
+ };
41099
42139
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
41100
42140
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
41101
42141
  // existing consumer code written in any of those styles keep working.
@@ -41116,7 +42156,7 @@ impl magnus::TryConvert for WhisperModel {
41116
42156
  unsafe impl IntoValueFromNative for WhisperModel {}
41117
42157
  unsafe impl TryConvertOwned for WhisperModel {}
41118
42158
 
41119
- #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
42159
+ #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
41120
42160
  pub enum WhitespaceMode {
41121
42161
  Normalized,
41122
42162
  Strict,
@@ -41140,7 +42180,14 @@ impl magnus::IntoValue for WhitespaceMode {
41140
42180
 
41141
42181
  impl magnus::TryConvert for WhitespaceMode {
41142
42182
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
41143
- let s: String = magnus::TryConvert::try_convert(val)?;
42183
+ // IntoValue emits Symbols, including when this enum is a Hash key.
42184
+ // Accept that exact representation as well as String inputs; do not
42185
+ // coerce arbitrary objects through to_s.
42186
+ let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
42187
+ symbol.name()?.into_owned()
42188
+ } else {
42189
+ magnus::TryConvert::try_convert(val)?
42190
+ };
41144
42191
  // Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
41145
42192
  // emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
41146
42193
  // existing consumer code written in any of those styles keep working.
@@ -41631,7 +42678,7 @@ impl RbOcrBackendBridgeRuntimeDispatcher {
41631
42678
  let (sender, receiver) = std::sync::mpsc::sync_channel(Self::QUEUE_CAPACITY);
41632
42679
  let inner = magnus::value::Opaque::from(rb_obj);
41633
42680
  let thread = ruby.thread_create_from_fn(move |ruby| {
41634
- while let Ok(job) = Self::recv_without_gvl(&receiver) {
42681
+ while let Ok(job) = Self::recv_without_gvl(ruby, &receiver) {
41635
42682
  let value = inner.get_inner_with(ruby);
41636
42683
  let _ = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
41637
42684
  job(ruby, value);
@@ -41664,33 +42711,47 @@ impl RbOcrBackendBridgeRuntimeDispatcher {
41664
42711
  }
41665
42712
 
41666
42713
  fn recv_without_gvl(
42714
+ ruby: &magnus::Ruby,
41667
42715
  receiver: &std::sync::mpsc::Receiver<RbOcrBackendBridgeRuntimeJob>,
41668
42716
  ) -> Result<RbOcrBackendBridgeRuntimeJob, std::sync::mpsc::RecvError> {
41669
42717
  struct ReceiveState<'a> {
41670
42718
  receiver: &'a std::sync::mpsc::Receiver<RbOcrBackendBridgeRuntimeJob>,
41671
- result: Option<Result<RbOcrBackendBridgeRuntimeJob, std::sync::mpsc::RecvError>>,
42719
+ result: Option<Result<RbOcrBackendBridgeRuntimeJob, std::sync::mpsc::RecvTimeoutError>>,
41672
42720
  }
41673
42721
 
41674
42722
  unsafe extern "C" fn receive(data: *mut std::ffi::c_void) -> *mut std::ffi::c_void {
41675
42723
  // SAFETY: the state pointer remains valid until Ruby returns from the
41676
42724
  // without-GVL callback on this same Ruby-created thread.
41677
42725
  let state = unsafe { &mut *(data as *mut ReceiveState<'_>) };
41678
- state.result = Some(state.receiver.recv());
42726
+ state.result = Some(state.receiver.recv_timeout(std::time::Duration::from_millis(50)));
41679
42727
  std::ptr::null_mut()
41680
42728
  }
41681
42729
 
41682
- let mut state = ReceiveState { receiver, result: None };
41683
- // SAFETY: this runs on the dedicated Ruby-created dispatcher thread. The
41684
- // callback touches only Rust channel state and the sender disconnect wakes it.
41685
- unsafe {
41686
- rb_sys::rb_thread_call_without_gvl(
41687
- Some(receive),
41688
- &mut state as *mut ReceiveState<'_> as *mut std::ffi::c_void,
41689
- None,
41690
- std::ptr::null_mut(),
41691
- );
42730
+ loop {
42731
+ let mut state = ReceiveState { receiver, result: None };
42732
+ // SAFETY: the callback only touches Rust channel state, and returns
42733
+ // within 50ms even if a registered sender survives interpreter exit.
42734
+ // The gvl2 API defers interrupts: process them through Magnus below
42735
+ // so a Ruby non-local exit cannot skip Rust stack destructors here.
42736
+ unsafe {
42737
+ rb_sys::rb_thread_call_without_gvl2(
42738
+ Some(receive),
42739
+ &mut state as *mut ReceiveState<'_> as *mut std::ffi::c_void,
42740
+ None,
42741
+ std::ptr::null_mut(),
42742
+ );
42743
+ }
42744
+ if ruby.thread_check_ints().is_err() {
42745
+ return Err(std::sync::mpsc::RecvError);
42746
+ }
42747
+ match state.result {
42748
+ Some(Ok(job)) => return Ok(job),
42749
+ Some(Err(std::sync::mpsc::RecvTimeoutError::Disconnected)) => {
42750
+ return Err(std::sync::mpsc::RecvError);
42751
+ }
42752
+ Some(Err(std::sync::mpsc::RecvTimeoutError::Timeout)) | None => continue,
42753
+ }
41692
42754
  }
41693
- state.result.unwrap_or_else(|| Err(std::sync::mpsc::RecvError))
41694
42755
  }
41695
42756
  }
41696
42757
 
@@ -42914,7 +43975,7 @@ impl RbPostProcessorBridgeRuntimeDispatcher {
42914
43975
  let (sender, receiver) = std::sync::mpsc::sync_channel(Self::QUEUE_CAPACITY);
42915
43976
  let inner = magnus::value::Opaque::from(rb_obj);
42916
43977
  let thread = ruby.thread_create_from_fn(move |ruby| {
42917
- while let Ok(job) = Self::recv_without_gvl(&receiver) {
43978
+ while let Ok(job) = Self::recv_without_gvl(ruby, &receiver) {
42918
43979
  let value = inner.get_inner_with(ruby);
42919
43980
  let _ = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
42920
43981
  job(ruby, value);
@@ -42947,33 +44008,47 @@ impl RbPostProcessorBridgeRuntimeDispatcher {
42947
44008
  }
42948
44009
 
42949
44010
  fn recv_without_gvl(
44011
+ ruby: &magnus::Ruby,
42950
44012
  receiver: &std::sync::mpsc::Receiver<RbPostProcessorBridgeRuntimeJob>,
42951
44013
  ) -> Result<RbPostProcessorBridgeRuntimeJob, std::sync::mpsc::RecvError> {
42952
44014
  struct ReceiveState<'a> {
42953
44015
  receiver: &'a std::sync::mpsc::Receiver<RbPostProcessorBridgeRuntimeJob>,
42954
- result: Option<Result<RbPostProcessorBridgeRuntimeJob, std::sync::mpsc::RecvError>>,
44016
+ result: Option<Result<RbPostProcessorBridgeRuntimeJob, std::sync::mpsc::RecvTimeoutError>>,
42955
44017
  }
42956
44018
 
42957
44019
  unsafe extern "C" fn receive(data: *mut std::ffi::c_void) -> *mut std::ffi::c_void {
42958
44020
  // SAFETY: the state pointer remains valid until Ruby returns from the
42959
44021
  // without-GVL callback on this same Ruby-created thread.
42960
44022
  let state = unsafe { &mut *(data as *mut ReceiveState<'_>) };
42961
- state.result = Some(state.receiver.recv());
44023
+ state.result = Some(state.receiver.recv_timeout(std::time::Duration::from_millis(50)));
42962
44024
  std::ptr::null_mut()
42963
44025
  }
42964
44026
 
42965
- let mut state = ReceiveState { receiver, result: None };
42966
- // SAFETY: this runs on the dedicated Ruby-created dispatcher thread. The
42967
- // callback touches only Rust channel state and the sender disconnect wakes it.
42968
- unsafe {
42969
- rb_sys::rb_thread_call_without_gvl(
42970
- Some(receive),
42971
- &mut state as *mut ReceiveState<'_> as *mut std::ffi::c_void,
42972
- None,
42973
- std::ptr::null_mut(),
42974
- );
44027
+ loop {
44028
+ let mut state = ReceiveState { receiver, result: None };
44029
+ // SAFETY: the callback only touches Rust channel state, and returns
44030
+ // within 50ms even if a registered sender survives interpreter exit.
44031
+ // The gvl2 API defers interrupts: process them through Magnus below
44032
+ // so a Ruby non-local exit cannot skip Rust stack destructors here.
44033
+ unsafe {
44034
+ rb_sys::rb_thread_call_without_gvl2(
44035
+ Some(receive),
44036
+ &mut state as *mut ReceiveState<'_> as *mut std::ffi::c_void,
44037
+ None,
44038
+ std::ptr::null_mut(),
44039
+ );
44040
+ }
44041
+ if ruby.thread_check_ints().is_err() {
44042
+ return Err(std::sync::mpsc::RecvError);
44043
+ }
44044
+ match state.result {
44045
+ Some(Ok(job)) => return Ok(job),
44046
+ Some(Err(std::sync::mpsc::RecvTimeoutError::Disconnected)) => {
44047
+ return Err(std::sync::mpsc::RecvError);
44048
+ }
44049
+ Some(Err(std::sync::mpsc::RecvTimeoutError::Timeout)) | None => continue,
44050
+ }
42975
44051
  }
42976
- state.result.unwrap_or_else(|| Err(std::sync::mpsc::RecvError))
42977
44052
  }
42978
44053
  }
42979
44054
 
@@ -43510,7 +44585,7 @@ impl RbValidatorBridgeRuntimeDispatcher {
43510
44585
  let (sender, receiver) = std::sync::mpsc::sync_channel(Self::QUEUE_CAPACITY);
43511
44586
  let inner = magnus::value::Opaque::from(rb_obj);
43512
44587
  let thread = ruby.thread_create_from_fn(move |ruby| {
43513
- while let Ok(job) = Self::recv_without_gvl(&receiver) {
44588
+ while let Ok(job) = Self::recv_without_gvl(ruby, &receiver) {
43514
44589
  let value = inner.get_inner_with(ruby);
43515
44590
  let _ = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
43516
44591
  job(ruby, value);
@@ -43543,33 +44618,47 @@ impl RbValidatorBridgeRuntimeDispatcher {
43543
44618
  }
43544
44619
 
43545
44620
  fn recv_without_gvl(
44621
+ ruby: &magnus::Ruby,
43546
44622
  receiver: &std::sync::mpsc::Receiver<RbValidatorBridgeRuntimeJob>,
43547
44623
  ) -> Result<RbValidatorBridgeRuntimeJob, std::sync::mpsc::RecvError> {
43548
44624
  struct ReceiveState<'a> {
43549
44625
  receiver: &'a std::sync::mpsc::Receiver<RbValidatorBridgeRuntimeJob>,
43550
- result: Option<Result<RbValidatorBridgeRuntimeJob, std::sync::mpsc::RecvError>>,
44626
+ result: Option<Result<RbValidatorBridgeRuntimeJob, std::sync::mpsc::RecvTimeoutError>>,
43551
44627
  }
43552
44628
 
43553
44629
  unsafe extern "C" fn receive(data: *mut std::ffi::c_void) -> *mut std::ffi::c_void {
43554
44630
  // SAFETY: the state pointer remains valid until Ruby returns from the
43555
44631
  // without-GVL callback on this same Ruby-created thread.
43556
44632
  let state = unsafe { &mut *(data as *mut ReceiveState<'_>) };
43557
- state.result = Some(state.receiver.recv());
44633
+ state.result = Some(state.receiver.recv_timeout(std::time::Duration::from_millis(50)));
43558
44634
  std::ptr::null_mut()
43559
44635
  }
43560
44636
 
43561
- let mut state = ReceiveState { receiver, result: None };
43562
- // SAFETY: this runs on the dedicated Ruby-created dispatcher thread. The
43563
- // callback touches only Rust channel state and the sender disconnect wakes it.
43564
- unsafe {
43565
- rb_sys::rb_thread_call_without_gvl(
43566
- Some(receive),
43567
- &mut state as *mut ReceiveState<'_> as *mut std::ffi::c_void,
43568
- None,
43569
- std::ptr::null_mut(),
43570
- );
44637
+ loop {
44638
+ let mut state = ReceiveState { receiver, result: None };
44639
+ // SAFETY: the callback only touches Rust channel state, and returns
44640
+ // within 50ms even if a registered sender survives interpreter exit.
44641
+ // The gvl2 API defers interrupts: process them through Magnus below
44642
+ // so a Ruby non-local exit cannot skip Rust stack destructors here.
44643
+ unsafe {
44644
+ rb_sys::rb_thread_call_without_gvl2(
44645
+ Some(receive),
44646
+ &mut state as *mut ReceiveState<'_> as *mut std::ffi::c_void,
44647
+ None,
44648
+ std::ptr::null_mut(),
44649
+ );
44650
+ }
44651
+ if ruby.thread_check_ints().is_err() {
44652
+ return Err(std::sync::mpsc::RecvError);
44653
+ }
44654
+ match state.result {
44655
+ Some(Ok(job)) => return Ok(job),
44656
+ Some(Err(std::sync::mpsc::RecvTimeoutError::Disconnected)) => {
44657
+ return Err(std::sync::mpsc::RecvError);
44658
+ }
44659
+ Some(Err(std::sync::mpsc::RecvTimeoutError::Timeout)) | None => continue,
44660
+ }
43571
44661
  }
43572
- state.result.unwrap_or_else(|| Err(std::sync::mpsc::RecvError))
43573
44662
  }
43574
44663
  }
43575
44664
 
@@ -43967,7 +45056,7 @@ impl RbDocumentExtractorBridgeRuntimeDispatcher {
43967
45056
  let (sender, receiver) = std::sync::mpsc::sync_channel(Self::QUEUE_CAPACITY);
43968
45057
  let inner = magnus::value::Opaque::from(rb_obj);
43969
45058
  let thread = ruby.thread_create_from_fn(move |ruby| {
43970
- while let Ok(job) = Self::recv_without_gvl(&receiver) {
45059
+ while let Ok(job) = Self::recv_without_gvl(ruby, &receiver) {
43971
45060
  let value = inner.get_inner_with(ruby);
43972
45061
  let _ = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
43973
45062
  job(ruby, value);
@@ -44000,33 +45089,47 @@ impl RbDocumentExtractorBridgeRuntimeDispatcher {
44000
45089
  }
44001
45090
 
44002
45091
  fn recv_without_gvl(
45092
+ ruby: &magnus::Ruby,
44003
45093
  receiver: &std::sync::mpsc::Receiver<RbDocumentExtractorBridgeRuntimeJob>,
44004
45094
  ) -> Result<RbDocumentExtractorBridgeRuntimeJob, std::sync::mpsc::RecvError> {
44005
45095
  struct ReceiveState<'a> {
44006
45096
  receiver: &'a std::sync::mpsc::Receiver<RbDocumentExtractorBridgeRuntimeJob>,
44007
- result: Option<Result<RbDocumentExtractorBridgeRuntimeJob, std::sync::mpsc::RecvError>>,
45097
+ result: Option<Result<RbDocumentExtractorBridgeRuntimeJob, std::sync::mpsc::RecvTimeoutError>>,
44008
45098
  }
44009
45099
 
44010
45100
  unsafe extern "C" fn receive(data: *mut std::ffi::c_void) -> *mut std::ffi::c_void {
44011
45101
  // SAFETY: the state pointer remains valid until Ruby returns from the
44012
45102
  // without-GVL callback on this same Ruby-created thread.
44013
45103
  let state = unsafe { &mut *(data as *mut ReceiveState<'_>) };
44014
- state.result = Some(state.receiver.recv());
45104
+ state.result = Some(state.receiver.recv_timeout(std::time::Duration::from_millis(50)));
44015
45105
  std::ptr::null_mut()
44016
45106
  }
44017
45107
 
44018
- let mut state = ReceiveState { receiver, result: None };
44019
- // SAFETY: this runs on the dedicated Ruby-created dispatcher thread. The
44020
- // callback touches only Rust channel state and the sender disconnect wakes it.
44021
- unsafe {
44022
- rb_sys::rb_thread_call_without_gvl(
44023
- Some(receive),
44024
- &mut state as *mut ReceiveState<'_> as *mut std::ffi::c_void,
44025
- None,
44026
- std::ptr::null_mut(),
44027
- );
45108
+ loop {
45109
+ let mut state = ReceiveState { receiver, result: None };
45110
+ // SAFETY: the callback only touches Rust channel state, and returns
45111
+ // within 50ms even if a registered sender survives interpreter exit.
45112
+ // The gvl2 API defers interrupts: process them through Magnus below
45113
+ // so a Ruby non-local exit cannot skip Rust stack destructors here.
45114
+ unsafe {
45115
+ rb_sys::rb_thread_call_without_gvl2(
45116
+ Some(receive),
45117
+ &mut state as *mut ReceiveState<'_> as *mut std::ffi::c_void,
45118
+ None,
45119
+ std::ptr::null_mut(),
45120
+ );
45121
+ }
45122
+ if ruby.thread_check_ints().is_err() {
45123
+ return Err(std::sync::mpsc::RecvError);
45124
+ }
45125
+ match state.result {
45126
+ Some(Ok(job)) => return Ok(job),
45127
+ Some(Err(std::sync::mpsc::RecvTimeoutError::Disconnected)) => {
45128
+ return Err(std::sync::mpsc::RecvError);
45129
+ }
45130
+ Some(Err(std::sync::mpsc::RecvTimeoutError::Timeout)) | None => continue,
45131
+ }
44028
45132
  }
44029
- state.result.unwrap_or_else(|| Err(std::sync::mpsc::RecvError))
44030
45133
  }
44031
45134
  }
44032
45135
 
@@ -44469,7 +45572,7 @@ impl RbEmbeddingBackendBridgeRuntimeDispatcher {
44469
45572
  let (sender, receiver) = std::sync::mpsc::sync_channel(Self::QUEUE_CAPACITY);
44470
45573
  let inner = magnus::value::Opaque::from(rb_obj);
44471
45574
  let thread = ruby.thread_create_from_fn(move |ruby| {
44472
- while let Ok(job) = Self::recv_without_gvl(&receiver) {
45575
+ while let Ok(job) = Self::recv_without_gvl(ruby, &receiver) {
44473
45576
  let value = inner.get_inner_with(ruby);
44474
45577
  let _ = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
44475
45578
  job(ruby, value);
@@ -44502,33 +45605,47 @@ impl RbEmbeddingBackendBridgeRuntimeDispatcher {
44502
45605
  }
44503
45606
 
44504
45607
  fn recv_without_gvl(
45608
+ ruby: &magnus::Ruby,
44505
45609
  receiver: &std::sync::mpsc::Receiver<RbEmbeddingBackendBridgeRuntimeJob>,
44506
45610
  ) -> Result<RbEmbeddingBackendBridgeRuntimeJob, std::sync::mpsc::RecvError> {
44507
45611
  struct ReceiveState<'a> {
44508
45612
  receiver: &'a std::sync::mpsc::Receiver<RbEmbeddingBackendBridgeRuntimeJob>,
44509
- result: Option<Result<RbEmbeddingBackendBridgeRuntimeJob, std::sync::mpsc::RecvError>>,
45613
+ result: Option<Result<RbEmbeddingBackendBridgeRuntimeJob, std::sync::mpsc::RecvTimeoutError>>,
44510
45614
  }
44511
45615
 
44512
45616
  unsafe extern "C" fn receive(data: *mut std::ffi::c_void) -> *mut std::ffi::c_void {
44513
45617
  // SAFETY: the state pointer remains valid until Ruby returns from the
44514
45618
  // without-GVL callback on this same Ruby-created thread.
44515
45619
  let state = unsafe { &mut *(data as *mut ReceiveState<'_>) };
44516
- state.result = Some(state.receiver.recv());
45620
+ state.result = Some(state.receiver.recv_timeout(std::time::Duration::from_millis(50)));
44517
45621
  std::ptr::null_mut()
44518
45622
  }
44519
45623
 
44520
- let mut state = ReceiveState { receiver, result: None };
44521
- // SAFETY: this runs on the dedicated Ruby-created dispatcher thread. The
44522
- // callback touches only Rust channel state and the sender disconnect wakes it.
44523
- unsafe {
44524
- rb_sys::rb_thread_call_without_gvl(
44525
- Some(receive),
44526
- &mut state as *mut ReceiveState<'_> as *mut std::ffi::c_void,
44527
- None,
44528
- std::ptr::null_mut(),
44529
- );
45624
+ loop {
45625
+ let mut state = ReceiveState { receiver, result: None };
45626
+ // SAFETY: the callback only touches Rust channel state, and returns
45627
+ // within 50ms even if a registered sender survives interpreter exit.
45628
+ // The gvl2 API defers interrupts: process them through Magnus below
45629
+ // so a Ruby non-local exit cannot skip Rust stack destructors here.
45630
+ unsafe {
45631
+ rb_sys::rb_thread_call_without_gvl2(
45632
+ Some(receive),
45633
+ &mut state as *mut ReceiveState<'_> as *mut std::ffi::c_void,
45634
+ None,
45635
+ std::ptr::null_mut(),
45636
+ );
45637
+ }
45638
+ if ruby.thread_check_ints().is_err() {
45639
+ return Err(std::sync::mpsc::RecvError);
45640
+ }
45641
+ match state.result {
45642
+ Some(Ok(job)) => return Ok(job),
45643
+ Some(Err(std::sync::mpsc::RecvTimeoutError::Disconnected)) => {
45644
+ return Err(std::sync::mpsc::RecvError);
45645
+ }
45646
+ Some(Err(std::sync::mpsc::RecvTimeoutError::Timeout)) | None => continue,
45647
+ }
44530
45648
  }
44531
- state.result.unwrap_or_else(|| Err(std::sync::mpsc::RecvError))
44532
45649
  }
44533
45650
  }
44534
45651
 
@@ -44796,7 +45913,7 @@ impl RbRendererBridgeRuntimeDispatcher {
44796
45913
  let (sender, receiver) = std::sync::mpsc::sync_channel(Self::QUEUE_CAPACITY);
44797
45914
  let inner = magnus::value::Opaque::from(rb_obj);
44798
45915
  let thread = ruby.thread_create_from_fn(move |ruby| {
44799
- while let Ok(job) = Self::recv_without_gvl(&receiver) {
45916
+ while let Ok(job) = Self::recv_without_gvl(ruby, &receiver) {
44800
45917
  let value = inner.get_inner_with(ruby);
44801
45918
  let _ = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
44802
45919
  job(ruby, value);
@@ -44829,33 +45946,47 @@ impl RbRendererBridgeRuntimeDispatcher {
44829
45946
  }
44830
45947
 
44831
45948
  fn recv_without_gvl(
45949
+ ruby: &magnus::Ruby,
44832
45950
  receiver: &std::sync::mpsc::Receiver<RbRendererBridgeRuntimeJob>,
44833
45951
  ) -> Result<RbRendererBridgeRuntimeJob, std::sync::mpsc::RecvError> {
44834
45952
  struct ReceiveState<'a> {
44835
45953
  receiver: &'a std::sync::mpsc::Receiver<RbRendererBridgeRuntimeJob>,
44836
- result: Option<Result<RbRendererBridgeRuntimeJob, std::sync::mpsc::RecvError>>,
45954
+ result: Option<Result<RbRendererBridgeRuntimeJob, std::sync::mpsc::RecvTimeoutError>>,
44837
45955
  }
44838
45956
 
44839
45957
  unsafe extern "C" fn receive(data: *mut std::ffi::c_void) -> *mut std::ffi::c_void {
44840
45958
  // SAFETY: the state pointer remains valid until Ruby returns from the
44841
45959
  // without-GVL callback on this same Ruby-created thread.
44842
45960
  let state = unsafe { &mut *(data as *mut ReceiveState<'_>) };
44843
- state.result = Some(state.receiver.recv());
45961
+ state.result = Some(state.receiver.recv_timeout(std::time::Duration::from_millis(50)));
44844
45962
  std::ptr::null_mut()
44845
45963
  }
44846
45964
 
44847
- let mut state = ReceiveState { receiver, result: None };
44848
- // SAFETY: this runs on the dedicated Ruby-created dispatcher thread. The
44849
- // callback touches only Rust channel state and the sender disconnect wakes it.
44850
- unsafe {
44851
- rb_sys::rb_thread_call_without_gvl(
44852
- Some(receive),
44853
- &mut state as *mut ReceiveState<'_> as *mut std::ffi::c_void,
44854
- None,
44855
- std::ptr::null_mut(),
44856
- );
45965
+ loop {
45966
+ let mut state = ReceiveState { receiver, result: None };
45967
+ // SAFETY: the callback only touches Rust channel state, and returns
45968
+ // within 50ms even if a registered sender survives interpreter exit.
45969
+ // The gvl2 API defers interrupts: process them through Magnus below
45970
+ // so a Ruby non-local exit cannot skip Rust stack destructors here.
45971
+ unsafe {
45972
+ rb_sys::rb_thread_call_without_gvl2(
45973
+ Some(receive),
45974
+ &mut state as *mut ReceiveState<'_> as *mut std::ffi::c_void,
45975
+ None,
45976
+ std::ptr::null_mut(),
45977
+ );
45978
+ }
45979
+ if ruby.thread_check_ints().is_err() {
45980
+ return Err(std::sync::mpsc::RecvError);
45981
+ }
45982
+ match state.result {
45983
+ Some(Ok(job)) => return Ok(job),
45984
+ Some(Err(std::sync::mpsc::RecvTimeoutError::Disconnected)) => {
45985
+ return Err(std::sync::mpsc::RecvError);
45986
+ }
45987
+ Some(Err(std::sync::mpsc::RecvTimeoutError::Timeout)) | None => continue,
45988
+ }
44857
45989
  }
44858
- state.result.unwrap_or_else(|| Err(std::sync::mpsc::RecvError))
44859
45990
  }
44860
45991
  }
44861
45992
 
@@ -45099,7 +46230,7 @@ impl RbRerankerBackendBridgeRuntimeDispatcher {
45099
46230
  let (sender, receiver) = std::sync::mpsc::sync_channel(Self::QUEUE_CAPACITY);
45100
46231
  let inner = magnus::value::Opaque::from(rb_obj);
45101
46232
  let thread = ruby.thread_create_from_fn(move |ruby| {
45102
- while let Ok(job) = Self::recv_without_gvl(&receiver) {
46233
+ while let Ok(job) = Self::recv_without_gvl(ruby, &receiver) {
45103
46234
  let value = inner.get_inner_with(ruby);
45104
46235
  let _ = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
45105
46236
  job(ruby, value);
@@ -45132,33 +46263,47 @@ impl RbRerankerBackendBridgeRuntimeDispatcher {
45132
46263
  }
45133
46264
 
45134
46265
  fn recv_without_gvl(
46266
+ ruby: &magnus::Ruby,
45135
46267
  receiver: &std::sync::mpsc::Receiver<RbRerankerBackendBridgeRuntimeJob>,
45136
46268
  ) -> Result<RbRerankerBackendBridgeRuntimeJob, std::sync::mpsc::RecvError> {
45137
46269
  struct ReceiveState<'a> {
45138
46270
  receiver: &'a std::sync::mpsc::Receiver<RbRerankerBackendBridgeRuntimeJob>,
45139
- result: Option<Result<RbRerankerBackendBridgeRuntimeJob, std::sync::mpsc::RecvError>>,
46271
+ result: Option<Result<RbRerankerBackendBridgeRuntimeJob, std::sync::mpsc::RecvTimeoutError>>,
45140
46272
  }
45141
46273
 
45142
46274
  unsafe extern "C" fn receive(data: *mut std::ffi::c_void) -> *mut std::ffi::c_void {
45143
46275
  // SAFETY: the state pointer remains valid until Ruby returns from the
45144
46276
  // without-GVL callback on this same Ruby-created thread.
45145
46277
  let state = unsafe { &mut *(data as *mut ReceiveState<'_>) };
45146
- state.result = Some(state.receiver.recv());
46278
+ state.result = Some(state.receiver.recv_timeout(std::time::Duration::from_millis(50)));
45147
46279
  std::ptr::null_mut()
45148
46280
  }
45149
46281
 
45150
- let mut state = ReceiveState { receiver, result: None };
45151
- // SAFETY: this runs on the dedicated Ruby-created dispatcher thread. The
45152
- // callback touches only Rust channel state and the sender disconnect wakes it.
45153
- unsafe {
45154
- rb_sys::rb_thread_call_without_gvl(
45155
- Some(receive),
45156
- &mut state as *mut ReceiveState<'_> as *mut std::ffi::c_void,
45157
- None,
45158
- std::ptr::null_mut(),
45159
- );
46282
+ loop {
46283
+ let mut state = ReceiveState { receiver, result: None };
46284
+ // SAFETY: the callback only touches Rust channel state, and returns
46285
+ // within 50ms even if a registered sender survives interpreter exit.
46286
+ // The gvl2 API defers interrupts: process them through Magnus below
46287
+ // so a Ruby non-local exit cannot skip Rust stack destructors here.
46288
+ unsafe {
46289
+ rb_sys::rb_thread_call_without_gvl2(
46290
+ Some(receive),
46291
+ &mut state as *mut ReceiveState<'_> as *mut std::ffi::c_void,
46292
+ None,
46293
+ std::ptr::null_mut(),
46294
+ );
46295
+ }
46296
+ if ruby.thread_check_ints().is_err() {
46297
+ return Err(std::sync::mpsc::RecvError);
46298
+ }
46299
+ match state.result {
46300
+ Some(Ok(job)) => return Ok(job),
46301
+ Some(Err(std::sync::mpsc::RecvTimeoutError::Disconnected)) => {
46302
+ return Err(std::sync::mpsc::RecvError);
46303
+ }
46304
+ Some(Err(std::sync::mpsc::RecvTimeoutError::Timeout)) | None => continue,
46305
+ }
45160
46306
  }
45161
- state.result.unwrap_or_else(|| Err(std::sync::mpsc::RecvError))
45162
46307
  }
45163
46308
  }
45164
46309
 
@@ -45394,7 +46539,7 @@ impl RbTokenizerBackendBridgeRuntimeDispatcher {
45394
46539
  let (sender, receiver) = std::sync::mpsc::sync_channel(Self::QUEUE_CAPACITY);
45395
46540
  let inner = magnus::value::Opaque::from(rb_obj);
45396
46541
  let thread = ruby.thread_create_from_fn(move |ruby| {
45397
- while let Ok(job) = Self::recv_without_gvl(&receiver) {
46542
+ while let Ok(job) = Self::recv_without_gvl(ruby, &receiver) {
45398
46543
  let value = inner.get_inner_with(ruby);
45399
46544
  let _ = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
45400
46545
  job(ruby, value);
@@ -45427,33 +46572,47 @@ impl RbTokenizerBackendBridgeRuntimeDispatcher {
45427
46572
  }
45428
46573
 
45429
46574
  fn recv_without_gvl(
46575
+ ruby: &magnus::Ruby,
45430
46576
  receiver: &std::sync::mpsc::Receiver<RbTokenizerBackendBridgeRuntimeJob>,
45431
46577
  ) -> Result<RbTokenizerBackendBridgeRuntimeJob, std::sync::mpsc::RecvError> {
45432
46578
  struct ReceiveState<'a> {
45433
46579
  receiver: &'a std::sync::mpsc::Receiver<RbTokenizerBackendBridgeRuntimeJob>,
45434
- result: Option<Result<RbTokenizerBackendBridgeRuntimeJob, std::sync::mpsc::RecvError>>,
46580
+ result: Option<Result<RbTokenizerBackendBridgeRuntimeJob, std::sync::mpsc::RecvTimeoutError>>,
45435
46581
  }
45436
46582
 
45437
46583
  unsafe extern "C" fn receive(data: *mut std::ffi::c_void) -> *mut std::ffi::c_void {
45438
46584
  // SAFETY: the state pointer remains valid until Ruby returns from the
45439
46585
  // without-GVL callback on this same Ruby-created thread.
45440
46586
  let state = unsafe { &mut *(data as *mut ReceiveState<'_>) };
45441
- state.result = Some(state.receiver.recv());
46587
+ state.result = Some(state.receiver.recv_timeout(std::time::Duration::from_millis(50)));
45442
46588
  std::ptr::null_mut()
45443
46589
  }
45444
46590
 
45445
- let mut state = ReceiveState { receiver, result: None };
45446
- // SAFETY: this runs on the dedicated Ruby-created dispatcher thread. The
45447
- // callback touches only Rust channel state and the sender disconnect wakes it.
45448
- unsafe {
45449
- rb_sys::rb_thread_call_without_gvl(
45450
- Some(receive),
45451
- &mut state as *mut ReceiveState<'_> as *mut std::ffi::c_void,
45452
- None,
45453
- std::ptr::null_mut(),
45454
- );
46591
+ loop {
46592
+ let mut state = ReceiveState { receiver, result: None };
46593
+ // SAFETY: the callback only touches Rust channel state, and returns
46594
+ // within 50ms even if a registered sender survives interpreter exit.
46595
+ // The gvl2 API defers interrupts: process them through Magnus below
46596
+ // so a Ruby non-local exit cannot skip Rust stack destructors here.
46597
+ unsafe {
46598
+ rb_sys::rb_thread_call_without_gvl2(
46599
+ Some(receive),
46600
+ &mut state as *mut ReceiveState<'_> as *mut std::ffi::c_void,
46601
+ None,
46602
+ std::ptr::null_mut(),
46603
+ );
46604
+ }
46605
+ if ruby.thread_check_ints().is_err() {
46606
+ return Err(std::sync::mpsc::RecvError);
46607
+ }
46608
+ match state.result {
46609
+ Some(Ok(job)) => return Ok(job),
46610
+ Some(Err(std::sync::mpsc::RecvTimeoutError::Disconnected)) => {
46611
+ return Err(std::sync::mpsc::RecvError);
46612
+ }
46613
+ Some(Err(std::sync::mpsc::RecvTimeoutError::Timeout)) | None => continue,
46614
+ }
45455
46615
  }
45456
- state.result.unwrap_or_else(|| Err(std::sync::mpsc::RecvError))
45457
46616
  }
45458
46617
  }
45459
46618
 
@@ -46340,6 +47499,7 @@ impl From<ConcurrencyConfig> for xberg::ConcurrencyConfig {
46340
47499
  fn from(val: ConcurrencyConfig) -> Self {
46341
47500
  Self {
46342
47501
  max_threads: val.max_threads,
47502
+ max_concurrent_ocr: val.max_concurrent_ocr,
46343
47503
  ..Default::default()
46344
47504
  }
46345
47505
  }
@@ -46349,6 +47509,7 @@ impl From<xberg::ConcurrencyConfig> for ConcurrencyConfig {
46349
47509
  fn from(val: xberg::ConcurrencyConfig) -> Self {
46350
47510
  Self {
46351
47511
  max_threads: val.max_threads,
47512
+ max_concurrent_ocr: val.max_concurrent_ocr,
46352
47513
  }
46353
47514
  }
46354
47515
  }
@@ -46808,8 +47969,12 @@ impl From<xberg::candle_ocr::DeepseekOcrBackendOptions> for DeepseekOcrBackendOp
46808
47969
  fn from(val: xberg::candle_ocr::DeepseekOcrBackendOptions) -> Self {
46809
47970
  Self {
46810
47971
  model_path: val.model_path.map(|v| v.to_string()),
47972
+ model_id: val.model_id.map(|v| v.to_string()),
47973
+ hf_revision: val.hf_revision.map(|v| v.to_string()),
47974
+ cache_dir: val.cache_dir.map(|v| v.to_string()),
46811
47975
  device: val.device.map(Into::into),
46812
47976
  version: val.version,
47977
+ dtype: val.dtype.map(Into::into),
46813
47978
  }
46814
47979
  }
46815
47980
  }
@@ -50016,6 +51181,8 @@ impl From<OcrQualityThresholds> for xberg::OcrQualityThresholds {
50016
51181
  min_undecodable_ratio: val.min_undecodable_ratio,
50017
51182
  enable_provenance_ocr_routing: val.enable_provenance_ocr_routing,
50018
51183
  min_provenance_fallback_ratio: val.min_provenance_fallback_ratio,
51184
+ enable_plausibility_ocr_routing: val.enable_plausibility_ocr_routing,
51185
+ min_reliable_language_chunk_ratio: val.min_reliable_language_chunk_ratio,
50019
51186
  ..Default::default()
50020
51187
  }
50021
51188
  }
@@ -50048,6 +51215,8 @@ impl From<xberg::OcrQualityThresholds> for OcrQualityThresholds {
50048
51215
  min_undecodable_ratio: val.min_undecodable_ratio,
50049
51216
  enable_provenance_ocr_routing: val.enable_provenance_ocr_routing,
50050
51217
  min_provenance_fallback_ratio: val.min_provenance_fallback_ratio,
51218
+ enable_plausibility_ocr_routing: val.enable_plausibility_ocr_routing,
51219
+ min_reliable_language_chunk_ratio: val.min_reliable_language_chunk_ratio,
50051
51220
  }
50052
51221
  }
50053
51222
  }
@@ -50614,6 +51783,8 @@ impl From<PdfMetadata> for xberg::pdf::metadata::PdfMetadata {
50614
51783
  page_count: val.page_count,
50615
51784
  scanned_confidence: val.scanned_confidence,
50616
51785
  scanned_pages: val.scanned_pages.map(|v| v.into_iter().collect()),
51786
+ fabricated_text_pages: val.fabricated_text_pages.map(|v| v.into_iter().collect()),
51787
+ implausible_text_pages: val.implausible_text_pages.map(|v| v.into_iter().collect()),
50617
51788
  layout_gated_pages: val.layout_gated_pages.map(|v| v.into_iter().collect()),
50618
51789
  layout_gate_reasons: val.layout_gate_reasons.map(|v| v.into_iter().collect()),
50619
51790
  ..Default::default()
@@ -50634,6 +51805,8 @@ impl From<xberg::pdf::metadata::PdfMetadata> for PdfMetadata {
50634
51805
  page_count: val.page_count,
50635
51806
  scanned_confidence: val.scanned_confidence,
50636
51807
  scanned_pages: val.scanned_pages.map(|v| v.into_iter().collect()),
51808
+ fabricated_text_pages: val.fabricated_text_pages.map(|v| v.into_iter().collect()),
51809
+ implausible_text_pages: val.implausible_text_pages.map(|v| v.into_iter().collect()),
50637
51810
  layout_gated_pages: val.layout_gated_pages.map(|v| v.into_iter().collect()),
50638
51811
  layout_gate_reasons: val.layout_gate_reasons.map(|v| v.into_iter().collect()),
50639
51812
  }
@@ -52422,6 +53595,18 @@ impl From<xberg::CallMode> for CallMode {
52422
53595
  }
52423
53596
  }
52424
53597
 
53598
+ #[cfg(feature = "candle-ocr")]
53599
+ impl From<xberg::candle_ocr::CandleDeepseekOcrDtype> for CandleDeepseekOcrDtype {
53600
+ fn from(val: xberg::candle_ocr::CandleDeepseekOcrDtype) -> Self {
53601
+ match val {
53602
+ xberg::candle_ocr::CandleDeepseekOcrDtype::Auto => Self::Auto,
53603
+ xberg::candle_ocr::CandleDeepseekOcrDtype::F32 => Self::F32,
53604
+ xberg::candle_ocr::CandleDeepseekOcrDtype::F16 => Self::F16,
53605
+ xberg::candle_ocr::CandleDeepseekOcrDtype::Bf16 => Self::Bf16,
53606
+ }
53607
+ }
53608
+ }
53609
+
52425
53610
  #[cfg(feature = "candle-ocr")]
52426
53611
  impl From<xberg::candle_ocr::CandleDevicePreference> for CandleDevicePreference {
52427
53612
  fn from(val: xberg::candle_ocr::CandleDevicePreference) -> Self {
@@ -52624,6 +53809,16 @@ impl From<xberg::CodeDataNodeKind> for CodeDataNodeKind {
52624
53809
  }
52625
53810
  }
52626
53811
 
53812
+ impl From<ConfidenceSemantics> for xberg::ConfidenceSemantics {
53813
+ fn from(val: ConfidenceSemantics) -> Self {
53814
+ match val {
53815
+ ConfidenceSemantics::Legibility { scale_max } => Self::Legibility { scale_max },
53816
+ ConfidenceSemantics::Uncalibrated => Self::Uncalibrated,
53817
+ ConfidenceSemantics::None => Self::None,
53818
+ }
53819
+ }
53820
+ }
53821
+
52627
53822
  impl From<xberg::ConfidenceSemantics> for ConfidenceSemantics {
52628
53823
  fn from(val: xberg::ConfidenceSemantics) -> Self {
52629
53824
  match val {
@@ -52850,7 +54045,7 @@ impl From<EmbeddingModelType> for xberg::EmbeddingModelType {
52850
54045
  EmbeddingModelType::Preset { name } => Self::Preset { name },
52851
54046
  EmbeddingModelType::Custom { model_id, dimensions } => Self::Custom { model_id, dimensions },
52852
54047
  EmbeddingModelType::Llm { llm } => Self::Llm {
52853
- llm: Box::new(llm.into()),
54048
+ llm: Box::new((*llm).into()),
52854
54049
  },
52855
54050
  EmbeddingModelType::Plugin { name } => Self::Plugin { name },
52856
54051
  }
@@ -52865,7 +54060,9 @@ impl From<xberg::EmbeddingModelType> for EmbeddingModelType {
52865
54060
  model_id: model_id.to_string(),
52866
54061
  dimensions,
52867
54062
  },
52868
- xberg::EmbeddingModelType::Llm { llm } => Self::Llm { llm: (*llm).into() },
54063
+ xberg::EmbeddingModelType::Llm { llm } => Self::Llm {
54064
+ llm: Box::new((*llm).into()),
54065
+ },
52869
54066
  xberg::EmbeddingModelType::Plugin { name } => Self::Plugin { name: name.to_string() },
52870
54067
  }
52871
54068
  }
@@ -53013,7 +54210,7 @@ impl From<FormatMetadata> for xberg::FormatMetadata {
53013
54210
  #[cfg(feature = "pdf")]
53014
54211
  FormatMetadata::Pdf { _0 } => Self::Pdf(_0.into()),
53015
54212
  #[cfg(feature = "office")]
53016
- FormatMetadata::Docx { _0 } => Self::Docx(Box::new(_0.into())),
54213
+ FormatMetadata::Docx { _0 } => Self::Docx(Box::new((*_0).into())),
53017
54214
  FormatMetadata::Excel { _0 } => Self::Excel(_0.into()),
53018
54215
  FormatMetadata::Email { _0 } => Self::Email(_0.into()),
53019
54216
  FormatMetadata::Pptx { _0 } => Self::Pptx(_0.into()),
@@ -53021,7 +54218,7 @@ impl From<FormatMetadata> for xberg::FormatMetadata {
53021
54218
  FormatMetadata::Image { _0 } => Self::Image(_0.into()),
53022
54219
  FormatMetadata::Xml { _0 } => Self::Xml(_0.into()),
53023
54220
  FormatMetadata::Text { _0 } => Self::Text(_0.into()),
53024
- FormatMetadata::Html { _0 } => Self::Html(Box::new(_0.into())),
54221
+ FormatMetadata::Html { _0 } => Self::Html(Box::new((*_0).into())),
53025
54222
  FormatMetadata::Ocr { _0 } => Self::Ocr(_0.into()),
53026
54223
  FormatMetadata::Csv { _0 } => Self::Csv(_0.into()),
53027
54224
  #[cfg(feature = "office")]
@@ -53051,7 +54248,9 @@ impl From<xberg::FormatMetadata> for FormatMetadata {
53051
54248
  #[cfg(feature = "pdf")]
53052
54249
  xberg::FormatMetadata::Pdf(_0) => Self::Pdf { _0: _0.into() },
53053
54250
  #[cfg(feature = "office")]
53054
- xberg::FormatMetadata::Docx(_0) => Self::Docx { _0: (*_0).into() },
54251
+ xberg::FormatMetadata::Docx(_0) => Self::Docx {
54252
+ _0: Box::new((*_0).into()),
54253
+ },
53055
54254
  xberg::FormatMetadata::Excel(_0) => Self::Excel { _0: _0.into() },
53056
54255
  xberg::FormatMetadata::Email(_0) => Self::Email { _0: _0.into() },
53057
54256
  xberg::FormatMetadata::Pptx(_0) => Self::Pptx { _0: _0.into() },
@@ -53059,7 +54258,9 @@ impl From<xberg::FormatMetadata> for FormatMetadata {
53059
54258
  xberg::FormatMetadata::Image(_0) => Self::Image { _0: _0.into() },
53060
54259
  xberg::FormatMetadata::Xml(_0) => Self::Xml { _0: _0.into() },
53061
54260
  xberg::FormatMetadata::Text(_0) => Self::Text { _0: _0.into() },
53062
- xberg::FormatMetadata::Html(_0) => Self::Html { _0: (*_0).into() },
54261
+ xberg::FormatMetadata::Html(_0) => Self::Html {
54262
+ _0: Box::new((*_0).into()),
54263
+ },
53063
54264
  xberg::FormatMetadata::Ocr(_0) => Self::Ocr { _0: _0.into() },
53064
54265
  xberg::FormatMetadata::Csv(_0) => Self::Csv { _0: _0.into() },
53065
54266
  #[cfg(feature = "office")]
@@ -53792,6 +54993,17 @@ impl From<xberg::NodeContent> for NodeContent {
53792
54993
  }
53793
54994
  }
53794
54995
 
54996
+ impl From<OcrBackendType> for xberg::OcrBackendType {
54997
+ fn from(val: OcrBackendType) -> Self {
54998
+ match val {
54999
+ OcrBackendType::Tesseract => Self::Tesseract,
55000
+ OcrBackendType::PaddleOCR => Self::PaddleOCR,
55001
+ OcrBackendType::Candle => Self::Candle,
55002
+ OcrBackendType::Custom => Self::Custom,
55003
+ }
55004
+ }
55005
+ }
55006
+
53795
55007
  impl From<xberg::OcrBackendType> for OcrBackendType {
53796
55008
  fn from(val: xberg::OcrBackendType) -> Self {
53797
55009
  match val {
@@ -53988,6 +55200,16 @@ impl From<xberg::candle_ocr::PaddleOcrVlTaskKind> for PaddleOcrVlTaskKind {
53988
55200
  }
53989
55201
  }
53990
55202
 
55203
+ impl From<PageOrientationHandling> for xberg::PageOrientationHandling {
55204
+ fn from(val: PageOrientationHandling) -> Self {
55205
+ match val {
55206
+ PageOrientationHandling::SelfCorrecting => Self::SelfCorrecting,
55207
+ PageOrientationHandling::RecognisesRotatedText => Self::RecognisesRotatedText,
55208
+ PageOrientationHandling::RequiresUpright => Self::RequiresUpright,
55209
+ }
55210
+ }
55211
+ }
55212
+
53991
55213
  impl From<xberg::PageOrientationHandling> for PageOrientationHandling {
53992
55214
  fn from(val: xberg::PageOrientationHandling) -> Self {
53993
55215
  match val {
@@ -54200,6 +55422,16 @@ impl From<xberg::ProbeStatus> for ProbeStatus {
54200
55422
  }
54201
55423
  }
54202
55424
 
55425
+ impl From<ProcessingStage> for xberg::ProcessingStage {
55426
+ fn from(val: ProcessingStage) -> Self {
55427
+ match val {
55428
+ ProcessingStage::Early => Self::Early,
55429
+ ProcessingStage::Middle => Self::Middle,
55430
+ ProcessingStage::Late => Self::Late,
55431
+ }
55432
+ }
55433
+ }
55434
+
54203
55435
  impl From<xberg::ProcessingStage> for ProcessingStage {
54204
55436
  fn from(val: xberg::ProcessingStage) -> Self {
54205
55437
  match val {
@@ -54333,7 +55565,7 @@ impl From<RerankerModelType> for xberg::RerankerModelType {
54333
55565
  head: head.into(),
54334
55566
  },
54335
55567
  RerankerModelType::Llm { llm } => Self::Llm {
54336
- llm: Box::new(llm.into()),
55568
+ llm: Box::new((*llm).into()),
54337
55569
  },
54338
55570
  RerankerModelType::Plugin { name } => Self::Plugin { name },
54339
55571
  }
@@ -54357,7 +55589,9 @@ impl From<xberg::RerankerModelType> for RerankerModelType {
54357
55589
  max_length,
54358
55590
  head: head.into(),
54359
55591
  },
54360
- xberg::RerankerModelType::Llm { llm } => Self::Llm { llm: (*llm).into() },
55592
+ xberg::RerankerModelType::Llm { llm } => Self::Llm {
55593
+ llm: Box::new((*llm).into()),
55594
+ },
54361
55595
  xberg::RerankerModelType::Plugin { name } => Self::Plugin { name: name.to_string() },
54362
55596
  }
54363
55597
  }
@@ -55237,6 +56471,8 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
55237
56471
 
55238
56472
  class.define_method("max_threads", method!(ConcurrencyConfig::max_threads, 0))?;
55239
56473
 
56474
+ class.define_method("max_concurrent_ocr", method!(ConcurrencyConfig::max_concurrent_ocr, 0))?;
56475
+
55240
56476
  let class = module.define_class("ContentConfig", ruby.class_object())?;
55241
56477
 
55242
56478
  class.define_singleton_method("new", function!(ContentConfig::new, -1))?;
@@ -55594,12 +56830,24 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
55594
56830
  #[cfg(feature = "candle-ocr")]
55595
56831
  class.define_method("model_path", method!(DeepseekOcrBackendOptions::model_path, 0))?;
55596
56832
 
56833
+ #[cfg(feature = "candle-ocr")]
56834
+ class.define_method("model_id", method!(DeepseekOcrBackendOptions::model_id, 0))?;
56835
+
56836
+ #[cfg(feature = "candle-ocr")]
56837
+ class.define_method("hf_revision", method!(DeepseekOcrBackendOptions::hf_revision, 0))?;
56838
+
56839
+ #[cfg(feature = "candle-ocr")]
56840
+ class.define_method("cache_dir", method!(DeepseekOcrBackendOptions::cache_dir, 0))?;
56841
+
55597
56842
  #[cfg(feature = "candle-ocr")]
55598
56843
  class.define_method("device", method!(DeepseekOcrBackendOptions::device, 0))?;
55599
56844
 
55600
56845
  #[cfg(feature = "candle-ocr")]
55601
56846
  class.define_method("version", method!(DeepseekOcrBackendOptions::version, 0))?;
55602
56847
 
56848
+ #[cfg(feature = "candle-ocr")]
56849
+ class.define_method("dtype", method!(DeepseekOcrBackendOptions::dtype, 0))?;
56850
+
55603
56851
  let class = module.define_class("DetectResponse", ruby.class_object())?;
55604
56852
 
55605
56853
  #[cfg(feature = "api")]
@@ -56485,6 +57733,16 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
56485
57733
 
56486
57734
  class.define_method("needs_image_data", method!(ExtractionConfig::needs_image_data, 0))?;
56487
57735
 
57736
+ class.define_method(
57737
+ "runs_ocr_on_embedded_images",
57738
+ method!(ExtractionConfig::runs_ocr_on_embedded_images, 0),
57739
+ )?;
57740
+
57741
+ class.define_method(
57742
+ "wants_own_bytes_in_result",
57743
+ method!(ExtractionConfig::wants_own_bytes_in_result, 0),
57744
+ )?;
57745
+
56488
57746
  class.define_method(
56489
57747
  "needs_image_processing",
56490
57748
  method!(ExtractionConfig::needs_image_processing, 0),
@@ -57966,6 +59224,16 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
57966
59224
  method!(OcrQualityThresholds::min_provenance_fallback_ratio, 0),
57967
59225
  )?;
57968
59226
 
59227
+ class.define_method(
59228
+ "enable_plausibility_ocr_routing",
59229
+ method!(OcrQualityThresholds::enable_plausibility_ocr_routing, 0),
59230
+ )?;
59231
+
59232
+ class.define_method(
59233
+ "min_reliable_language_chunk_ratio",
59234
+ method!(OcrQualityThresholds::min_reliable_language_chunk_ratio, 0),
59235
+ )?;
59236
+
57969
59237
  let class = module.define_class("OcrRotation", ruby.class_object())?;
57970
59238
 
57971
59239
  class.define_singleton_method("new", function!(OcrRotation::new, -1))?;
@@ -58450,6 +59718,15 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
58450
59718
  #[cfg(feature = "pdf")]
58451
59719
  class.define_method("scanned_pages", method!(PdfMetadata::scanned_pages, 0))?;
58452
59720
 
59721
+ #[cfg(feature = "pdf")]
59722
+ class.define_method("fabricated_text_pages", method!(PdfMetadata::fabricated_text_pages, 0))?;
59723
+
59724
+ #[cfg(feature = "pdf")]
59725
+ class.define_method(
59726
+ "implausible_text_pages",
59727
+ method!(PdfMetadata::implausible_text_pages, 0),
59728
+ )?;
59729
+
58453
59730
  #[cfg(feature = "pdf")]
58454
59731
  class.define_method("layout_gated_pages", method!(PdfMetadata::layout_gated_pages, 0))?;
58455
59732