Skip to main content

gliner2/
lib.rs

1pub mod backends;
2pub mod config;
3pub mod decode;
4pub mod engine;
5pub mod extract;
6pub mod preprocess;
7pub mod processor;
8pub mod schema;
9pub mod setup;
10pub mod span_utils;
11
12pub use config::ExtractorConfig;
13pub use engine::Gliner2Engine;
14
15#[cfg(feature = "candle")]
16pub use backends::candle::CandleExtractor;
17#[cfg(feature = "tch")]
18pub use backends::tch::TchExtractor;
19#[cfg(feature = "tch")]
20pub use backends::tch::parse_tch_device;
21pub use decode::Entity;
22pub use extract::{
23    BatchSchemaMode, ExtractOptions, ExtractionOutput, LabelConfidence, TaskValue, batch_extract,
24    batch_extract_streaming, extract_from_preprocessed, extract_with_schema,
25};
26pub use indexmap::IndexMap;
27pub use preprocess::{PreprocessedBatch, PreprocessedInput, TaskType, collate_preprocessed};
28pub use processor::SchemaTransformer;
29pub use schema::{
30    ClassificationLabelsInput, ClassificationTaskInfo, EntityTypeInfo, EntityTypesInput,
31    ExtractionMetadata, ExtractionSchema, FieldSpecSource, ParsedFieldSpec, RegexMatchMode,
32    RegexValidator, RelationTypeInfo, RelationTypesInput, Schema, SchemaDocument, SchemaInfo,
33    StructureBuilder, StructureFieldInfo, StructureInfo, ValueDtype, create_schema,
34    infer_metadata_from_schema, parse_field_spec,
35};
36
37// Compile-time assertions: backends and shared types must be Send+Sync for Rayon parallelism.
38const _: () = {
39    fn _assert_send_sync<T: Send + Sync>() {}
40
41    #[cfg(feature = "candle")]
42    fn _check_candle() {
43        _assert_send_sync::<backends::candle::CandleExtractor>();
44    }
45    #[cfg(feature = "tch")]
46    fn _check_tch() {
47        _assert_send_sync::<backends::tch::TchExtractor>();
48    }
49    fn _check_transformer() {
50        _assert_send_sync::<processor::SchemaTransformer>();
51    }
52};