1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//! LLM-based bidirectional conversion between Safety Data Sheet (SDS) documents and
//! the Japanese MHLW SDS Data Exchange Format v1.0 (JIS Z 7253 / GHS).
//!
//! # Quick start
//!
//! ```no_run
//! use sdsforge_core::{
//! AnthropicBackend, LlmConfig,
//! convert_to_json, convert_to_json_with_report, ConvertConfig, Language,
//! };
//!
//! #[tokio::main]
//! async fn main() -> anyhow::Result<()> {
//! let backend = AnthropicBackend::new(
//! std::env::var("ANTHROPIC_API_KEY")?,
//! LlmConfig::default(),
//! );
//! let config = ConvertConfig {
//! source_language: Some(Language::Japanese),
//! output_language: Language::Japanese,
//! ..Default::default()
//! };
//! // `convert_to_json_with_report` returns structured metadata (language, sections, notes).
//! let (sds, report) =
//! convert_to_json_with_report(std::path::Path::new("input.pdf"), &backend, &config).await?;
//! for w in &report.warnings { eprintln!("WARN: {w}"); }
//! eprintln!("Populated sections: {:?}", report.populated_sections);
//! eprintln!("Standardization notes: {:?}", report.standardization_notes);
//! std::fs::write("output.json", serde_json::to_string_pretty(&sds)?)?;
//! std::fs::write("output_report.json", serde_json::to_string_pretty(&report)?)?;
//! Ok(())
//! }
//! ```
//!
//! # Features
//!
//! - **SDS → JSON**: PDF/DOCX/XLSX/TXT → MHLW standard JSON via LLM (parallel extraction,
//! automatic retry, JSON repair).
//! - **JSON → DOCX**: Generates a JIS Z 7253-compliant Word document with localized headings.
//! - **Multilingual**: `ja` / `en` / `zh-CN` / `zh-TW` source documents and output headings.
//! - **Pluggable LLM**: Ships with [`AnthropicBackend`] and [`OpenAiCompatBackend`].
//! Implement [`converter::LlmBackend`] to bring your own.
pub use ;
pub use ;
pub use ;
pub use ;
pub use SdsError;
pub use ;
pub use SourceCountry;
pub use ;
pub use SdsRoot;