#ifndef KREUZBERG_H #define KREUZBERG_H #pragma once /* This file is auto-generated by alef. DO NOT EDIT. */ #include #include #include #include /* Opaque type forward declarations */ /** * Hardware acceleration configuration for ONNX Runtime models. * * Controls which execution provider (CPU, CoreML, CUDA, TensorRT) is used * for inference in layout detection and embedding generation. * \code * use kreuzberg::AccelerationConfig; * * // Auto-select: CoreML on macOS, CUDA on Linux, CPU elsewhere * let config = AccelerationConfig::default(); * * // Force CPU only * let config = AccelerationConfig { * provider: kreuzberg::ExecutionProviderType::Cpu, * ..Default::default() * }; * \endcode */ typedef struct KREUZBERGAccelerationConfig KREUZBERGAccelerationConfig; /** * Types of inline text annotations. */ typedef struct KREUZBERGAnnotationKind KREUZBERGAnnotationKind; /** * A single file extracted from an archive. * * When archives (ZIP, TAR, 7Z, GZIP) are extracted with recursive extraction * enabled, each processable file produces its own full `ExtractionResult`. */ typedef struct KREUZBERGArchiveEntry KREUZBERGArchiveEntry; /** * Archive (ZIP/TAR/7Z) metadata. * * Extracted from compressed archive files containing file lists and size information. */ typedef struct KREUZBERGArchiveMetadata KREUZBERGArchiveMetadata; /** * Bounding box in original image coordinates (x1, y1) top-left, (x2, y2) bottom-right. */ typedef struct KREUZBERGBBox KREUZBERGBBox; /** * Batch item for byte array extraction. * * Used with `batch_extract_bytes` and `batch_extract_bytes_sync` * to represent a single item in a batch extraction job. */ typedef struct KREUZBERGBatchBytesItem KREUZBERGBatchBytesItem; /** * Batch item for file extraction. * * Used with `batch_extract_files` and `batch_extract_files_sync` * to represent a single file in a batch extraction job. */ typedef struct KREUZBERGBatchFileItem KREUZBERGBatchFileItem; /** * BibTeX bibliography metadata. */ typedef struct KREUZBERGBibtexMetadata KREUZBERGBibtexMetadata; /** * Types of block-level elements in Djot. */ typedef struct KREUZBERGBlockType KREUZBERGBlockType; /** * Bounding box coordinates for element positioning. */ typedef struct KREUZBERGBoundingBox KREUZBERGBoundingBox; typedef struct KREUZBERGCacheStats KREUZBERGCacheStats; /** * A text chunk with optional embedding and metadata. * * Chunks are created when chunking is enabled in `ExtractionConfig`. Each chunk * contains the text content, optional embedding vector (if embedding generation * is configured), and metadata about its position in the document. */ typedef struct KREUZBERGChunk KREUZBERGChunk; /** * Metadata about a chunk's position in the original document. */ typedef struct KREUZBERGChunkMetadata KREUZBERGChunkMetadata; /** * How chunk size is measured. * * Defaults to `Characters` (Unicode character count). When using token-based sizing, * chunks are sized by token count according to the specified tokenizer. * * Token-based sizing uses HuggingFace tokenizers loaded at runtime. Any tokenizer * available on HuggingFace Hub can be used, including OpenAI-compatible tokenizers * (e.g., `Xenova/gpt-4o`, `Xenova/cl100k_base`). */ typedef struct KREUZBERGChunkSizing KREUZBERGChunkSizing; /** * Semantic structural classification of a text chunk. * * Assigned by the heuristic classifier in `chunking::classifier`. * Defaults to `Unknown` when no rule matches. * Designed to be extended in future versions without breaking changes. */ typedef struct KREUZBERGChunkType KREUZBERGChunkType; /** * Type of text chunker to use. * * # Variants * * * `Text` - Generic text splitter, splits on whitespace and punctuation * * `Markdown` - Markdown-aware splitter, preserves formatting and structure * * `Yaml` - YAML-aware splitter, creates one chunk per top-level key * * `Semantic` - Topic-aware chunker. With an `EmbeddingConfig`, splits at * embedding-based topic shifts tuned by `topic_threshold` (default 0.75, * lower = more splits). Without an embedding, falls back to a * structural-boundary heuristic (ALL-CAPS headers, numbered sections, * blank-line paragraphs) and merges groups into chunks capped at * `max_characters` (default 1000). `topic_threshold` has no effect in the * fallback path. For best results, pair with an embedding model. */ typedef struct KREUZBERGChunkerType KREUZBERGChunkerType; /** * Chunking configuration. * * Configures text chunking for document content, including chunk size, * overlap, trimming behavior, and optional embeddings. * * Use `..Default::default()` when constructing to allow for future field additions: * ```rust * let config = ChunkingConfig { * max_characters: 500, * ..Default::default() * }; * ``` */ typedef struct KREUZBERGChunkingConfig KREUZBERGChunkingConfig; /** * Citation file metadata (RIS, PubMed, EndNote). */ typedef struct KREUZBERGCitationMetadata KREUZBERGCitationMetadata; /** * Content rendering mode for code extraction. * * Controls how extracted code content is represented in the `content` field * of `ExtractionResult`. */ typedef struct KREUZBERGCodeContentMode KREUZBERGCodeContentMode; /** * Cross-extractor content filtering configuration. * * Controls whether "furniture" content (headers, footers, page numbers, * watermarks, repeating text) is included in or stripped from extraction * results. Applies across all extractors (PDF, DOCX, RTF, ODT, HTML, etc.) * with format-specific implementation. * * When `None` on `ExtractionConfig`, each extractor uses its current * default behavior unchanged. */ typedef struct KREUZBERGContentFilterConfig KREUZBERGContentFilterConfig; /** * Content layer classification for document nodes. * * Replaces separate body/furniture arrays with per-node granularity. */ typedef struct KREUZBERGContentLayer KREUZBERGContentLayer; /** * JATS contributor with role. */ typedef struct KREUZBERGContributorRole KREUZBERGContributorRole; /** * Dublin Core metadata from docProps/core.xml * * Contains standard metadata fields defined by the Dublin Core standard * and Office-specific extensions. */ typedef struct KREUZBERGCoreProperties KREUZBERGCoreProperties; /** * CSV/TSV file metadata. */ typedef struct KREUZBERGCsvMetadata KREUZBERGCsvMetadata; /** * dBASE field information. */ typedef struct KREUZBERGDbfFieldInfo KREUZBERGDbfFieldInfo; /** * dBASE (DBF) file metadata. */ typedef struct KREUZBERGDbfMetadata KREUZBERGDbfMetadata; /** * MIME type detection response. */ typedef struct KREUZBERGDetectResponse KREUZBERGDetectResponse; /** * Page-level detection result containing all detections and page metadata. */ typedef struct KREUZBERGDetectionResult KREUZBERGDetectionResult; /** * Comprehensive Djot document structure with semantic preservation. * * This type captures the full richness of Djot markup, including: * - Block-level structures (headings, lists, blockquotes, code blocks, etc.) * - Inline formatting (emphasis, strong, highlight, subscript, superscript, etc.) * - Attributes (classes, IDs, key-value pairs) * - Links, images, footnotes * - Math expressions (inline and display) * - Tables with full structure * * Available when the `djot` feature is enabled. */ typedef struct KREUZBERGDjotContent KREUZBERGDjotContent; /** * Image element in Djot. */ typedef struct KREUZBERGDjotImage KREUZBERGDjotImage; /** * Link element in Djot. */ typedef struct KREUZBERGDjotLink KREUZBERGDjotLink; /** * Trait for document extractor plugins. * * Implement this trait to add support for new document formats or to override * built-in extraction behavior with custom logic. * * # Return Type * * Extractors return `InternalDocument`, a flat intermediate representation. * The pipeline converts this into the public `ExtractionResult` via the * derivation step. * * # Priority System * * When multiple extractors support the same MIME type, the registry selects * the extractor with the highest priority value. Use this to: * - Override built-in extractors (priority > 50) * - Provide fallback extractors (priority < 50) * - Implement specialized extractors for specific use cases * * Default priority is 50. * * # Thread Safety * * Extractors must be thread-safe (`Send + Sync`) to support concurrent extraction. * \code * use kreuzberg::plugins::{Plugin, DocumentExtractor}; * use kreuzberg::{Result, ExtractionConfig}; * use kreuzberg::types::internal::InternalDocument; * use async_trait::async_trait; * use std::path::Path; * * /// Custom PDF extractor with premium features * struct PremiumPdfExtractor; * * impl Plugin for PremiumPdfExtractor { * fn name(&self) -> &str { "premium-pdf" } * fn version(&self) -> String { "2.0.0".to_string() } * fn initialize(&self) -> Result<()> { Ok(()) } * fn shutdown(&self) -> Result<()> { Ok(()) } * } * * #[async_trait] * impl DocumentExtractor for PremiumPdfExtractor { * async fn extract_bytes(&self, content: &[u8], mime_type: &str, config: &ExtractionConfig) * -> Result { * // Premium extraction logic with better accuracy * let mut doc = InternalDocument::new("pdf"); * // ... populate doc.elements, doc.metadata, etc. * Ok(doc) * } * * fn supported_mime_types(&self) -> &[&str] { * &["application/pdf"] * } * * fn priority(&self) -> i32 { * 100 // Higher than default (50) - will be preferred * } * } * \endcode */ typedef struct KREUZBERGDocumentExtractor KREUZBERGDocumentExtractor; /** * A single node in the document tree. * * Each node has deterministic `id`, typed `content`, optional `parent`/`children` * for tree structure, and metadata like page number, bounding box, and content layer. */ typedef struct KREUZBERGDocumentNode KREUZBERGDocumentNode; /** * A resolved relationship between two nodes in the document tree. */ typedef struct KREUZBERGDocumentRelationship KREUZBERGDocumentRelationship; /** * Top-level structured document representation. * * A flat array of nodes with index-based parent/child references forming a tree. * Root-level nodes have `parent: None`. Use `body_roots()` and `furniture_roots()` * to iterate over top-level content by layer. * * # Validation * * Call `validate()` after construction to verify all node indices are in bounds * and parent-child relationships are bidirectionally consistent. */ typedef struct KREUZBERGDocumentStructure KREUZBERGDocumentStructure; /** * Application properties from docProps/app.xml for DOCX * * Contains Word-specific document statistics and metadata. */ typedef struct KREUZBERGDocxAppProperties KREUZBERGDocxAppProperties; /** * Word document metadata. * * Extracted from DOCX files using shared Office Open XML metadata extraction. * Integrates with `office_metadata` module for core/app/custom properties. */ typedef struct KREUZBERGDocxMetadata KREUZBERGDocxMetadata; /** * Semantic element extracted from document. * * Represents a logical unit of content with semantic classification, * unique identifier, and metadata for tracking origin and position. */ typedef struct KREUZBERGElement KREUZBERGElement; /** * Metadata for a semantic element. */ typedef struct KREUZBERGElementMetadata KREUZBERGElementMetadata; /** * Semantic element type classification. * * Categorizes text content into semantic units for downstream processing. * Supports the element types commonly found in Unstructured documents. */ typedef struct KREUZBERGElementType KREUZBERGElementType; /** * Email attachment representation. * * Contains metadata and optionally the content of an email attachment. */ typedef struct KREUZBERGEmailAttachment KREUZBERGEmailAttachment; /** * Configuration for email extraction. */ typedef struct KREUZBERGEmailConfig KREUZBERGEmailConfig; /** * Email extraction result. * * Complete representation of an extracted email message (.eml or .msg) * including headers, body content, and attachments. */ typedef struct KREUZBERGEmailExtractionResult KREUZBERGEmailExtractionResult; /** * Email metadata extracted from .eml and .msg files. * * Includes sender/recipient information, message ID, and attachment list. */ typedef struct KREUZBERGEmailMetadata KREUZBERGEmailMetadata; /** * Embedded file descriptor extracted from the PDF name tree. */ typedef struct KREUZBERGEmbeddedFile KREUZBERGEmbeddedFile; /** * Trait for in-process embedding backend plugins. * * Async to match the convention used by `OcrBackend`, * `DocumentExtractor`, and `PostProcessor`. * Host-language bridges (PyO3, napi-rs, Rustler, extendr, magnus, ext-php-rs, * C FFI, etc.) wrap their synchronous host callables in `spawn_blocking` or the * equivalent to satisfy the async signature. * * # Thread safety * * Backends must be `Send + Sync + 'static`. They are stored in * `Arc` and called concurrently from kreuzberg's chunking * pipeline. If the backend's underlying model isn't thread-safe, the backend * itself must serialize access internally (e.g. via `Mutex`). * * # Contract * * - `embed(texts)` MUST return exactly `texts.len()` vectors, each of length * `self.dimensions()`. The dispatcher in `embed_texts` * validates this before returning to downstream consumers; a non-conforming * backend surfaces as a `KreuzbergError::Validation`, not a panic. * - `embed` may be called from any thread. Its future must be `Send` * (enforced by `async_trait` when `#[async_trait]` is used on non-WASM targets). * - `dimensions()` is called exactly once at registration, immediately after * `initialize()` succeeds. The returned value is cached by the registry and * used for all subsequent shape validation. Lazy-loading implementations can * defer model loading into `initialize()` and report the real dimension * afterwards. Later mutations of the backend's reported dimension are not * observed by kreuzberg — implementations that need to change dimension * must unregister and re-register. * - `shutdown()` (inherited from `Plugin`) may be invoked * concurrently with an in-flight `embed()` call. Implementations must * tolerate this — e.g. by letting in-flight calls finish using resources * held via the `Arc` reference, and only releasing * shared state that isn't needed by `embed`. * * # Runtime * * The synchronous `embed_texts` entry uses * [`tokio::task::block_in_place`] to await the trait's async `embed`, which * requires a multi-thread tokio runtime. Callers running inside a * `current_thread` runtime (e.g. `#[tokio::test]` without `flavor = "multi_thread"`, * or `tokio::runtime::Builder::new_current_thread()`) must use * `embed_texts_async` instead, which awaits directly without * `block_in_place`. */ typedef struct KREUZBERGEmbeddingBackend KREUZBERGEmbeddingBackend; /** * Embedding configuration for text chunks. * * Configures embedding generation using ONNX models via the vendored embedding engine. * Requires the `embeddings` feature to be enabled. */ typedef struct KREUZBERGEmbeddingConfig KREUZBERGEmbeddingConfig; /** * Embedding model types supported by Kreuzberg. */ typedef struct KREUZBERGEmbeddingModelType KREUZBERGEmbeddingModelType; /** * Preset configurations for common RAG use cases. * * Each preset combines chunk size, overlap, and embedding model * to provide an optimized configuration for specific scenarios. * * All string fields are owned `String` for FFI compatibility — instances * are safe to clone and pass across language boundaries. */ typedef struct KREUZBERGEmbeddingPreset KREUZBERGEmbeddingPreset; /** * EPUB metadata (Dublin Core extensions). */ typedef struct KREUZBERGEpubMetadata KREUZBERGEpubMetadata; /** * Error metadata (for batch operations). */ typedef struct KREUZBERGErrorMetadata KREUZBERGErrorMetadata; /** * Excel/spreadsheet format metadata. * * Identifies the document as a spreadsheet source via the `FormatMetadata::Excel` * discriminant. Sheet count and sheet names are stored inside this struct. */ typedef struct KREUZBERGExcelMetadata KREUZBERGExcelMetadata; /** * Single Excel worksheet. * * Represents one sheet from an Excel workbook with its content * converted to Markdown format and dimensional statistics. */ typedef struct KREUZBERGExcelSheet KREUZBERGExcelSheet; /** * Excel workbook representation. * * Contains all sheets from an Excel file (.xlsx, .xls, etc.) with * extracted content and metadata. */ typedef struct KREUZBERGExcelWorkbook KREUZBERGExcelWorkbook; /** * ONNX Runtime execution provider type. * * Determines which hardware backend is used for model inference. * `Auto` (default) selects the best available provider per platform. */ typedef struct KREUZBERGExecutionProviderType KREUZBERGExecutionProviderType; /** * Extracted image from a document. * * Contains raw image data, metadata, and optional nested OCR results. * Raw bytes allow cross-language compatibility - users can convert to * PIL.Image (Python), Sharp (Node.js), or other formats as needed. */ typedef struct KREUZBERGExtractedImage KREUZBERGExtractedImage; /** * A URI extracted from a document. * * Represents any link, reference, or resource pointer found during extraction. * The `kind` field classifies the URI semantically, while `label` carries * optional human-readable display text. */ typedef struct KREUZBERGExtractedUri KREUZBERGExtractedUri; /** * Main extraction configuration. * * This struct contains all configuration options for the extraction process. * It can be loaded from TOML, YAML, or JSON files, or created programmatically. * \code * use kreuzberg::core::config::ExtractionConfig; * * // Create with defaults * let config = ExtractionConfig::default(); * * // Load from TOML file * // let config = ExtractionConfig::from_toml_file("kreuzberg.toml")?; * \endcode */ typedef struct KREUZBERGExtractionConfig KREUZBERGExtractionConfig; /** * How the extracted text was produced. */ typedef struct KREUZBERGExtractionMethod KREUZBERGExtractionMethod; /** * General extraction result used by the core extraction API. * * This is the main result type returned by all extraction functions. */ typedef struct KREUZBERGExtractionResult KREUZBERGExtractionResult; /** * FictionBook (FB2) metadata. */ typedef struct KREUZBERGFictionBookMetadata KREUZBERGFictionBookMetadata; /** * Per-file extraction configuration overrides for batch processing. * * All fields are `Option` — `None` means "use the batch-level default." * This type is used with `batch_extract_files` and * `batch_extract_bytes` to allow heterogeneous * extraction settings within a single batch. * * # Excluded Fields * * The following `ExtractionConfig` fields are batch-level only and * cannot be overridden per file: * - `max_concurrent_extractions` — controls batch parallelism * - `use_cache` — global caching policy * - `acceleration` — shared ONNX execution provider * - `security_limits` — global archive security policy * \code * use kreuzberg::FileExtractionConfig; * * // Override just OCR forcing for a specific file * let config = FileExtractionConfig { * force_ocr: Some(true), * ..Default::default() * }; * \endcode */ typedef struct KREUZBERGFileExtractionConfig KREUZBERGFileExtractionConfig; /** * Footnote in Djot. */ typedef struct KREUZBERGFootnote KREUZBERGFootnote; /** * Format-specific metadata (discriminated union). * * Only one format type can exist per extraction result. This provides * type-safe, clean metadata without nested optionals. */ typedef struct KREUZBERGFormatMetadata KREUZBERGFormatMetadata; /** * Block-level element in a Djot document. * * Represents structural elements like headings, paragraphs, lists, code blocks, etc. */ typedef struct KREUZBERGFormattedBlock KREUZBERGFormattedBlock; /** * Individual grid cell with position and span metadata. */ typedef struct KREUZBERGGridCell KREUZBERGGridCell; /** * Header/heading element metadata. */ typedef struct KREUZBERGHeaderMetadata KREUZBERGHeaderMetadata; /** * Heading context for a chunk within a Markdown document. * * Contains the heading hierarchy from document root to this chunk's section. */ typedef struct KREUZBERGHeadingContext KREUZBERGHeadingContext; /** * A single heading in the hierarchy. */ typedef struct KREUZBERGHeadingLevel KREUZBERGHeadingLevel; /** * A text block with hierarchy level assignment. * * Represents a block of text with semantic heading information extracted from * font size clustering and hierarchical analysis. */ typedef struct KREUZBERGHierarchicalBlock KREUZBERGHierarchicalBlock; /** * Hierarchy extraction configuration for PDF text structure analysis. * * Enables extraction of document hierarchy levels (H1-H6) based on font size * clustering and semantic analysis. When enabled, hierarchical blocks are * included in page content. */ typedef struct KREUZBERGHierarchyConfig KREUZBERGHierarchyConfig; /** * HTML metadata extracted from HTML documents. * * Includes document-level metadata, Open Graph data, Twitter Card metadata, * and extracted structural elements (headers, links, images, structured data). */ typedef struct KREUZBERGHtmlMetadata KREUZBERGHtmlMetadata; /** * Configuration for styled HTML output. * * When set on [`ExtractionConfig::html_output`] alongside * `output_format = OutputFormat::Html`, the pipeline builds a * `StyledHtmlRenderer` (crate::rendering::StyledHtmlRenderer) instead of * the plain comrak-based renderer. * \code * use kreuzberg::core::config::{HtmlOutputConfig, HtmlTheme}; * * let config = HtmlOutputConfig { * theme: HtmlTheme::GitHub, * css: Some(".kb-p { font-size: 1.1rem; }".to_string()), * ..Default::default() * }; * \endcode */ typedef struct KREUZBERGHtmlOutputConfig KREUZBERGHtmlOutputConfig; /** * Built-in HTML theme selection. */ typedef struct KREUZBERGHtmlTheme KREUZBERGHtmlTheme; /** * Image extraction configuration. */ typedef struct KREUZBERGImageExtractionConfig KREUZBERGImageExtractionConfig; /** * Heuristic classification of what an image likely depicts. */ typedef struct KREUZBERGImageKind KREUZBERGImageKind; /** * Image metadata extracted from image files. * * Includes dimensions, format, and EXIF data. */ typedef struct KREUZBERGImageMetadata KREUZBERGImageMetadata; /** * Image element metadata. */ typedef struct KREUZBERGImageMetadataType KREUZBERGImageMetadataType; /** * Image preprocessing configuration for OCR. * * These settings control how images are preprocessed before OCR to improve * text recognition quality. Different preprocessing strategies work better * for different document types. */ typedef struct KREUZBERGImagePreprocessingConfig KREUZBERGImagePreprocessingConfig; /** * Image preprocessing metadata. * * Tracks the transformations applied to an image during OCR preprocessing, * including DPI normalization, resizing, and resampling. */ typedef struct KREUZBERGImagePreprocessingMetadata KREUZBERGImagePreprocessingMetadata; /** * Image type classification. */ typedef struct KREUZBERGImageType KREUZBERGImageType; /** * Inline element within a block. * * Represents text with formatting, links, images, etc. */ typedef struct KREUZBERGInlineElement KREUZBERGInlineElement; /** * Types of inline elements in Djot. */ typedef struct KREUZBERGInlineType KREUZBERGInlineType; /** * JATS (Journal Article Tag Suite) metadata. */ typedef struct KREUZBERGJatsMetadata KREUZBERGJatsMetadata; /** * Extracted keyword with metadata. */ typedef struct KREUZBERGKeyword KREUZBERGKeyword; /** * Keyword algorithm selection. */ typedef struct KREUZBERGKeywordAlgorithm KREUZBERGKeywordAlgorithm; /** * Keyword extraction configuration. */ typedef struct KREUZBERGKeywordConfig KREUZBERGKeywordConfig; /** * Language detection configuration. */ typedef struct KREUZBERGLanguageDetectionConfig KREUZBERGLanguageDetectionConfig; /** * The 17 canonical document layout classes. * * All model backends (RT-DETR, YOLO, etc.) map their native class IDs * to this shared set. Models with fewer classes (DocLayNet: 11, PubLayNet: 5) * map to the closest equivalent. * * Wire format is snake_case in all serializers (JSON, TOML, YAML). */ typedef struct KREUZBERGLayoutClass KREUZBERGLayoutClass; /** * A single layout detection result. */ typedef struct KREUZBERGLayoutDetection KREUZBERGLayoutDetection; /** * Layout detection configuration. * * Controls layout detection behavior in the extraction pipeline. * When set on `ExtractionConfig` (super::ExtractionConfig), layout detection * is enabled for PDF extraction. */ typedef struct KREUZBERGLayoutDetectionConfig KREUZBERGLayoutDetectionConfig; /** * A detected layout region on a page. * * When layout detection is enabled, each page may have layout regions * identifying different content types (text, pictures, tables, etc.) * with confidence scores and spatial positions. */ typedef struct KREUZBERGLayoutRegion KREUZBERGLayoutRegion; /** * Link element metadata. */ typedef struct KREUZBERGLinkMetadata KREUZBERGLinkMetadata; /** * Link type classification. */ typedef struct KREUZBERGLinkType KREUZBERGLinkType; /** * Type of list detection. */ typedef struct KREUZBERGListType KREUZBERGListType; /** * Configuration for an LLM provider/model via liter-llm. * * Each feature (VLM OCR, VLM embeddings, structured extraction) carries * its own `LlmConfig`, allowing different providers per feature. * \code * [structured_extraction.llm] * model = "openai/gpt-4o" * api_key = "sk-..." # or use KREUZBERG_LLM_API_KEY env var * \endcode */ typedef struct KREUZBERGLlmConfig KREUZBERGLlmConfig; /** * Token usage and cost data for a single LLM call made during extraction. * * Populated when VLM OCR, structured extraction, or LLM-based embeddings * are used. Multiple entries may be present when multiple LLM calls occur * within one extraction (e.g. VLM OCR + structured extraction). */ typedef struct KREUZBERGLlmUsage KREUZBERGLlmUsage; /** * Extraction result metadata. * * Contains common fields applicable to all formats, format-specific metadata * via a discriminated union, and additional custom fields from postprocessors. */ typedef struct KREUZBERGMetadata KREUZBERGMetadata; /** * Combined paths to all models needed for OCR (backward compatibility). */ typedef struct KREUZBERGModelPaths KREUZBERGModelPaths; /** * Tagged enum for node content. Each variant carries only type-specific data. * * Uses `#[serde(tag = "node_type")]` to avoid "type" keyword collision in * Go/Java/TypeScript bindings. */ typedef struct KREUZBERGNodeContent KREUZBERGNodeContent; /** * Trait for OCR backend plugins. * * Implement this trait to add custom OCR capabilities. OCR backends can be: * - Native Rust implementations (like Tesseract) * - FFI bridges to Python libraries (like EasyOCR, PaddleOCR) * - Cloud-based OCR services (Google Vision, AWS Textract, etc.) * * # Thread Safety * * OCR backends must be thread-safe (`Send + Sync`) to support concurrent processing. * \code * use kreuzberg::plugins::{Plugin, OcrBackend, OcrBackendType}; * use kreuzberg::{Result, OcrConfig}; * use async_trait::async_trait; * use std::borrow::Cow; * use std::path::Path; * use kreuzberg::types::{ExtractionResult, Metadata}; * * struct CustomOcrBackend; * * impl Plugin for CustomOcrBackend { * fn name(&self) -> &str { "custom-ocr" } * fn version(&self) -> String { "1.0.0".to_string() } * fn initialize(&self) -> Result<()> { Ok(()) } * fn shutdown(&self) -> Result<()> { Ok(()) } * } * * #[async_trait] * impl OcrBackend for CustomOcrBackend { * async fn process_image(&self, image_bytes: &[u8], config: &OcrConfig) -> Result { * // Implement OCR logic here * Ok(ExtractionResult { * content: "Extracted text".to_string(), * mime_type: Cow::Borrowed("text/plain"), * ..Default::default() * }) * } * * async fn process_image_file(&self, path: &Path, config: &OcrConfig) -> Result { * let bytes = std::fs::read(path)?; * self.process_image(&bytes, config).await * } * * fn supports_language(&self, lang: &str) -> bool { * matches!(lang, "eng" | "deu" | "fra") * } * * fn backend_type(&self) -> OcrBackendType { * OcrBackendType::Custom * } * } * \endcode */ typedef struct KREUZBERGOcrBackend KREUZBERGOcrBackend; /** * OCR backend types. */ typedef struct KREUZBERGOcrBackendType KREUZBERGOcrBackendType; /** * Bounding geometry for an OCR element. * * Supports both axis-aligned rectangles (from Tesseract) and 4-point quadrilaterals * (from PaddleOCR and rotated text detection). */ typedef struct KREUZBERGOcrBoundingGeometry KREUZBERGOcrBoundingGeometry; /** * Confidence scores for an OCR element. * * Separates detection confidence (how confident that text exists at this location) * from recognition confidence (how confident about the actual text content). */ typedef struct KREUZBERGOcrConfidence KREUZBERGOcrConfidence; /** * OCR configuration. */ typedef struct KREUZBERGOcrConfig KREUZBERGOcrConfig; /** * A unified OCR element representing detected text with full metadata. * * This is the primary type for structured OCR output, preserving all information * from both Tesseract and PaddleOCR backends. */ typedef struct KREUZBERGOcrElement KREUZBERGOcrElement; /** * Configuration for OCR element extraction. * * Controls how OCR elements are extracted and filtered. */ typedef struct KREUZBERGOcrElementConfig KREUZBERGOcrElementConfig; /** * Hierarchical level of an OCR element. * * Maps to Tesseract's page segmentation hierarchy and provides * equivalent semantics for PaddleOCR. */ typedef struct KREUZBERGOcrElementLevel KREUZBERGOcrElementLevel; /** * OCR extraction result. * * Result of performing OCR on an image or scanned document, * including recognized text and detected tables. */ typedef struct KREUZBERGOcrExtractionResult KREUZBERGOcrExtractionResult; /** * OCR processing metadata. * * Captures information about OCR processing configuration and results. */ typedef struct KREUZBERGOcrMetadata KREUZBERGOcrMetadata; /** * Multi-backend OCR pipeline with quality-based fallback. * * Backends are tried in priority order (highest first). After each backend * produces output, quality is evaluated. If it meets `quality_thresholds.pipeline_min_quality`, * the result is accepted. Otherwise the next backend is tried. */ typedef struct KREUZBERGOcrPipelineConfig KREUZBERGOcrPipelineConfig; /** * A single backend stage in the OCR pipeline. */ typedef struct KREUZBERGOcrPipelineStage KREUZBERGOcrPipelineStage; /** * Quality thresholds for OCR fallback decisions and pipeline quality gating. * * All fields default to the values that match the previous hardcoded behavior, * so `OcrQualityThresholds::default()` preserves existing semantics exactly. */ typedef struct KREUZBERGOcrQualityThresholds KREUZBERGOcrQualityThresholds; /** * Rotation information for an OCR element. */ typedef struct KREUZBERGOcrRotation KREUZBERGOcrRotation; /** * Table detected via OCR. * * Represents a table structure recognized during OCR processing. */ typedef struct KREUZBERGOcrTable KREUZBERGOcrTable; /** * Bounding box for an OCR-detected table in pixel coordinates. */ typedef struct KREUZBERGOcrTableBoundingBox KREUZBERGOcrTableBoundingBox; /** * Document orientation detection result. */ typedef struct KREUZBERGOrientationResult KREUZBERGOrientationResult; /** * Output format for extraction results. * * Controls the format of the `content` field in `ExtractionResult`. * When set to `Markdown`, `Djot`, or `Html`, the output uses that format. * `Plain` returns the raw extracted text. * `Structured` returns JSON with full OCR element data including bounding * boxes and confidence scores. */ typedef struct KREUZBERGOutputFormat KREUZBERGOutputFormat; /** * Page Segmentation Mode for Tesseract OCR */ typedef struct KREUZBERGPSMMode KREUZBERGPSMMode; /** * Supported languages in PaddleOCR. * * Maps user-friendly language codes to paddle-ocr-rs language identifiers. */ typedef struct KREUZBERGPaddleLanguage KREUZBERGPaddleLanguage; /** * Configuration for PaddleOCR backend. * * Configures PaddleOCR text detection and recognition with multi-language support. * Uses a builder pattern for convenient configuration. * \code * use kreuzberg::PaddleOcrConfig; * * // Create with default English configuration * let config = PaddleOcrConfig::new("en"); * * // Create with custom cache directory * let config = PaddleOcrConfig::new("ch") * .with_cache_dir("/path/to/cache".into()); * * // Enable table detection * let config = PaddleOcrConfig::new("en") * .with_table_detection(true); * \endcode */ typedef struct KREUZBERGPaddleOcrConfig KREUZBERGPaddleOcrConfig; /** * Byte offset boundary for a page. * * Tracks where a specific page's content starts and ends in the main content string, * enabling mapping from byte positions to page numbers. Offsets are guaranteed to be * at valid UTF-8 character boundaries when using standard String methods (push_str, push, etc.). */ typedef struct KREUZBERGPageBoundary KREUZBERGPageBoundary; /** * Page extraction and tracking configuration. * * Controls how pages are extracted, tracked, and represented in the extraction results. * When `None`, page tracking is disabled. * * Page range tracking in chunk metadata (first_page/last_page) is automatically enabled * when page boundaries are available and chunking is configured. */ typedef struct KREUZBERGPageConfig KREUZBERGPageConfig; /** * Content for a single page/slide. * * When page extraction is enabled, documents are split into per-page content * with associated tables and images mapped to each page. * * # Performance * * Uses Arc-wrapped tables and images for memory efficiency: * - `Vec>` enables zero-copy sharing of table data * - `Vec>` enables zero-copy sharing of image data * - Maintains exact JSON compatibility via custom Serialize/Deserialize * * This reduces memory overhead for documents with shared tables/images * by avoiding redundant copies during serialization. */ typedef struct KREUZBERGPageContent KREUZBERGPageContent; /** * Page hierarchy structure containing heading levels and block information. * * Used when PDF text hierarchy extraction is enabled. Contains hierarchical * blocks with heading levels (H1-H6) for semantic document structure. */ typedef struct KREUZBERGPageHierarchy KREUZBERGPageHierarchy; /** * Metadata for individual page/slide/sheet. * * Captures per-page information including dimensions, content counts, * and visibility state (for presentations). */ typedef struct KREUZBERGPageInfo KREUZBERGPageInfo; /** * Unified page structure for documents. * * Supports different page types (PDF pages, PPTX slides, Excel sheets) * with character offset boundaries for chunk-to-page mapping. */ typedef struct KREUZBERGPageStructure KREUZBERGPageStructure; /** * Type of paginated unit in a document. * * Distinguishes between different types of "pages" (PDF pages, presentation slides, spreadsheet * sheets). */ typedef struct KREUZBERGPageUnitType KREUZBERGPageUnitType; /** * A PDF annotation extracted from a document page. */ typedef struct KREUZBERGPdfAnnotation KREUZBERGPdfAnnotation; /** * Type of PDF annotation. */ typedef struct KREUZBERGPdfAnnotationType KREUZBERGPdfAnnotationType; /** * PDF-specific configuration. */ typedef struct KREUZBERGPdfConfig KREUZBERGPdfConfig; /** * PDF-specific metadata. * * Contains metadata fields specific to PDF documents that are not in the common * `Metadata` structure. Common fields like title, authors, keywords, and dates * are at the `Metadata` level. */ typedef struct KREUZBERGPdfMetadata KREUZBERGPdfMetadata; /** * Base trait that all plugins must implement. * * This trait provides common functionality for plugin lifecycle management, * identification, and metadata. * * # Thread Safety * * All plugins must be `Send + Sync` to support concurrent usage across threads. * \code * use kreuzberg::plugins::Plugin; * use kreuzberg::Result; * use std::sync::atomic::{AtomicBool, Ordering}; * * struct MyPlugin { * initialized: AtomicBool, * } * * impl Plugin for MyPlugin { * fn name(&self) -> &str { * "my-plugin" * } * * fn version(&self) -> String { * "1.0.0".to_string() * } * * fn initialize(&self) -> Result<()> { * self.initialized.store(true, Ordering::Release); * println!("Plugin initialized!"); * Ok(()) * } * * fn shutdown(&self) -> Result<()> { * self.initialized.store(false, Ordering::Release); * println!("Plugin shutdown!"); * Ok(()) * } * } * \endcode */ typedef struct KREUZBERGPlugin KREUZBERGPlugin; /** * Trait for post-processor plugins. * * Post-processors transform or enrich extraction results after the initial * extraction is complete. They can: * - Clean and normalize text * - Add metadata (language, keywords, entities) * - Split content into chunks * - Score quality * - Apply custom transformations * * # Processing Order * * Post-processors are executed in stage order: * 1. **Early** - Language detection, entity extraction * 2. **Middle** - Keyword extraction, token reduction * 3. **Late** - Custom hooks, final validation * * Within each stage, processors are executed in registration order. * * # Error Handling * * Post-processor errors are non-fatal by default - they're captured in metadata * and execution continues. To make errors fatal, return an error from `process()`. * * # Thread Safety * * Post-processors must be thread-safe (`Send + Sync`). * \code * use kreuzberg::plugins::{Plugin, PostProcessor, ProcessingStage}; * use kreuzberg::{Result, ExtractionResult, ExtractionConfig}; * use async_trait::async_trait; * * /// Add word count metadata to extraction results * struct WordCountProcessor; * * impl Plugin for WordCountProcessor { * fn name(&self) -> &str { "word-count" } * fn version(&self) -> String { "1.0.0".to_string() } * fn initialize(&self) -> Result<()> { Ok(()) } * fn shutdown(&self) -> Result<()> { Ok(()) } * } * * #[async_trait] * impl PostProcessor for WordCountProcessor { * async fn process(&self, result: &mut ExtractionResult, config: &ExtractionConfig) * -> Result<()> { * // Count words * let word_count = result.content.split_whitespace().count(); * * // Add to metadata * result.metadata.additional.insert("word_count".to_string().into(), serde_json::json!(word_count)); * * Ok(()) * } * * fn processing_stage(&self) -> ProcessingStage { * ProcessingStage::Early * } * } * \endcode */ typedef struct KREUZBERGPostProcessor KREUZBERGPostProcessor; /** * Post-processor configuration. */ typedef struct KREUZBERGPostProcessorConfig KREUZBERGPostProcessorConfig; /** * Application properties from docProps/app.xml for PPTX * * Contains PowerPoint-specific document metadata. */ typedef struct KREUZBERGPptxAppProperties KREUZBERGPptxAppProperties; /** * PowerPoint (PPTX) extraction result. * * Contains extracted slide content, metadata, and embedded images/tables. */ typedef struct KREUZBERGPptxExtractionResult KREUZBERGPptxExtractionResult; /** * PowerPoint presentation metadata. * * Extracted from PPTX files containing slide counts and presentation details. */ typedef struct KREUZBERGPptxMetadata KREUZBERGPptxMetadata; /** * Processing stages for post-processors. * * Post-processors are executed in stage order (Early → Middle → Late). * Use stages to control the order of post-processing operations. */ typedef struct KREUZBERGProcessingStage KREUZBERGProcessingStage; /** * A non-fatal warning from a processing pipeline stage. * * Captures errors from optional features that don't prevent extraction * but may indicate degraded results. */ typedef struct KREUZBERGProcessingWarning KREUZBERGProcessingWarning; /** * Outlook PST archive metadata. */ typedef struct KREUZBERGPstMetadata KREUZBERGPstMetadata; /** * RAKE-specific parameters. */ typedef struct KREUZBERGRakeParams KREUZBERGRakeParams; /** * Pre-computed table markdown for a table detection region. * * Produced by the TATR-based table structure recognizer and surfaced as part of * layout-aware OCR results. The struct lives here (under `layout-types`, pure-Rust) * so that consumers who do not enable `layout-detection` (ORT) can still reference * the type in their own code. */ typedef struct KREUZBERGRecognizedTable KREUZBERGRecognizedTable; typedef struct KREUZBERGReductionLevel KREUZBERGReductionLevel; /** * Semantic kind of a relationship between document elements. */ typedef struct KREUZBERGRelationshipKind KREUZBERGRelationshipKind; /** * Trait for document renderers that convert [`InternalDocument`] to output strings. * * Renderers are typically stateless converters that transform the internal * document representation into a specific output format (Markdown, HTML, * Djot, plain text, etc.). They participate in the standard [`Plugin`] * lifecycle so custom renderers can be registered from any supported binding * language. * * The format name is exposed via [`Plugin::name`]. For stateless renderers * the [`Plugin`] lifecycle methods (`version`, `initialize`, `shutdown`) all * take no-op defaults and need not be overridden. * * # Thread Safety * * Renderers must be `Send + Sync` (inherited from [`Plugin`]). * \code * use kreuzberg::plugins::{Plugin, Renderer}; * use kreuzberg::types::internal::InternalDocument; * use kreuzberg::Result; * * struct CustomRenderer; * * impl Plugin for CustomRenderer { * fn name(&self) -> &str { "custom" } * } * * impl Renderer for CustomRenderer { * fn render(&self, doc: &InternalDocument) -> Result { * Ok(format!("Custom output with {} elements", doc.elements.len())) * } * } * \endcode */ typedef struct KREUZBERGRenderer KREUZBERGRenderer; /** * Result-shape selection for extraction results. * * Distinct from `OutputFormat` (which controls rendering — Plain, Markdown, * HTML, etc.). `ResultFormat` controls the *shape* of the result: a unified content * blob vs. an element-based decomposition. */ typedef struct KREUZBERGResultFormat KREUZBERGResultFormat; /** * Configuration for security limits across extractors. * * All limits are intentionally conservative to prevent DoS attacks * while still supporting legitimate documents. */ typedef struct KREUZBERGSecurityLimits KREUZBERGSecurityLimits; /** * API server configuration. * * This struct holds all configuration options for the Kreuzberg API server, * including host/port settings, CORS configuration, and upload limits. * * # Defaults * * - `host`: "127.0.0.1" (localhost only) * - `port`: 8000 * - `cors_origins`: empty vector (allows all origins) * - `max_request_body_bytes`: 104_857_600 (100 MB) * - `max_multipart_field_bytes`: 104_857_600 (100 MB) */ typedef struct KREUZBERGServerConfig KREUZBERGServerConfig; /** * Structured data (Schema.org, microdata, RDFa) block. */ typedef struct KREUZBERGStructuredData KREUZBERGStructuredData; typedef struct KREUZBERGStructuredDataResult KREUZBERGStructuredDataResult; /** * Structured data type classification. */ typedef struct KREUZBERGStructuredDataType KREUZBERGStructuredDataType; /** * Configuration for LLM-based structured data extraction. * * Sends extracted document content to a VLM with a JSON schema, * returning structured data that conforms to the schema. * \code * [structured_extraction] * schema_name = "invoice_data" * strict = true * * [structured_extraction.schema] * type = "object" * properties.vendor = { type = "string" } * properties.total = { type = "number" } * required = ["vendor", "total"] * * [structured_extraction.llm] * model = "openai/gpt-4o" * \endcode */ typedef struct KREUZBERGStructuredExtractionConfig KREUZBERGStructuredExtractionConfig; /** * A supported document format entry. * * Represents a file extension and its corresponding MIME type that Kreuzberg can process. */ typedef struct KREUZBERGSupportedFormat KREUZBERGSupportedFormat; /** * Extracted table structure. * * Represents a table detected and extracted from a document (PDF, image, etc.). * Tables are converted to both structured cell data and Markdown format. */ typedef struct KREUZBERGTable KREUZBERGTable; /** * Individual table cell with content and optional styling. * * Future extension point for rich table support with cell-level metadata. */ typedef struct KREUZBERGTableCell KREUZBERGTableCell; /** * Structured table grid with cell-level metadata. * * Stores row/column dimensions and a flat list of cells with position info. */ typedef struct KREUZBERGTableGrid KREUZBERGTableGrid; /** * Which table structure recognition model to use. * * Controls the model used for table cell detection within layout-detected * table regions. Wire format is snake_case in all serializers (JSON, TOML, * YAML). */ typedef struct KREUZBERGTableModel KREUZBERGTableModel; /** * Tesseract OCR configuration. * * Provides fine-grained control over Tesseract OCR engine parameters. * Most users can use the defaults, but these settings allow optimization * for specific document types (invoices, handwriting, etc.). */ typedef struct KREUZBERGTesseractConfig KREUZBERGTesseractConfig; /** * Inline text annotation — byte-range based formatting and links. * * Annotations reference byte offsets into the node's text content, * enabling precise identification of formatted regions. */ typedef struct KREUZBERGTextAnnotation KREUZBERGTextAnnotation; /** * Text direction enumeration for HTML documents. */ typedef struct KREUZBERGTextDirection KREUZBERGTextDirection; /** * Plain text and Markdown extraction result. * * Contains the extracted text along with statistics and, * for Markdown files, structural elements like headers and links. */ typedef struct KREUZBERGTextExtractionResult KREUZBERGTextExtractionResult; /** * Text/Markdown metadata. * * Extracted from plain text and Markdown files. Includes word counts and, * for Markdown, structural elements like headers and links. */ typedef struct KREUZBERGTextMetadata KREUZBERGTextMetadata; typedef struct KREUZBERGTokenReductionConfig KREUZBERGTokenReductionConfig; /** * Token reduction configuration. */ typedef struct KREUZBERGTokenReductionOptions KREUZBERGTokenReductionOptions; /** * Configuration for tree-sitter language pack integration. * * Controls grammar download behavior and code analysis options. * * # Example (TOML) * * ```toml * [tree_sitter] * languages = ["python", "rust"] * groups = ["web"] * * [tree_sitter.process] * structure = true * comments = true * docstrings = true * ``` */ typedef struct KREUZBERGTreeSitterConfig KREUZBERGTreeSitterConfig; /** * Processing options for tree-sitter code analysis. * * Controls which analysis features are enabled when extracting code files. */ typedef struct KREUZBERGTreeSitterProcessConfig KREUZBERGTreeSitterProcessConfig; /** * Semantic classification of an extracted URI. */ typedef struct KREUZBERGUriKind KREUZBERGUriKind; /** * Trait for validator plugins. * * Validators check extraction results for quality, completeness, or correctness. * Unlike post-processors, validator errors **fail fast** - if a validator returns * an error, the extraction fails immediately. * * # Use Cases * * - **Quality Gates**: Ensure extracted content meets minimum quality standards * - **Compliance**: Verify content meets regulatory requirements * - **Content Filtering**: Reject documents containing unwanted content * - **Format Validation**: Verify extracted content structure * - **Security Checks**: Scan for malicious content * * # Error Handling * * Validator errors are **fatal** - they cause the extraction to fail and bubble up * to the caller. Use validators for hard requirements that must be met. * * For non-fatal checks, use post-processors instead. * * # Thread Safety * * Validators must be thread-safe (`Send + Sync`). * \code * use kreuzberg::plugins::{Plugin, Validator}; * use kreuzberg::{Result, ExtractionResult, ExtractionConfig, KreuzbergError}; * use async_trait::async_trait; * * /// Validate that extracted content has minimum length * struct MinimumLengthValidator { * min_length: usize, * } * * impl Plugin for MinimumLengthValidator { * fn name(&self) -> &str { "min-length-validator" } * fn version(&self) -> String { "1.0.0".to_string() } * fn initialize(&self) -> Result<()> { Ok(()) } * fn shutdown(&self) -> Result<()> { Ok(()) } * } * * #[async_trait] * impl Validator for MinimumLengthValidator { * async fn validate(&self, result: &ExtractionResult, config: &ExtractionConfig) * -> Result<()> { * if result.content.len() < self.min_length { * return Err(KreuzbergError::validation(format!( * "Content too short: {} < {} characters", * result.content.len(), * self.min_length * ))); * } * Ok(()) * } * } * \endcode */ typedef struct KREUZBERGValidator KREUZBERGValidator; /** * Application properties from docProps/app.xml for XLSX * * Contains Excel-specific document metadata. */ typedef struct KREUZBERGXlsxAppProperties KREUZBERGXlsxAppProperties; /** * XML extraction result. * * Contains extracted text content from XML files along with * structural statistics about the XML document. */ typedef struct KREUZBERGXmlExtractionResult KREUZBERGXmlExtractionResult; /** * XML metadata extracted during XML parsing. * * Provides statistics about XML document structure. */ typedef struct KREUZBERGXmlMetadata KREUZBERGXmlMetadata; /** * YAKE-specific parameters. */ typedef struct KREUZBERGYakeParams KREUZBERGYakeParams; /** * Year range for bibliographic metadata. */ typedef struct KREUZBERGYearRange KREUZBERGYearRange; /** * VTable for C plugin bridges implementing the `OcrBackend` trait. * * # Safety * * All function pointers must be valid for the lifetime of any bridge created from * this vtable. `free_user_data`, when non-null, is called once with `user_data` * when the bridge is dropped. */ typedef struct KREUZBERGKreuzbergOcrBackendVTable { /** * Return a null-terminated UTF-8 name string into `out_name`. */ void (*name_fn)(const void *user_data, char **out_name); /** * Return a null-terminated UTF-8 version string into `out_version`. */ void (*version_fn)(const void *user_data, char **out_version); /** * Initialise the plugin; return 0 on success, non-zero on failure (error text in `out_error`). */ int32_t (*initialize_fn)(const void *user_data, char **out_error); /** * Shut down the plugin; return 0 on success, non-zero on failure (error text in `out_error`). */ int32_t (*shutdown_fn)(const void *user_data, char **out_error); /** * Process an image and extract text via OCR. * * # Arguments * * * `image_bytes` - Raw image data (JPEG, PNG, TIFF, etc.) * * `config` - OCR configuration (language, PSM mode, etc.) * * # Returns * * An `ExtractionResult` containing the extracted text and metadata. * * # Errors * * - `KreuzbergError::Ocr` - OCR processing failed * - `KreuzbergError::Validation` - Invalid image format or configuration * - `KreuzbergError::Io` - I/O errors (these always bubble up) * * # Reading `backend_options` * * Backends that support runtime tuning can read `config.backend_options` and * deserialize only the keys they care about. Unknown keys are silently ignored, * so multiple backends can coexist in a pipeline without key conflicts. * * ```rust * async fn process_image(&self, image_bytes: &[u8], config: &OcrConfig) -> Result { * // Read backend-specific options; unknown keys are silently ignored. * let fast_mode = config.backend_options * .as_ref() * .and_then(|v| v.get("mode")) * .and_then(|v| v.as_str()) * .map(|s| s == "fast") * .unwrap_or(false); * * if image_bytes.is_empty() { * return Err(kreuzberg::KreuzbergError::Validation { * message: "Empty image data".to_string(), * source: None, * }); * } * * let text = if fast_mode { * "Fast OCR result".to_string() * } else { * format!("Extracted text in language: {}", config.language) * }; * * Ok(ExtractionResult { * content: text, * mime_type: Cow::Borrowed("text/plain"), * ..Default::default() * }) * } * ``` */ int32_t (*process_image)(const void *user_data, const uint8_t *image_bytes, uintptr_t image_bytes_len, const char *config, char **out_result, char **out_error); /** * Process a file and extract text via OCR. * * Default implementation reads the file and calls `process_image`. * Override for custom file handling or optimizations. * * # Arguments * * * `path` - Path to the image file * * `config` - OCR configuration * * # Errors * * Same as `process_image`, plus file I/O errors. */ int32_t (*process_image_file)(const void *user_data, const char *path, const char *config, char **out_result, char **out_error); /** * Check if this backend supports a given language code. * * # Arguments * * * `lang` - ISO 639-2/3 language code (e.g., "eng", "deu", "fra") * * # Returns * * `true` if the language is supported, `false` otherwise. * * # Example * * ```rust * fn supports_language(&self, lang: &str) -> bool { * self.languages.contains(&lang.to_string()) * } * ``` */ int32_t (*supports_language)(const void *user_data, const char *lang); /** * Get the backend type identifier. * * # Returns * * The backend type enum value. * * # Example * * ```rust * fn backend_type(&self) -> OcrBackendType { * OcrBackendType::Tesseract * } * ``` */ int32_t (*backend_type)(const void *user_data, char **out_result, char **out_error); /** * Optional: Get a list of all supported languages. * * Defaults to empty list. Override to provide comprehensive language support info. */ int32_t (*supported_languages)(const void *user_data, char **out_result, char **out_error); /** * Optional: Check if the backend supports table detection. * * Defaults to `false`. Override if your backend can detect and extract tables. */ int32_t (*supports_table_detection)(const void *user_data); /** * Check if the backend supports direct document-level processing (e.g. for PDFs). * * Defaults to `false`. Override if the backend has optimized document processing. */ int32_t (*supports_document_processing)(const void *user_data); /** * Process a document file directly via OCR. * * Only called if `supports_document_processing` returns `true`. * * # Arguments * * * `path` - Path to the document file (e.g. .pdf) * * `config` - OCR configuration */ int32_t (*process_document)(const void *user_data, const char *_path, const char *_config, char **out_result, char **out_error); /** * Optional destructor: called once with `user_data` when the bridge is dropped. */ void (*free_user_data)(void*); } KREUZBERGKreuzbergOcrBackendVTable; /** * VTable for C plugin bridges implementing the `PostProcessor` trait. * * # Safety * * All function pointers must be valid for the lifetime of any bridge created from * this vtable. `free_user_data`, when non-null, is called once with `user_data` * when the bridge is dropped. */ typedef struct KREUZBERGKreuzbergPostProcessorVTable { /** * Return a null-terminated UTF-8 name string into `out_name`. */ void (*name_fn)(const void *user_data, char **out_name); /** * Return a null-terminated UTF-8 version string into `out_version`. */ void (*version_fn)(const void *user_data, char **out_version); /** * Initialise the plugin; return 0 on success, non-zero on failure (error text in `out_error`). */ int32_t (*initialize_fn)(const void *user_data, char **out_error); /** * Shut down the plugin; return 0 on success, non-zero on failure (error text in `out_error`). */ int32_t (*shutdown_fn)(const void *user_data, char **out_error); /** * Process an extraction result. * * Transform or enrich the extraction result. Can modify: * - `content` - The extracted text * - `metadata` - Add or update metadata fields * - `tables` - Modify or enhance table data * * # Arguments * * * `result` - Mutable reference to the extraction result to process * * `config` - Extraction configuration * * # Returns * * `Ok(())` if processing succeeded, `Err(...)` for fatal failures. * * # Errors * * Return errors for fatal processing failures. Non-fatal errors should be * captured in metadata directly on the result. * * # Performance * * This signature avoids unnecessary cloning of large extraction results by * taking a mutable reference instead of ownership. Processors modify the * result in place. * * # Example - Language Detection * * ```rust * async fn process(&self, result: &mut ExtractionResult, config: &ExtractionConfig) * -> Result<()> { * // Detect language (simplified - use real detection library in practice) * let language = "en"; // Placeholder detection * * // Add to metadata * result.metadata.additional.insert("detected_language".to_string().into(), serde_json::json!(language)); * * Ok(()) * } * ``` * * # Example - Text Cleaning * * ```rust * async fn process(&self, result: &mut ExtractionResult, config: &ExtractionConfig) * -> Result<()> { * // Remove excessive whitespace * result.content = result * .content * .split_whitespace() * .collect::>() * .join(" "); * * Ok(()) * } * ``` */ int32_t (*process)(const void *user_data, const char *result, const char *config, char **out_error); /** * Get the processing stage for this post-processor. * * Determines when this processor runs in the pipeline. * * # Returns * * The `ProcessingStage` (Early, Middle, or Late). * * # Example * * ```rust * fn processing_stage(&self) -> ProcessingStage { * ProcessingStage::Early // Run before other processors * } * ``` */ int32_t (*processing_stage)(const void *user_data, char **out_result, char **out_error); /** * Optional: Check if this processor should run for a given result. * * Allows conditional processing based on MIME type, metadata, or content. * Defaults to `true` (always run). * * # Arguments * * * `result` - The extraction result to check * * `config` - Extraction configuration * * # Returns * * `true` if the processor should run, `false` to skip. * * # Example * * ```rust * Only process PDF documents * fn should_process(&self, result: &ExtractionResult, config: &ExtractionConfig) -> bool { * result.mime_type == "application/pdf" * } * ``` */ int32_t (*should_process)(const void *user_data, const char *_result, const char *_config); /** * Optional: Estimate processing time in milliseconds. * * Used for logging and debugging. Defaults to 0 (unknown). * * # Arguments * * * `result` - The extraction result to estimate for * * # Returns * * Estimated processing time in milliseconds. */ uint64_t (*estimated_duration_ms)(const void *user_data, const char *_result); /** * Execution priority within the processing stage. * * Higher values run first within the same `ProcessingStage`. Defaults to 50. * Use 0-49 for fallback processors, 50 for normal processors, and 51-255 * for high-priority processors that should run early in their stage. */ int32_t (*priority)(const void *user_data); /** * Optional destructor: called once with `user_data` when the bridge is dropped. */ void (*free_user_data)(void*); } KREUZBERGKreuzbergPostProcessorVTable; /** * VTable for C plugin bridges implementing the `Validator` trait. * * # Safety * * All function pointers must be valid for the lifetime of any bridge created from * this vtable. `free_user_data`, when non-null, is called once with `user_data` * when the bridge is dropped. */ typedef struct KREUZBERGKreuzbergValidatorVTable { /** * Return a null-terminated UTF-8 name string into `out_name`. */ void (*name_fn)(const void *user_data, char **out_name); /** * Return a null-terminated UTF-8 version string into `out_version`. */ void (*version_fn)(const void *user_data, char **out_version); /** * Initialise the plugin; return 0 on success, non-zero on failure (error text in `out_error`). */ int32_t (*initialize_fn)(const void *user_data, char **out_error); /** * Shut down the plugin; return 0 on success, non-zero on failure (error text in `out_error`). */ int32_t (*shutdown_fn)(const void *user_data, char **out_error); /** * Validate an extraction result. * * Check the extraction result and return `Ok(())` if valid, or an error * if validation fails. * * # Arguments * * * `result` - The extraction result to validate * * `config` - Extraction configuration * * # Returns * * - `Ok(())` if validation passes * - `Err(...)` if validation fails (extraction will fail) * * # Errors * * - `KreuzbergError::Validation` - Validation failed * - Any other error type appropriate for the failure * * # Example - Content Length Validation * * ```rust * async fn validate(&self, result: &ExtractionResult, config: &ExtractionConfig) * -> Result<()> { * let length = result.content.len(); * * if length < self.min { * return Err(KreuzbergError::validation(format!( * "Content too short: {} < {} characters", * length, self.min * ))); * } * * if length > self.max { * return Err(KreuzbergError::validation(format!( * "Content too long: {} > {} characters", * length, self.max * ))); * } * * Ok(()) * } * ``` * * # Example - Quality Score Validation * * ```rust * async fn validate(&self, result: &ExtractionResult, config: &ExtractionConfig) * -> Result<()> { * // Check if quality_score exists in metadata * let score = result.metadata * .additional * .get("quality_score") * .and_then(|v| v.as_f64()) * .unwrap_or(0.0); * * if score < self.min_score { * return Err(KreuzbergError::validation(format!( * "Quality score too low: {} < {}", * score, self.min_score * ))); * } * * Ok(()) * } * ``` * * # Example - Security Validation * * ```rust * async fn validate(&self, result: &ExtractionResult, config: &ExtractionConfig) * -> Result<()> { * // Check for blocked patterns * for pattern in &self.blocked_patterns { * if result.content.contains(pattern) { * return Err(KreuzbergError::validation(format!( * "Content contains blocked pattern: {}", * pattern * ))); * } * } * * Ok(()) * } * ``` */ int32_t (*validate)(const void *user_data, const char *result, const char *config, char **out_error); /** * Optional: Check if this validator should run for a given result. * * Allows conditional validation based on MIME type, metadata, or content. * Defaults to `true` (always run). * * # Arguments * * * `result` - The extraction result to check * * `config` - Extraction configuration * * # Returns * * `true` if the validator should run, `false` to skip. * * # Example * * ```rust * Only validate PDF documents * fn should_validate(&self, result: &ExtractionResult, config: &ExtractionConfig) -> bool { * result.mime_type == "application/pdf" * } * ``` */ int32_t (*should_validate)(const void *user_data, const char *_result, const char *_config); /** * Optional: Get the validation priority. * * Higher priority validators run first. Useful for ordering validation checks * (e.g., run cheap validations before expensive ones). * * Default priority is 50. * * # Returns * * Priority value (higher = runs earlier). * * # Example * * ```rust * Run this validator first (it's fast) * fn priority(&self) -> i32 { * 100 * } * ``` */ int32_t (*priority)(const void *user_data); /** * Optional destructor: called once with `user_data` when the bridge is dropped. */ void (*free_user_data)(void*); } KREUZBERGKreuzbergValidatorVTable; /** * VTable for C plugin bridges implementing the `EmbeddingBackend` trait. * * # Safety * * All function pointers must be valid for the lifetime of any bridge created from * this vtable. `free_user_data`, when non-null, is called once with `user_data` * when the bridge is dropped. */ typedef struct KREUZBERGKreuzbergEmbeddingBackendVTable { /** * Return a null-terminated UTF-8 name string into `out_name`. */ void (*name_fn)(const void *user_data, char **out_name); /** * Return a null-terminated UTF-8 version string into `out_version`. */ void (*version_fn)(const void *user_data, char **out_version); /** * Initialise the plugin; return 0 on success, non-zero on failure (error text in `out_error`). */ int32_t (*initialize_fn)(const void *user_data, char **out_error); /** * Shut down the plugin; return 0 on success, non-zero on failure (error text in `out_error`). */ int32_t (*shutdown_fn)(const void *user_data, char **out_error); /** * Embedding vector dimension. Must be `> 0` and must match the length of * every vector returned by `embed`. */ uintptr_t (*dimensions)(const void *user_data); /** * Embed a batch of texts, returning one vector per input in order. * * # Errors * * Implementations should return `Plugin` for * backend-specific failures. The dispatcher layers its own validation * (length, per-vector dimension) on top. */ int32_t (*embed)(const void *user_data, const char *texts, char **out_result, char **out_error); /** * Optional destructor: called once with `user_data` when the bridge is dropped. */ void (*free_user_data)(void*); } KREUZBERGKreuzbergEmbeddingBackendVTable; /** * VTable for C plugin bridges implementing the `DocumentExtractor` trait. * * # Safety * * All function pointers must be valid for the lifetime of any bridge created from * this vtable. `free_user_data`, when non-null, is called once with `user_data` * when the bridge is dropped. */ typedef struct KREUZBERGKreuzbergDocumentExtractorVTable { /** * Return a null-terminated UTF-8 name string into `out_name`. */ void (*name_fn)(const void *user_data, char **out_name); /** * Return a null-terminated UTF-8 version string into `out_version`. */ void (*version_fn)(const void *user_data, char **out_version); /** * Initialise the plugin; return 0 on success, non-zero on failure (error text in `out_error`). */ int32_t (*initialize_fn)(const void *user_data, char **out_error); /** * Shut down the plugin; return 0 on success, non-zero on failure (error text in `out_error`). */ int32_t (*shutdown_fn)(const void *user_data, char **out_error); /** * Extract content from a byte array. * * This is the core extraction method that processes in-memory document data. * * # Arguments * * * `content` - Raw document bytes * * `mime_type` - MIME type of the document (already validated) * * `config` - Extraction configuration * * # Returns * * An `InternalDocument` containing the extracted elements, metadata, and tables. * The pipeline will convert this into the public `ExtractionResult`. * * # Errors * * - `KreuzbergError::Parsing` - Document parsing failed * - `KreuzbergError::Validation` - Invalid document structure * - `KreuzbergError::Io` - I/O errors (these always bubble up) * - `KreuzbergError::MissingDependency` - Required dependency not available */ int32_t (*extract_bytes)(const void *user_data, const uint8_t *content, uintptr_t content_len, const char *mime_type, const char *config, char **out_result, char **out_error); /** * Extract content from a file. * * Default implementation reads the file and calls `extract_bytes`. * Override for custom file handling, streaming, or memory optimizations. * * # Arguments * * * `path` - Path to the document file * * `mime_type` - MIME type of the document (already validated) * * `config` - Extraction configuration * * # Returns * * An `InternalDocument` containing the extracted elements, metadata, and tables. * * # Errors * * Same as `extract_bytes`, plus file I/O errors. */ int32_t (*extract_file)(const void *user_data, const char *path, const char *mime_type, const char *config, char **out_result, char **out_error); /** * Get the list of MIME types supported by this extractor. * * Can include exact MIME types and prefix patterns: * - Exact: `"application/pdf"`, `"text/plain"` * - Prefix: `"image/*"` (matches any image type) * * # Returns * * A slice of MIME type strings. */ int32_t (*supported_mime_types)(const void *user_data, char **out_result, char **out_error); /** * Get the priority of this extractor. * * Higher priority extractors are preferred when multiple extractors * support the same MIME type. * * # Priority Guidelines * * - **0-25**: Fallback/low-quality extractors * - **26-49**: Alternative extractors * - **50**: Default priority (built-in extractors) * - **51-75**: Premium/enhanced extractors * - **76-100**: Specialized/high-priority extractors * * # Returns * * Priority value (default: 50) */ int32_t (*priority)(const void *user_data); /** * Optional: Check if this extractor can handle a specific file. * * Allows for more sophisticated detection beyond MIME types. * Defaults to `true` (rely on MIME type matching). * * # Arguments * * * `path` - Path to the file to check * * `mime_type` - Detected MIME type * * # Returns * * `true` if the extractor can handle this file, `false` otherwise. */ int32_t (*can_handle)(const void *user_data, const char *_path, const char *_mime_type); /** * Optional destructor: called once with `user_data` when the bridge is dropped. */ void (*free_user_data)(void*); } KREUZBERGKreuzbergDocumentExtractorVTable; /** * VTable for C plugin bridges implementing the `Renderer` trait. * * # Safety * * All function pointers must be valid for the lifetime of any bridge created from * this vtable. `free_user_data`, when non-null, is called once with `user_data` * when the bridge is dropped. */ typedef struct KREUZBERGKreuzbergRendererVTable { /** * Return a null-terminated UTF-8 name string into `out_name`. */ void (*name_fn)(const void *user_data, char **out_name); /** * Return a null-terminated UTF-8 version string into `out_version`. */ void (*version_fn)(const void *user_data, char **out_version); /** * Initialise the plugin; return 0 on success, non-zero on failure (error text in `out_error`). */ int32_t (*initialize_fn)(const void *user_data, char **out_error); /** * Shut down the plugin; return 0 on success, non-zero on failure (error text in `out_error`). */ int32_t (*shutdown_fn)(const void *user_data, char **out_error); /** * Render an [`InternalDocument`] to the output format. * * # Arguments * * * `doc` - The internal document to render * * # Returns * * The rendered output as a string. * * # Errors * * Returns an error if rendering fails. */ int32_t (*render)(const void *user_data, const char *doc, char **out_result, char **out_error); /** * Optional destructor: called once with `user_data` when the bridge is dropped. */ void (*free_user_data)(void*); } KREUZBERGKreuzbergRendererVTable; /** * Return the last error code (0 means no error). * # Safety * Caller must ensure all pointer arguments are valid or null. * This function does not allocate and returns no owned pointer. */ int32_t kreuzberg_last_error_code(void); /** * Return the last error message. The pointer is borrowed and valid until the next FFI call on this thread. * # Safety * Caller must ensure all pointer arguments are valid or null. * The returned pointer is borrowed from thread-local storage and must NOT be freed. */ const char *kreuzberg_last_error_context(void); /** * Free a string previously returned by this library. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_free_string(char *ptr); /** * Free a byte buffer previously returned by this library via out-params. * `ptr`, `len`, and `cap` must match the values written by the library function, * or the call must pass `ptr = null` (in which case it is a no-op). * # Safety * Pointer must have been returned by this library (via out_ptr / out_len / out_cap * out-params), or be null. The len and cap values must be unchanged since the call. */ void kreuzberg_free_bytes(uint8_t *ptr, uintptr_t len, uintptr_t cap); /** * Return the library version string. The pointer is static and must NOT be freed. * # Safety * Caller must ensure all pointer arguments are valid or null. * Returned pointers must be freed with the appropriate free function. */ const char *kreuzberg_version(void); /** * Create a `CacheStats` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_cache_stats_free`. */ KREUZBERGCacheStats *kreuzberg_cache_stats_from_json(const char *json); /** * Serialize a `CacheStats` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_cache_stats_to_json(const KREUZBERGCacheStats *ptr); /** * Free a `CacheStats` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_cache_stats_free(KREUZBERGCacheStats *ptr); /** * Get the `total_files` field from a `CacheStats`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_cache_stats_total_files(const KREUZBERGCacheStats *ptr); /** * Get the `total_size_mb` field from a `CacheStats`. * # Safety * Pointer must be a valid handle returned by this library. */ double kreuzberg_cache_stats_total_size_mb(const KREUZBERGCacheStats *ptr); /** * Get the `available_space_mb` field from a `CacheStats`. * # Safety * Pointer must be a valid handle returned by this library. */ double kreuzberg_cache_stats_available_space_mb(const KREUZBERGCacheStats *ptr); /** * Get the `oldest_file_age_days` field from a `CacheStats`. * # Safety * Pointer must be a valid handle returned by this library. */ double kreuzberg_cache_stats_oldest_file_age_days(const KREUZBERGCacheStats *ptr); /** * Get the `newest_file_age_days` field from a `CacheStats`. * # Safety * Pointer must be a valid handle returned by this library. */ double kreuzberg_cache_stats_newest_file_age_days(const KREUZBERGCacheStats *ptr); /** * Create a `AccelerationConfig` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_acceleration_config_free`. */ KREUZBERGAccelerationConfig *kreuzberg_acceleration_config_from_json(const char *json); /** * Serialize a `AccelerationConfig` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_acceleration_config_to_json(const KREUZBERGAccelerationConfig *ptr); /** * Free a `AccelerationConfig` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_acceleration_config_free(KREUZBERGAccelerationConfig *ptr); /** * Get the `provider` field from a `AccelerationConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGExecutionProviderType *kreuzberg_acceleration_config_provider(const KREUZBERGAccelerationConfig *ptr); /** * Get the `device_id` field from a `AccelerationConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_acceleration_config_device_id(const KREUZBERGAccelerationConfig *ptr); /** * Create a `ContentFilterConfig` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_content_filter_config_free`. */ KREUZBERGContentFilterConfig *kreuzberg_content_filter_config_from_json(const char *json); /** * Serialize a `ContentFilterConfig` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_content_filter_config_to_json(const KREUZBERGContentFilterConfig *ptr); /** * Free a `ContentFilterConfig` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_content_filter_config_free(KREUZBERGContentFilterConfig *ptr); /** * Get the `include_headers` field from a `ContentFilterConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_content_filter_config_include_headers(const KREUZBERGContentFilterConfig *ptr); /** * Get the `include_footers` field from a `ContentFilterConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_content_filter_config_include_footers(const KREUZBERGContentFilterConfig *ptr); /** * Get the `strip_repeating_text` field from a `ContentFilterConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_content_filter_config_strip_repeating_text(const KREUZBERGContentFilterConfig *ptr); /** * Get the `include_watermarks` field from a `ContentFilterConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_content_filter_config_include_watermarks(const KREUZBERGContentFilterConfig *ptr); /** * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ KREUZBERGContentFilterConfig *kreuzberg_content_filter_config_default(void); /** * Create a `EmailConfig` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_email_config_free`. */ KREUZBERGEmailConfig *kreuzberg_email_config_from_json(const char *json); /** * Serialize a `EmailConfig` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_email_config_to_json(const KREUZBERGEmailConfig *ptr); /** * Free a `EmailConfig` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_email_config_free(KREUZBERGEmailConfig *ptr); /** * Get the `msg_fallback_codepage` field from a `EmailConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_email_config_msg_fallback_codepage(const KREUZBERGEmailConfig *ptr); /** * Create a `ExtractionConfig` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_extraction_config_free`. */ KREUZBERGExtractionConfig *kreuzberg_extraction_config_from_json(const char *json); /** * Serialize a `ExtractionConfig` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_extraction_config_to_json(const KREUZBERGExtractionConfig *ptr); /** * Free a `ExtractionConfig` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_extraction_config_free(KREUZBERGExtractionConfig *ptr); /** * Get the `use_cache` field from a `ExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_extraction_config_use_cache(const KREUZBERGExtractionConfig *ptr); /** * Get the `enable_quality_processing` field from a `ExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_extraction_config_enable_quality_processing(const KREUZBERGExtractionConfig *ptr); /** * Get the `ocr` field from a `ExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGOcrConfig *kreuzberg_extraction_config_ocr(const KREUZBERGExtractionConfig *ptr); /** * Get the `force_ocr` field from a `ExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_extraction_config_force_ocr(const KREUZBERGExtractionConfig *ptr); /** * Get the `force_ocr_pages` field from a `ExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_extraction_config_force_ocr_pages(const KREUZBERGExtractionConfig *ptr); /** * Get the `disable_ocr` field from a `ExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_extraction_config_disable_ocr(const KREUZBERGExtractionConfig *ptr); /** * Get the `chunking` field from a `ExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGChunkingConfig *kreuzberg_extraction_config_chunking(const KREUZBERGExtractionConfig *ptr); /** * Get the `content_filter` field from a `ExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGContentFilterConfig *kreuzberg_extraction_config_content_filter(const KREUZBERGExtractionConfig *ptr); /** * Get the `images` field from a `ExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGImageExtractionConfig *kreuzberg_extraction_config_images(const KREUZBERGExtractionConfig *ptr); /** * Get the `pdf_options` field from a `ExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGPdfConfig *kreuzberg_extraction_config_pdf_options(const KREUZBERGExtractionConfig *ptr); /** * Get the `token_reduction` field from a `ExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGTokenReductionOptions *kreuzberg_extraction_config_token_reduction(const KREUZBERGExtractionConfig *ptr); /** * Get the `language_detection` field from a `ExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGLanguageDetectionConfig *kreuzberg_extraction_config_language_detection(const KREUZBERGExtractionConfig *ptr); /** * Get the `pages` field from a `ExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGPageConfig *kreuzberg_extraction_config_pages(const KREUZBERGExtractionConfig *ptr); /** * Get the `keywords` field from a `ExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGKeywordConfig *kreuzberg_extraction_config_keywords(const KREUZBERGExtractionConfig *ptr); /** * Get the `postprocessor` field from a `ExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGPostProcessorConfig *kreuzberg_extraction_config_postprocessor(const KREUZBERGExtractionConfig *ptr); /** * Get the `html_output` field from a `ExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGHtmlOutputConfig *kreuzberg_extraction_config_html_output(const KREUZBERGExtractionConfig *ptr); /** * Get the `extraction_timeout_secs` field from a `ExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ uint64_t kreuzberg_extraction_config_extraction_timeout_secs(const KREUZBERGExtractionConfig *ptr); /** * Get the `max_concurrent_extractions` field from a `ExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_extraction_config_max_concurrent_extractions(const KREUZBERGExtractionConfig *ptr); /** * Get the `result_format` field from a `ExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGResultFormat *kreuzberg_extraction_config_result_format(const KREUZBERGExtractionConfig *ptr); /** * Get the `security_limits` field from a `ExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGSecurityLimits *kreuzberg_extraction_config_security_limits(const KREUZBERGExtractionConfig *ptr); /** * Get the `output_format` field from a `ExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGOutputFormat *kreuzberg_extraction_config_output_format(const KREUZBERGExtractionConfig *ptr); /** * Get the `layout` field from a `ExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGLayoutDetectionConfig *kreuzberg_extraction_config_layout(const KREUZBERGExtractionConfig *ptr); /** * Get the `use_layout_for_markdown` field from a `ExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_extraction_config_use_layout_for_markdown(const KREUZBERGExtractionConfig *ptr); /** * Get the `include_document_structure` field from a `ExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_extraction_config_include_document_structure(const KREUZBERGExtractionConfig *ptr); /** * Get the `acceleration` field from a `ExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGAccelerationConfig *kreuzberg_extraction_config_acceleration(const KREUZBERGExtractionConfig *ptr); /** * Get the `cache_namespace` field from a `ExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_extraction_config_cache_namespace(const KREUZBERGExtractionConfig *ptr); /** * Get the `cache_ttl_secs` field from a `ExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ uint64_t kreuzberg_extraction_config_cache_ttl_secs(const KREUZBERGExtractionConfig *ptr); /** * Get the `email` field from a `ExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGEmailConfig *kreuzberg_extraction_config_email(const KREUZBERGExtractionConfig *ptr); /** * Get the `max_archive_depth` field from a `ExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_extraction_config_max_archive_depth(const KREUZBERGExtractionConfig *ptr); /** * Get the `tree_sitter` field from a `ExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGTreeSitterConfig *kreuzberg_extraction_config_tree_sitter(const KREUZBERGExtractionConfig *ptr); /** * Get the `structured_extraction` field from a `ExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGStructuredExtractionConfig *kreuzberg_extraction_config_structured_extraction(const KREUZBERGExtractionConfig *ptr); /** * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ KREUZBERGExtractionConfig *kreuzberg_extraction_config_default(void); /** * Check if image processing is needed by examining OCR and image extraction settings. * * Returns `true` if either OCR is enabled or image extraction is configured, * indicating that image decompression and processing should occur. * Returns `false` if both are disabled, allowing optimization to skip unnecessary * image decompression for text-only extraction workflows. * * # Optimization Impact * For text-only extractions (no OCR, no image extraction), skipping image * decompression can improve CPU utilization by 5-10% by avoiding wasteful * image I/O and processing when results won't be used. * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ int32_t kreuzberg_extraction_config_needs_image_processing(const KREUZBERGExtractionConfig *this_); /** * Create a `FileExtractionConfig` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_file_extraction_config_free`. */ KREUZBERGFileExtractionConfig *kreuzberg_file_extraction_config_from_json(const char *json); /** * Serialize a `FileExtractionConfig` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_file_extraction_config_to_json(const KREUZBERGFileExtractionConfig *ptr); /** * Free a `FileExtractionConfig` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_file_extraction_config_free(KREUZBERGFileExtractionConfig *ptr); /** * Get the `enable_quality_processing` field from a `FileExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_file_extraction_config_enable_quality_processing(const KREUZBERGFileExtractionConfig *ptr); /** * Get the `ocr` field from a `FileExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGOcrConfig *kreuzberg_file_extraction_config_ocr(const KREUZBERGFileExtractionConfig *ptr); /** * Get the `force_ocr` field from a `FileExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_file_extraction_config_force_ocr(const KREUZBERGFileExtractionConfig *ptr); /** * Get the `force_ocr_pages` field from a `FileExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_file_extraction_config_force_ocr_pages(const KREUZBERGFileExtractionConfig *ptr); /** * Get the `disable_ocr` field from a `FileExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_file_extraction_config_disable_ocr(const KREUZBERGFileExtractionConfig *ptr); /** * Get the `chunking` field from a `FileExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGChunkingConfig *kreuzberg_file_extraction_config_chunking(const KREUZBERGFileExtractionConfig *ptr); /** * Get the `content_filter` field from a `FileExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGContentFilterConfig *kreuzberg_file_extraction_config_content_filter(const KREUZBERGFileExtractionConfig *ptr); /** * Get the `images` field from a `FileExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGImageExtractionConfig *kreuzberg_file_extraction_config_images(const KREUZBERGFileExtractionConfig *ptr); /** * Get the `pdf_options` field from a `FileExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGPdfConfig *kreuzberg_file_extraction_config_pdf_options(const KREUZBERGFileExtractionConfig *ptr); /** * Get the `token_reduction` field from a `FileExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGTokenReductionOptions *kreuzberg_file_extraction_config_token_reduction(const KREUZBERGFileExtractionConfig *ptr); /** * Get the `language_detection` field from a `FileExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGLanguageDetectionConfig *kreuzberg_file_extraction_config_language_detection(const KREUZBERGFileExtractionConfig *ptr); /** * Get the `pages` field from a `FileExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGPageConfig *kreuzberg_file_extraction_config_pages(const KREUZBERGFileExtractionConfig *ptr); /** * Get the `keywords` field from a `FileExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGKeywordConfig *kreuzberg_file_extraction_config_keywords(const KREUZBERGFileExtractionConfig *ptr); /** * Get the `postprocessor` field from a `FileExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGPostProcessorConfig *kreuzberg_file_extraction_config_postprocessor(const KREUZBERGFileExtractionConfig *ptr); /** * Get the `result_format` field from a `FileExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGResultFormat *kreuzberg_file_extraction_config_result_format(const KREUZBERGFileExtractionConfig *ptr); /** * Get the `output_format` field from a `FileExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGOutputFormat *kreuzberg_file_extraction_config_output_format(const KREUZBERGFileExtractionConfig *ptr); /** * Get the `include_document_structure` field from a `FileExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_file_extraction_config_include_document_structure(const KREUZBERGFileExtractionConfig *ptr); /** * Get the `layout` field from a `FileExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGLayoutDetectionConfig *kreuzberg_file_extraction_config_layout(const KREUZBERGFileExtractionConfig *ptr); /** * Get the `timeout_secs` field from a `FileExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ uint64_t kreuzberg_file_extraction_config_timeout_secs(const KREUZBERGFileExtractionConfig *ptr); /** * Get the `tree_sitter` field from a `FileExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGTreeSitterConfig *kreuzberg_file_extraction_config_tree_sitter(const KREUZBERGFileExtractionConfig *ptr); /** * Get the `structured_extraction` field from a `FileExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGStructuredExtractionConfig *kreuzberg_file_extraction_config_structured_extraction(const KREUZBERGFileExtractionConfig *ptr); /** * Create a `BatchBytesItem` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_batch_bytes_item_free`. */ KREUZBERGBatchBytesItem *kreuzberg_batch_bytes_item_from_json(const char *json); /** * Serialize a `BatchBytesItem` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_batch_bytes_item_to_json(const KREUZBERGBatchBytesItem *ptr); /** * Free a `BatchBytesItem` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_batch_bytes_item_free(KREUZBERGBatchBytesItem *ptr); /** * Get the `content` field from a `BatchBytesItem`. * # Safety * Pointer must be a valid handle returned by this library. */ uint8_t *kreuzberg_batch_bytes_item_content(const KREUZBERGBatchBytesItem *ptr, uintptr_t *out_len); /** * Get the `mime_type` field from a `BatchBytesItem`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_batch_bytes_item_mime_type(const KREUZBERGBatchBytesItem *ptr); /** * Get the `config` field from a `BatchBytesItem`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGFileExtractionConfig *kreuzberg_batch_bytes_item_config(const KREUZBERGBatchBytesItem *ptr); /** * Create a `BatchFileItem` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_batch_file_item_free`. */ KREUZBERGBatchFileItem *kreuzberg_batch_file_item_from_json(const char *json); /** * Serialize a `BatchFileItem` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_batch_file_item_to_json(const KREUZBERGBatchFileItem *ptr); /** * Free a `BatchFileItem` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_batch_file_item_free(KREUZBERGBatchFileItem *ptr); /** * Get the `path` field from a `BatchFileItem`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_batch_file_item_path(const KREUZBERGBatchFileItem *ptr); /** * Get the `config` field from a `BatchFileItem`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGFileExtractionConfig *kreuzberg_batch_file_item_config(const KREUZBERGBatchFileItem *ptr); /** * Create a `ImageExtractionConfig` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_image_extraction_config_free`. */ KREUZBERGImageExtractionConfig *kreuzberg_image_extraction_config_from_json(const char *json); /** * Serialize a `ImageExtractionConfig` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_image_extraction_config_to_json(const KREUZBERGImageExtractionConfig *ptr); /** * Free a `ImageExtractionConfig` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_image_extraction_config_free(KREUZBERGImageExtractionConfig *ptr); /** * Get the `extract_images` field from a `ImageExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_image_extraction_config_extract_images(const KREUZBERGImageExtractionConfig *ptr); /** * Get the `target_dpi` field from a `ImageExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_image_extraction_config_target_dpi(const KREUZBERGImageExtractionConfig *ptr); /** * Get the `max_image_dimension` field from a `ImageExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_image_extraction_config_max_image_dimension(const KREUZBERGImageExtractionConfig *ptr); /** * Get the `inject_placeholders` field from a `ImageExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_image_extraction_config_inject_placeholders(const KREUZBERGImageExtractionConfig *ptr); /** * Get the `auto_adjust_dpi` field from a `ImageExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_image_extraction_config_auto_adjust_dpi(const KREUZBERGImageExtractionConfig *ptr); /** * Get the `min_dpi` field from a `ImageExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_image_extraction_config_min_dpi(const KREUZBERGImageExtractionConfig *ptr); /** * Get the `max_dpi` field from a `ImageExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_image_extraction_config_max_dpi(const KREUZBERGImageExtractionConfig *ptr); /** * Get the `max_images_per_page` field from a `ImageExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_image_extraction_config_max_images_per_page(const KREUZBERGImageExtractionConfig *ptr); /** * Get the `classify` field from a `ImageExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_image_extraction_config_classify(const KREUZBERGImageExtractionConfig *ptr); /** * Get the `include_page_rasters` field from a `ImageExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_image_extraction_config_include_page_rasters(const KREUZBERGImageExtractionConfig *ptr); /** * Get the `run_ocr_on_images` field from a `ImageExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_image_extraction_config_run_ocr_on_images(const KREUZBERGImageExtractionConfig *ptr); /** * Get the `ocr_text_only` field from a `ImageExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_image_extraction_config_ocr_text_only(const KREUZBERGImageExtractionConfig *ptr); /** * Get the `append_ocr_text` field from a `ImageExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_image_extraction_config_append_ocr_text(const KREUZBERGImageExtractionConfig *ptr); /** * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ KREUZBERGImageExtractionConfig *kreuzberg_image_extraction_config_default(void); /** * Create a `TokenReductionOptions` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_token_reduction_options_free`. */ KREUZBERGTokenReductionOptions *kreuzberg_token_reduction_options_from_json(const char *json); /** * Serialize a `TokenReductionOptions` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_token_reduction_options_to_json(const KREUZBERGTokenReductionOptions *ptr); /** * Free a `TokenReductionOptions` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_token_reduction_options_free(KREUZBERGTokenReductionOptions *ptr); /** * Get the `mode` field from a `TokenReductionOptions`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_token_reduction_options_mode(const KREUZBERGTokenReductionOptions *ptr); /** * Get the `preserve_important_words` field from a `TokenReductionOptions`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_token_reduction_options_preserve_important_words(const KREUZBERGTokenReductionOptions *ptr); /** * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ KREUZBERGTokenReductionOptions *kreuzberg_token_reduction_options_default(void); /** * Create a `LanguageDetectionConfig` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_language_detection_config_free`. */ KREUZBERGLanguageDetectionConfig *kreuzberg_language_detection_config_from_json(const char *json); /** * Serialize a `LanguageDetectionConfig` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_language_detection_config_to_json(const KREUZBERGLanguageDetectionConfig *ptr); /** * Free a `LanguageDetectionConfig` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_language_detection_config_free(KREUZBERGLanguageDetectionConfig *ptr); /** * Get the `enabled` field from a `LanguageDetectionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_language_detection_config_enabled(const KREUZBERGLanguageDetectionConfig *ptr); /** * Get the `min_confidence` field from a `LanguageDetectionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ double kreuzberg_language_detection_config_min_confidence(const KREUZBERGLanguageDetectionConfig *ptr); /** * Get the `detect_multiple` field from a `LanguageDetectionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_language_detection_config_detect_multiple(const KREUZBERGLanguageDetectionConfig *ptr); /** * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ KREUZBERGLanguageDetectionConfig *kreuzberg_language_detection_config_default(void); /** * Create a `HtmlOutputConfig` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_html_output_config_free`. */ KREUZBERGHtmlOutputConfig *kreuzberg_html_output_config_from_json(const char *json); /** * Serialize a `HtmlOutputConfig` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_html_output_config_to_json(const KREUZBERGHtmlOutputConfig *ptr); /** * Free a `HtmlOutputConfig` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_html_output_config_free(KREUZBERGHtmlOutputConfig *ptr); /** * Get the `css` field from a `HtmlOutputConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_html_output_config_css(const KREUZBERGHtmlOutputConfig *ptr); /** * Get the `css_file` field from a `HtmlOutputConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_html_output_config_css_file(const KREUZBERGHtmlOutputConfig *ptr); /** * Get the `theme` field from a `HtmlOutputConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGHtmlTheme *kreuzberg_html_output_config_theme(const KREUZBERGHtmlOutputConfig *ptr); /** * Get the `class_prefix` field from a `HtmlOutputConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_html_output_config_class_prefix(const KREUZBERGHtmlOutputConfig *ptr); /** * Get the `embed_css` field from a `HtmlOutputConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_html_output_config_embed_css(const KREUZBERGHtmlOutputConfig *ptr); /** * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ KREUZBERGHtmlOutputConfig *kreuzberg_html_output_config_default(void); /** * Create a `LayoutDetectionConfig` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_layout_detection_config_free`. */ KREUZBERGLayoutDetectionConfig *kreuzberg_layout_detection_config_from_json(const char *json); /** * Serialize a `LayoutDetectionConfig` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_layout_detection_config_to_json(const KREUZBERGLayoutDetectionConfig *ptr); /** * Free a `LayoutDetectionConfig` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_layout_detection_config_free(KREUZBERGLayoutDetectionConfig *ptr); /** * Get the `confidence_threshold` field from a `LayoutDetectionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ float kreuzberg_layout_detection_config_confidence_threshold(const KREUZBERGLayoutDetectionConfig *ptr); /** * Get the `apply_heuristics` field from a `LayoutDetectionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_layout_detection_config_apply_heuristics(const KREUZBERGLayoutDetectionConfig *ptr); /** * Get the `table_model` field from a `LayoutDetectionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGTableModel *kreuzberg_layout_detection_config_table_model(const KREUZBERGLayoutDetectionConfig *ptr); /** * Get the `acceleration` field from a `LayoutDetectionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGAccelerationConfig *kreuzberg_layout_detection_config_acceleration(const KREUZBERGLayoutDetectionConfig *ptr); /** * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ KREUZBERGLayoutDetectionConfig *kreuzberg_layout_detection_config_default(void); /** * Create a `LlmConfig` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_llm_config_free`. */ KREUZBERGLlmConfig *kreuzberg_llm_config_from_json(const char *json); /** * Serialize a `LlmConfig` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_llm_config_to_json(const KREUZBERGLlmConfig *ptr); /** * Free a `LlmConfig` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_llm_config_free(KREUZBERGLlmConfig *ptr); /** * Get the `model` field from a `LlmConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_llm_config_model(const KREUZBERGLlmConfig *ptr); /** * Get the `api_key` field from a `LlmConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_llm_config_api_key(const KREUZBERGLlmConfig *ptr); /** * Get the `base_url` field from a `LlmConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_llm_config_base_url(const KREUZBERGLlmConfig *ptr); /** * Get the `timeout_secs` field from a `LlmConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ uint64_t kreuzberg_llm_config_timeout_secs(const KREUZBERGLlmConfig *ptr); /** * Get the `max_retries` field from a `LlmConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_llm_config_max_retries(const KREUZBERGLlmConfig *ptr); /** * Get the `temperature` field from a `LlmConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ double kreuzberg_llm_config_temperature(const KREUZBERGLlmConfig *ptr); /** * Get the `max_tokens` field from a `LlmConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ uint64_t kreuzberg_llm_config_max_tokens(const KREUZBERGLlmConfig *ptr); /** * Create a `StructuredExtractionConfig` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_structured_extraction_config_free`. */ KREUZBERGStructuredExtractionConfig *kreuzberg_structured_extraction_config_from_json(const char *json); /** * Serialize a `StructuredExtractionConfig` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_structured_extraction_config_to_json(const KREUZBERGStructuredExtractionConfig *ptr); /** * Free a `StructuredExtractionConfig` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_structured_extraction_config_free(KREUZBERGStructuredExtractionConfig *ptr); /** * Get the `schema` field from a `StructuredExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_structured_extraction_config_schema(const KREUZBERGStructuredExtractionConfig *ptr); /** * Get the `schema_name` field from a `StructuredExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_structured_extraction_config_schema_name(const KREUZBERGStructuredExtractionConfig *ptr); /** * Get the `schema_description` field from a `StructuredExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_structured_extraction_config_schema_description(const KREUZBERGStructuredExtractionConfig *ptr); /** * Get the `strict` field from a `StructuredExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_structured_extraction_config_strict(const KREUZBERGStructuredExtractionConfig *ptr); /** * Get the `prompt` field from a `StructuredExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_structured_extraction_config_prompt(const KREUZBERGStructuredExtractionConfig *ptr); /** * Get the `llm` field from a `StructuredExtractionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGLlmConfig *kreuzberg_structured_extraction_config_llm(const KREUZBERGStructuredExtractionConfig *ptr); /** * Create a `OcrQualityThresholds` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_ocr_quality_thresholds_free`. */ KREUZBERGOcrQualityThresholds *kreuzberg_ocr_quality_thresholds_from_json(const char *json); /** * Serialize a `OcrQualityThresholds` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_ocr_quality_thresholds_to_json(const KREUZBERGOcrQualityThresholds *ptr); /** * Free a `OcrQualityThresholds` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_ocr_quality_thresholds_free(KREUZBERGOcrQualityThresholds *ptr); /** * Get the `min_total_non_whitespace` field from a `OcrQualityThresholds`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_ocr_quality_thresholds_min_total_non_whitespace(const KREUZBERGOcrQualityThresholds *ptr); /** * Get the `min_non_whitespace_per_page` field from a `OcrQualityThresholds`. * # Safety * Pointer must be a valid handle returned by this library. */ double kreuzberg_ocr_quality_thresholds_min_non_whitespace_per_page(const KREUZBERGOcrQualityThresholds *ptr); /** * Get the `min_meaningful_word_len` field from a `OcrQualityThresholds`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_ocr_quality_thresholds_min_meaningful_word_len(const KREUZBERGOcrQualityThresholds *ptr); /** * Get the `min_meaningful_words` field from a `OcrQualityThresholds`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_ocr_quality_thresholds_min_meaningful_words(const KREUZBERGOcrQualityThresholds *ptr); /** * Get the `min_alnum_ratio` field from a `OcrQualityThresholds`. * # Safety * Pointer must be a valid handle returned by this library. */ double kreuzberg_ocr_quality_thresholds_min_alnum_ratio(const KREUZBERGOcrQualityThresholds *ptr); /** * Get the `min_garbage_chars` field from a `OcrQualityThresholds`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_ocr_quality_thresholds_min_garbage_chars(const KREUZBERGOcrQualityThresholds *ptr); /** * Get the `max_fragmented_word_ratio` field from a `OcrQualityThresholds`. * # Safety * Pointer must be a valid handle returned by this library. */ double kreuzberg_ocr_quality_thresholds_max_fragmented_word_ratio(const KREUZBERGOcrQualityThresholds *ptr); /** * Get the `critical_fragmented_word_ratio` field from a `OcrQualityThresholds`. * # Safety * Pointer must be a valid handle returned by this library. */ double kreuzberg_ocr_quality_thresholds_critical_fragmented_word_ratio(const KREUZBERGOcrQualityThresholds *ptr); /** * Get the `min_avg_word_length` field from a `OcrQualityThresholds`. * # Safety * Pointer must be a valid handle returned by this library. */ double kreuzberg_ocr_quality_thresholds_min_avg_word_length(const KREUZBERGOcrQualityThresholds *ptr); /** * Get the `min_words_for_avg_length_check` field from a `OcrQualityThresholds`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_ocr_quality_thresholds_min_words_for_avg_length_check(const KREUZBERGOcrQualityThresholds *ptr); /** * Get the `min_consecutive_repeat_ratio` field from a `OcrQualityThresholds`. * # Safety * Pointer must be a valid handle returned by this library. */ double kreuzberg_ocr_quality_thresholds_min_consecutive_repeat_ratio(const KREUZBERGOcrQualityThresholds *ptr); /** * Get the `min_words_for_repeat_check` field from a `OcrQualityThresholds`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_ocr_quality_thresholds_min_words_for_repeat_check(const KREUZBERGOcrQualityThresholds *ptr); /** * Get the `substantive_min_chars` field from a `OcrQualityThresholds`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_ocr_quality_thresholds_substantive_min_chars(const KREUZBERGOcrQualityThresholds *ptr); /** * Get the `non_text_min_chars` field from a `OcrQualityThresholds`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_ocr_quality_thresholds_non_text_min_chars(const KREUZBERGOcrQualityThresholds *ptr); /** * Get the `alnum_ws_ratio_threshold` field from a `OcrQualityThresholds`. * # Safety * Pointer must be a valid handle returned by this library. */ double kreuzberg_ocr_quality_thresholds_alnum_ws_ratio_threshold(const KREUZBERGOcrQualityThresholds *ptr); /** * Get the `pipeline_min_quality` field from a `OcrQualityThresholds`. * # Safety * Pointer must be a valid handle returned by this library. */ double kreuzberg_ocr_quality_thresholds_pipeline_min_quality(const KREUZBERGOcrQualityThresholds *ptr); /** * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ KREUZBERGOcrQualityThresholds *kreuzberg_ocr_quality_thresholds_default(void); /** * Create a `OcrPipelineStage` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_ocr_pipeline_stage_free`. */ KREUZBERGOcrPipelineStage *kreuzberg_ocr_pipeline_stage_from_json(const char *json); /** * Serialize a `OcrPipelineStage` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_ocr_pipeline_stage_to_json(const KREUZBERGOcrPipelineStage *ptr); /** * Free a `OcrPipelineStage` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_ocr_pipeline_stage_free(KREUZBERGOcrPipelineStage *ptr); /** * Get the `backend` field from a `OcrPipelineStage`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_ocr_pipeline_stage_backend(const KREUZBERGOcrPipelineStage *ptr); /** * Get the `priority` field from a `OcrPipelineStage`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_ocr_pipeline_stage_priority(const KREUZBERGOcrPipelineStage *ptr); /** * Get the `language` field from a `OcrPipelineStage`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_ocr_pipeline_stage_language(const KREUZBERGOcrPipelineStage *ptr); /** * Get the `tesseract_config` field from a `OcrPipelineStage`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGTesseractConfig *kreuzberg_ocr_pipeline_stage_tesseract_config(const KREUZBERGOcrPipelineStage *ptr); /** * Get the `paddle_ocr_config` field from a `OcrPipelineStage`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_ocr_pipeline_stage_paddle_ocr_config(const KREUZBERGOcrPipelineStage *ptr); /** * Get the `vlm_config` field from a `OcrPipelineStage`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGLlmConfig *kreuzberg_ocr_pipeline_stage_vlm_config(const KREUZBERGOcrPipelineStage *ptr); /** * Get the `backend_options` field from a `OcrPipelineStage`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_ocr_pipeline_stage_backend_options(const KREUZBERGOcrPipelineStage *ptr); /** * Create a `OcrPipelineConfig` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_ocr_pipeline_config_free`. */ KREUZBERGOcrPipelineConfig *kreuzberg_ocr_pipeline_config_from_json(const char *json); /** * Serialize a `OcrPipelineConfig` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_ocr_pipeline_config_to_json(const KREUZBERGOcrPipelineConfig *ptr); /** * Free a `OcrPipelineConfig` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_ocr_pipeline_config_free(KREUZBERGOcrPipelineConfig *ptr); /** * Get the `stages` field from a `OcrPipelineConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_ocr_pipeline_config_stages(const KREUZBERGOcrPipelineConfig *ptr); /** * Get the `quality_thresholds` field from a `OcrPipelineConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGOcrQualityThresholds *kreuzberg_ocr_pipeline_config_quality_thresholds(const KREUZBERGOcrPipelineConfig *ptr); /** * Create a `OcrConfig` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_ocr_config_free`. */ KREUZBERGOcrConfig *kreuzberg_ocr_config_from_json(const char *json); /** * Serialize a `OcrConfig` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_ocr_config_to_json(const KREUZBERGOcrConfig *ptr); /** * Free a `OcrConfig` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_ocr_config_free(KREUZBERGOcrConfig *ptr); /** * Get the `enabled` field from a `OcrConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_ocr_config_enabled(const KREUZBERGOcrConfig *ptr); /** * Get the `backend` field from a `OcrConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_ocr_config_backend(const KREUZBERGOcrConfig *ptr); /** * Get the `language` field from a `OcrConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_ocr_config_language(const KREUZBERGOcrConfig *ptr); /** * Get the `tesseract_config` field from a `OcrConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGTesseractConfig *kreuzberg_ocr_config_tesseract_config(const KREUZBERGOcrConfig *ptr); /** * Get the `output_format` field from a `OcrConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGOutputFormat *kreuzberg_ocr_config_output_format(const KREUZBERGOcrConfig *ptr); /** * Get the `paddle_ocr_config` field from a `OcrConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_ocr_config_paddle_ocr_config(const KREUZBERGOcrConfig *ptr); /** * Get the `backend_options` field from a `OcrConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_ocr_config_backend_options(const KREUZBERGOcrConfig *ptr); /** * Get the `element_config` field from a `OcrConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGOcrElementConfig *kreuzberg_ocr_config_element_config(const KREUZBERGOcrConfig *ptr); /** * Get the `quality_thresholds` field from a `OcrConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGOcrQualityThresholds *kreuzberg_ocr_config_quality_thresholds(const KREUZBERGOcrConfig *ptr); /** * Get the `pipeline` field from a `OcrConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGOcrPipelineConfig *kreuzberg_ocr_config_pipeline(const KREUZBERGOcrConfig *ptr); /** * Get the `auto_rotate` field from a `OcrConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_ocr_config_auto_rotate(const KREUZBERGOcrConfig *ptr); /** * Get the `vlm_config` field from a `OcrConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGLlmConfig *kreuzberg_ocr_config_vlm_config(const KREUZBERGOcrConfig *ptr); /** * Get the `vlm_prompt` field from a `OcrConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_ocr_config_vlm_prompt(const KREUZBERGOcrConfig *ptr); /** * Get the `acceleration` field from a `OcrConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGAccelerationConfig *kreuzberg_ocr_config_acceleration(const KREUZBERGOcrConfig *ptr); /** * Get the `tessdata_bytes` field from a `OcrConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_ocr_config_tessdata_bytes(const KREUZBERGOcrConfig *ptr); /** * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ KREUZBERGOcrConfig *kreuzberg_ocr_config_default(void); /** * Create a `PageConfig` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_page_config_free`. */ KREUZBERGPageConfig *kreuzberg_page_config_from_json(const char *json); /** * Serialize a `PageConfig` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_page_config_to_json(const KREUZBERGPageConfig *ptr); /** * Free a `PageConfig` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_page_config_free(KREUZBERGPageConfig *ptr); /** * Get the `extract_pages` field from a `PageConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_page_config_extract_pages(const KREUZBERGPageConfig *ptr); /** * Get the `insert_page_markers` field from a `PageConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_page_config_insert_page_markers(const KREUZBERGPageConfig *ptr); /** * Get the `marker_format` field from a `PageConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_page_config_marker_format(const KREUZBERGPageConfig *ptr); /** * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ KREUZBERGPageConfig *kreuzberg_page_config_default(void); /** * Create a `PdfConfig` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_pdf_config_free`. */ KREUZBERGPdfConfig *kreuzberg_pdf_config_from_json(const char *json); /** * Serialize a `PdfConfig` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_pdf_config_to_json(const KREUZBERGPdfConfig *ptr); /** * Free a `PdfConfig` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_pdf_config_free(KREUZBERGPdfConfig *ptr); /** * Get the `extract_images` field from a `PdfConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_pdf_config_extract_images(const KREUZBERGPdfConfig *ptr); /** * Get the `extract_tables` field from a `PdfConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_pdf_config_extract_tables(const KREUZBERGPdfConfig *ptr); /** * Get the `passwords` field from a `PdfConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_pdf_config_passwords(const KREUZBERGPdfConfig *ptr); /** * Get the `extract_metadata` field from a `PdfConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_pdf_config_extract_metadata(const KREUZBERGPdfConfig *ptr); /** * Get the `hierarchy` field from a `PdfConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGHierarchyConfig *kreuzberg_pdf_config_hierarchy(const KREUZBERGPdfConfig *ptr); /** * Get the `extract_annotations` field from a `PdfConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_pdf_config_extract_annotations(const KREUZBERGPdfConfig *ptr); /** * Get the `top_margin_fraction` field from a `PdfConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ float kreuzberg_pdf_config_top_margin_fraction(const KREUZBERGPdfConfig *ptr); /** * Get the `bottom_margin_fraction` field from a `PdfConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ float kreuzberg_pdf_config_bottom_margin_fraction(const KREUZBERGPdfConfig *ptr); /** * Get the `allow_single_column_tables` field from a `PdfConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_pdf_config_allow_single_column_tables(const KREUZBERGPdfConfig *ptr); /** * Get the `ocr_inline_images` field from a `PdfConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_pdf_config_ocr_inline_images(const KREUZBERGPdfConfig *ptr); /** * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ KREUZBERGPdfConfig *kreuzberg_pdf_config_default(void); /** * Create a `HierarchyConfig` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_hierarchy_config_free`. */ KREUZBERGHierarchyConfig *kreuzberg_hierarchy_config_from_json(const char *json); /** * Serialize a `HierarchyConfig` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_hierarchy_config_to_json(const KREUZBERGHierarchyConfig *ptr); /** * Free a `HierarchyConfig` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_hierarchy_config_free(KREUZBERGHierarchyConfig *ptr); /** * Get the `enabled` field from a `HierarchyConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_hierarchy_config_enabled(const KREUZBERGHierarchyConfig *ptr); /** * Get the `k_clusters` field from a `HierarchyConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_hierarchy_config_k_clusters(const KREUZBERGHierarchyConfig *ptr); /** * Get the `include_bbox` field from a `HierarchyConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_hierarchy_config_include_bbox(const KREUZBERGHierarchyConfig *ptr); /** * Get the `ocr_coverage_threshold` field from a `HierarchyConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ float kreuzberg_hierarchy_config_ocr_coverage_threshold(const KREUZBERGHierarchyConfig *ptr); /** * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ KREUZBERGHierarchyConfig *kreuzberg_hierarchy_config_default(void); /** * Create a `PostProcessorConfig` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_post_processor_config_free`. */ KREUZBERGPostProcessorConfig *kreuzberg_post_processor_config_from_json(const char *json); /** * Serialize a `PostProcessorConfig` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_post_processor_config_to_json(const KREUZBERGPostProcessorConfig *ptr); /** * Free a `PostProcessorConfig` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_post_processor_config_free(KREUZBERGPostProcessorConfig *ptr); /** * Get the `enabled` field from a `PostProcessorConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_post_processor_config_enabled(const KREUZBERGPostProcessorConfig *ptr); /** * Get the `enabled_processors` field from a `PostProcessorConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_post_processor_config_enabled_processors(const KREUZBERGPostProcessorConfig *ptr); /** * Get the `disabled_processors` field from a `PostProcessorConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_post_processor_config_disabled_processors(const KREUZBERGPostProcessorConfig *ptr); /** * Get the `enabled_set` field from a `PostProcessorConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_post_processor_config_enabled_set(const KREUZBERGPostProcessorConfig *ptr); /** * Get the `disabled_set` field from a `PostProcessorConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_post_processor_config_disabled_set(const KREUZBERGPostProcessorConfig *ptr); /** * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ KREUZBERGPostProcessorConfig *kreuzberg_post_processor_config_default(void); /** * Create a `ChunkingConfig` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_chunking_config_free`. */ KREUZBERGChunkingConfig *kreuzberg_chunking_config_from_json(const char *json); /** * Serialize a `ChunkingConfig` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_chunking_config_to_json(const KREUZBERGChunkingConfig *ptr); /** * Free a `ChunkingConfig` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_chunking_config_free(KREUZBERGChunkingConfig *ptr); /** * Get the `max_characters` field from a `ChunkingConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_chunking_config_max_characters(const KREUZBERGChunkingConfig *ptr); /** * Get the `overlap` field from a `ChunkingConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_chunking_config_overlap(const KREUZBERGChunkingConfig *ptr); /** * Get the `trim` field from a `ChunkingConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_chunking_config_trim(const KREUZBERGChunkingConfig *ptr); /** * Get the `chunker_type` field from a `ChunkingConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGChunkerType *kreuzberg_chunking_config_chunker_type(const KREUZBERGChunkingConfig *ptr); /** * Get the `embedding` field from a `ChunkingConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGEmbeddingConfig *kreuzberg_chunking_config_embedding(const KREUZBERGChunkingConfig *ptr); /** * Get the `preset` field from a `ChunkingConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_chunking_config_preset(const KREUZBERGChunkingConfig *ptr); /** * Get the `sizing` field from a `ChunkingConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGChunkSizing *kreuzberg_chunking_config_sizing(const KREUZBERGChunkingConfig *ptr); /** * Get the `prepend_heading_context` field from a `ChunkingConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_chunking_config_prepend_heading_context(const KREUZBERGChunkingConfig *ptr); /** * Get the `topic_threshold` field from a `ChunkingConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ float kreuzberg_chunking_config_topic_threshold(const KREUZBERGChunkingConfig *ptr); /** * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ KREUZBERGChunkingConfig *kreuzberg_chunking_config_default(void); /** * Create a `EmbeddingConfig` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_embedding_config_free`. */ KREUZBERGEmbeddingConfig *kreuzberg_embedding_config_from_json(const char *json); /** * Serialize a `EmbeddingConfig` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_embedding_config_to_json(const KREUZBERGEmbeddingConfig *ptr); /** * Free a `EmbeddingConfig` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_embedding_config_free(KREUZBERGEmbeddingConfig *ptr); /** * Get the `model` field from a `EmbeddingConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGEmbeddingModelType *kreuzberg_embedding_config_model(const KREUZBERGEmbeddingConfig *ptr); /** * Get the `normalize` field from a `EmbeddingConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_embedding_config_normalize(const KREUZBERGEmbeddingConfig *ptr); /** * Get the `batch_size` field from a `EmbeddingConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_embedding_config_batch_size(const KREUZBERGEmbeddingConfig *ptr); /** * Get the `show_download_progress` field from a `EmbeddingConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_embedding_config_show_download_progress(const KREUZBERGEmbeddingConfig *ptr); /** * Get the `cache_dir` field from a `EmbeddingConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_embedding_config_cache_dir(const KREUZBERGEmbeddingConfig *ptr); /** * Get the `acceleration` field from a `EmbeddingConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGAccelerationConfig *kreuzberg_embedding_config_acceleration(const KREUZBERGEmbeddingConfig *ptr); /** * Get the `max_embed_duration_secs` field from a `EmbeddingConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ uint64_t kreuzberg_embedding_config_max_embed_duration_secs(const KREUZBERGEmbeddingConfig *ptr); /** * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ KREUZBERGEmbeddingConfig *kreuzberg_embedding_config_default(void); /** * Create a `TreeSitterConfig` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_tree_sitter_config_free`. */ KREUZBERGTreeSitterConfig *kreuzberg_tree_sitter_config_from_json(const char *json); /** * Serialize a `TreeSitterConfig` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_tree_sitter_config_to_json(const KREUZBERGTreeSitterConfig *ptr); /** * Free a `TreeSitterConfig` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_tree_sitter_config_free(KREUZBERGTreeSitterConfig *ptr); /** * Get the `enabled` field from a `TreeSitterConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_tree_sitter_config_enabled(const KREUZBERGTreeSitterConfig *ptr); /** * Get the `cache_dir` field from a `TreeSitterConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_tree_sitter_config_cache_dir(const KREUZBERGTreeSitterConfig *ptr); /** * Get the `languages` field from a `TreeSitterConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_tree_sitter_config_languages(const KREUZBERGTreeSitterConfig *ptr); /** * Get the `groups` field from a `TreeSitterConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_tree_sitter_config_groups(const KREUZBERGTreeSitterConfig *ptr); /** * Get the `process` field from a `TreeSitterConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGTreeSitterProcessConfig *kreuzberg_tree_sitter_config_process(const KREUZBERGTreeSitterConfig *ptr); /** * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ KREUZBERGTreeSitterConfig *kreuzberg_tree_sitter_config_default(void); /** * Create a `TreeSitterProcessConfig` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_tree_sitter_process_config_free`. */ KREUZBERGTreeSitterProcessConfig *kreuzberg_tree_sitter_process_config_from_json(const char *json); /** * Serialize a `TreeSitterProcessConfig` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_tree_sitter_process_config_to_json(const KREUZBERGTreeSitterProcessConfig *ptr); /** * Free a `TreeSitterProcessConfig` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_tree_sitter_process_config_free(KREUZBERGTreeSitterProcessConfig *ptr); /** * Get the `structure` field from a `TreeSitterProcessConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_tree_sitter_process_config_structure(const KREUZBERGTreeSitterProcessConfig *ptr); /** * Get the `imports` field from a `TreeSitterProcessConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_tree_sitter_process_config_imports(const KREUZBERGTreeSitterProcessConfig *ptr); /** * Get the `exports` field from a `TreeSitterProcessConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_tree_sitter_process_config_exports(const KREUZBERGTreeSitterProcessConfig *ptr); /** * Get the `comments` field from a `TreeSitterProcessConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_tree_sitter_process_config_comments(const KREUZBERGTreeSitterProcessConfig *ptr); /** * Get the `docstrings` field from a `TreeSitterProcessConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_tree_sitter_process_config_docstrings(const KREUZBERGTreeSitterProcessConfig *ptr); /** * Get the `symbols` field from a `TreeSitterProcessConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_tree_sitter_process_config_symbols(const KREUZBERGTreeSitterProcessConfig *ptr); /** * Get the `diagnostics` field from a `TreeSitterProcessConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_tree_sitter_process_config_diagnostics(const KREUZBERGTreeSitterProcessConfig *ptr); /** * Get the `chunk_max_size` field from a `TreeSitterProcessConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_tree_sitter_process_config_chunk_max_size(const KREUZBERGTreeSitterProcessConfig *ptr); /** * Get the `content_mode` field from a `TreeSitterProcessConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGCodeContentMode *kreuzberg_tree_sitter_process_config_content_mode(const KREUZBERGTreeSitterProcessConfig *ptr); /** * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ KREUZBERGTreeSitterProcessConfig *kreuzberg_tree_sitter_process_config_default(void); /** * Create a `SupportedFormat` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_supported_format_free`. */ KREUZBERGSupportedFormat *kreuzberg_supported_format_from_json(const char *json); /** * Serialize a `SupportedFormat` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_supported_format_to_json(const KREUZBERGSupportedFormat *ptr); /** * Free a `SupportedFormat` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_supported_format_free(KREUZBERGSupportedFormat *ptr); /** * Get the `extension` field from a `SupportedFormat`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_supported_format_extension(const KREUZBERGSupportedFormat *ptr); /** * Get the `mime_type` field from a `SupportedFormat`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_supported_format_mime_type(const KREUZBERGSupportedFormat *ptr); /** * Create a `ServerConfig` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_server_config_free`. */ KREUZBERGServerConfig *kreuzberg_server_config_from_json(const char *json); /** * Serialize a `ServerConfig` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_server_config_to_json(const KREUZBERGServerConfig *ptr); /** * Free a `ServerConfig` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_server_config_free(KREUZBERGServerConfig *ptr); /** * Get the `host` field from a `ServerConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_server_config_host(const KREUZBERGServerConfig *ptr); /** * Get the `port` field from a `ServerConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ uint16_t kreuzberg_server_config_port(const KREUZBERGServerConfig *ptr); /** * Get the `cors_origins` field from a `ServerConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_server_config_cors_origins(const KREUZBERGServerConfig *ptr); /** * Get the `max_request_body_bytes` field from a `ServerConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_server_config_max_request_body_bytes(const KREUZBERGServerConfig *ptr); /** * Get the `max_multipart_field_bytes` field from a `ServerConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_server_config_max_multipart_field_bytes(const KREUZBERGServerConfig *ptr); /** * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ KREUZBERGServerConfig *kreuzberg_server_config_default(void); /** * Get the server listen address (host:port). * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. * \code * use kreuzberg::core::ServerConfig; * * let config = ServerConfig::default(); * assert_eq!(config.listen_addr(), "127.0.0.1:8000"); * \endcode */ char *kreuzberg_server_config_listen_addr(const KREUZBERGServerConfig *this_); /** * Check if CORS allows all origins. * * Returns `true` if the `cors_origins` vector is empty, meaning all origins * are allowed. Returns `false` if specific origins are configured. * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. * \code * use kreuzberg::core::ServerConfig; * * let mut config = ServerConfig::default(); * assert!(config.cors_allows_all()); * * config.cors_origins.push("https://example.com".to_string()); * assert!(!config.cors_allows_all()); * \endcode */ int32_t kreuzberg_server_config_cors_allows_all(const KREUZBERGServerConfig *this_); /** * Check if a given origin is allowed by CORS configuration. * * Returns `true` if: * - CORS allows all origins (empty origins list), or * - The given origin is in the allowed origins list * \param origin The origin to check (e.g., "https://example.com") * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. * \code * use kreuzberg::core::ServerConfig; * * let mut config = ServerConfig::default(); * assert!(config.is_origin_allowed("https://example.com")); * * config.cors_origins.push("https://allowed.com".to_string()); * assert!(config.is_origin_allowed("https://allowed.com")); * assert!(!config.is_origin_allowed("https://denied.com")); * \endcode */ int32_t kreuzberg_server_config_is_origin_allowed(const KREUZBERGServerConfig *this_, const char *origin); /** * Get maximum request body size in megabytes (rounded up). * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. * \code * use kreuzberg::core::ServerConfig; * * let mut config = ServerConfig::default(); * assert_eq!(config.max_request_body_mb(), 100); * \endcode */ uintptr_t kreuzberg_server_config_max_request_body_mb(const KREUZBERGServerConfig *this_); /** * Get maximum multipart field size in megabytes (rounded up). * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. * \code * use kreuzberg::core::ServerConfig; * * let mut config = ServerConfig::default(); * assert_eq!(config.max_multipart_field_mb(), 100); * \endcode */ uintptr_t kreuzberg_server_config_max_multipart_field_mb(const KREUZBERGServerConfig *this_); /** * Create a `StructuredDataResult` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_structured_data_result_free`. */ KREUZBERGStructuredDataResult *kreuzberg_structured_data_result_from_json(const char *json); /** * Serialize a `StructuredDataResult` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_structured_data_result_to_json(const KREUZBERGStructuredDataResult *ptr); /** * Free a `StructuredDataResult` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_structured_data_result_free(KREUZBERGStructuredDataResult *ptr); /** * Get the `content` field from a `StructuredDataResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_structured_data_result_content(const KREUZBERGStructuredDataResult *ptr); /** * Get the `format` field from a `StructuredDataResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_structured_data_result_format(const KREUZBERGStructuredDataResult *ptr); /** * Get the `metadata` field from a `StructuredDataResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_structured_data_result_metadata(const KREUZBERGStructuredDataResult *ptr); /** * Get the `text_fields` field from a `StructuredDataResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_structured_data_result_text_fields(const KREUZBERGStructuredDataResult *ptr); /** * Create a `DocxAppProperties` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_docx_app_properties_free`. */ KREUZBERGDocxAppProperties *kreuzberg_docx_app_properties_from_json(const char *json); /** * Serialize a `DocxAppProperties` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_docx_app_properties_to_json(const KREUZBERGDocxAppProperties *ptr); /** * Free a `DocxAppProperties` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_docx_app_properties_free(KREUZBERGDocxAppProperties *ptr); /** * Get the `application` field from a `DocxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_docx_app_properties_application(const KREUZBERGDocxAppProperties *ptr); /** * Get the `app_version` field from a `DocxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_docx_app_properties_app_version(const KREUZBERGDocxAppProperties *ptr); /** * Get the `template` field from a `DocxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_docx_app_properties_template(const KREUZBERGDocxAppProperties *ptr); /** * Get the `total_time` field from a `DocxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_docx_app_properties_total_time(const KREUZBERGDocxAppProperties *ptr); /** * Get the `pages` field from a `DocxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_docx_app_properties_pages(const KREUZBERGDocxAppProperties *ptr); /** * Get the `words` field from a `DocxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_docx_app_properties_words(const KREUZBERGDocxAppProperties *ptr); /** * Get the `characters` field from a `DocxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_docx_app_properties_characters(const KREUZBERGDocxAppProperties *ptr); /** * Get the `characters_with_spaces` field from a `DocxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_docx_app_properties_characters_with_spaces(const KREUZBERGDocxAppProperties *ptr); /** * Get the `lines` field from a `DocxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_docx_app_properties_lines(const KREUZBERGDocxAppProperties *ptr); /** * Get the `paragraphs` field from a `DocxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_docx_app_properties_paragraphs(const KREUZBERGDocxAppProperties *ptr); /** * Get the `company` field from a `DocxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_docx_app_properties_company(const KREUZBERGDocxAppProperties *ptr); /** * Get the `doc_security` field from a `DocxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_docx_app_properties_doc_security(const KREUZBERGDocxAppProperties *ptr); /** * Get the `scale_crop` field from a `DocxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_docx_app_properties_scale_crop(const KREUZBERGDocxAppProperties *ptr); /** * Get the `links_up_to_date` field from a `DocxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_docx_app_properties_links_up_to_date(const KREUZBERGDocxAppProperties *ptr); /** * Get the `shared_doc` field from a `DocxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_docx_app_properties_shared_doc(const KREUZBERGDocxAppProperties *ptr); /** * Get the `hyperlinks_changed` field from a `DocxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_docx_app_properties_hyperlinks_changed(const KREUZBERGDocxAppProperties *ptr); /** * Create a `XlsxAppProperties` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_xlsx_app_properties_free`. */ KREUZBERGXlsxAppProperties *kreuzberg_xlsx_app_properties_from_json(const char *json); /** * Serialize a `XlsxAppProperties` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_xlsx_app_properties_to_json(const KREUZBERGXlsxAppProperties *ptr); /** * Free a `XlsxAppProperties` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_xlsx_app_properties_free(KREUZBERGXlsxAppProperties *ptr); /** * Get the `application` field from a `XlsxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_xlsx_app_properties_application(const KREUZBERGXlsxAppProperties *ptr); /** * Get the `app_version` field from a `XlsxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_xlsx_app_properties_app_version(const KREUZBERGXlsxAppProperties *ptr); /** * Get the `doc_security` field from a `XlsxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_xlsx_app_properties_doc_security(const KREUZBERGXlsxAppProperties *ptr); /** * Get the `scale_crop` field from a `XlsxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_xlsx_app_properties_scale_crop(const KREUZBERGXlsxAppProperties *ptr); /** * Get the `links_up_to_date` field from a `XlsxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_xlsx_app_properties_links_up_to_date(const KREUZBERGXlsxAppProperties *ptr); /** * Get the `shared_doc` field from a `XlsxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_xlsx_app_properties_shared_doc(const KREUZBERGXlsxAppProperties *ptr); /** * Get the `hyperlinks_changed` field from a `XlsxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_xlsx_app_properties_hyperlinks_changed(const KREUZBERGXlsxAppProperties *ptr); /** * Get the `company` field from a `XlsxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_xlsx_app_properties_company(const KREUZBERGXlsxAppProperties *ptr); /** * Get the `worksheet_names` field from a `XlsxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_xlsx_app_properties_worksheet_names(const KREUZBERGXlsxAppProperties *ptr); /** * Create a `PptxAppProperties` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_pptx_app_properties_free`. */ KREUZBERGPptxAppProperties *kreuzberg_pptx_app_properties_from_json(const char *json); /** * Serialize a `PptxAppProperties` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_pptx_app_properties_to_json(const KREUZBERGPptxAppProperties *ptr); /** * Free a `PptxAppProperties` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_pptx_app_properties_free(KREUZBERGPptxAppProperties *ptr); /** * Get the `application` field from a `PptxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_pptx_app_properties_application(const KREUZBERGPptxAppProperties *ptr); /** * Get the `app_version` field from a `PptxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_pptx_app_properties_app_version(const KREUZBERGPptxAppProperties *ptr); /** * Get the `total_time` field from a `PptxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_pptx_app_properties_total_time(const KREUZBERGPptxAppProperties *ptr); /** * Get the `company` field from a `PptxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_pptx_app_properties_company(const KREUZBERGPptxAppProperties *ptr); /** * Get the `doc_security` field from a `PptxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_pptx_app_properties_doc_security(const KREUZBERGPptxAppProperties *ptr); /** * Get the `scale_crop` field from a `PptxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_pptx_app_properties_scale_crop(const KREUZBERGPptxAppProperties *ptr); /** * Get the `links_up_to_date` field from a `PptxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_pptx_app_properties_links_up_to_date(const KREUZBERGPptxAppProperties *ptr); /** * Get the `shared_doc` field from a `PptxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_pptx_app_properties_shared_doc(const KREUZBERGPptxAppProperties *ptr); /** * Get the `hyperlinks_changed` field from a `PptxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_pptx_app_properties_hyperlinks_changed(const KREUZBERGPptxAppProperties *ptr); /** * Get the `slides` field from a `PptxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_pptx_app_properties_slides(const KREUZBERGPptxAppProperties *ptr); /** * Get the `notes` field from a `PptxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_pptx_app_properties_notes(const KREUZBERGPptxAppProperties *ptr); /** * Get the `hidden_slides` field from a `PptxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_pptx_app_properties_hidden_slides(const KREUZBERGPptxAppProperties *ptr); /** * Get the `multimedia_clips` field from a `PptxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_pptx_app_properties_multimedia_clips(const KREUZBERGPptxAppProperties *ptr); /** * Get the `presentation_format` field from a `PptxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_pptx_app_properties_presentation_format(const KREUZBERGPptxAppProperties *ptr); /** * Get the `slide_titles` field from a `PptxAppProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_pptx_app_properties_slide_titles(const KREUZBERGPptxAppProperties *ptr); /** * Create a `CoreProperties` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_core_properties_free`. */ KREUZBERGCoreProperties *kreuzberg_core_properties_from_json(const char *json); /** * Serialize a `CoreProperties` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_core_properties_to_json(const KREUZBERGCoreProperties *ptr); /** * Free a `CoreProperties` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_core_properties_free(KREUZBERGCoreProperties *ptr); /** * Get the `title` field from a `CoreProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_core_properties_title(const KREUZBERGCoreProperties *ptr); /** * Get the `subject` field from a `CoreProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_core_properties_subject(const KREUZBERGCoreProperties *ptr); /** * Get the `creator` field from a `CoreProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_core_properties_creator(const KREUZBERGCoreProperties *ptr); /** * Get the `keywords` field from a `CoreProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_core_properties_keywords(const KREUZBERGCoreProperties *ptr); /** * Get the `description` field from a `CoreProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_core_properties_description(const KREUZBERGCoreProperties *ptr); /** * Get the `last_modified_by` field from a `CoreProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_core_properties_last_modified_by(const KREUZBERGCoreProperties *ptr); /** * Get the `revision` field from a `CoreProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_core_properties_revision(const KREUZBERGCoreProperties *ptr); /** * Get the `created` field from a `CoreProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_core_properties_created(const KREUZBERGCoreProperties *ptr); /** * Get the `modified` field from a `CoreProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_core_properties_modified(const KREUZBERGCoreProperties *ptr); /** * Get the `category` field from a `CoreProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_core_properties_category(const KREUZBERGCoreProperties *ptr); /** * Get the `content_status` field from a `CoreProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_core_properties_content_status(const KREUZBERGCoreProperties *ptr); /** * Get the `language` field from a `CoreProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_core_properties_language(const KREUZBERGCoreProperties *ptr); /** * Get the `identifier` field from a `CoreProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_core_properties_identifier(const KREUZBERGCoreProperties *ptr); /** * Get the `version` field from a `CoreProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_core_properties_version(const KREUZBERGCoreProperties *ptr); /** * Get the `last_printed` field from a `CoreProperties`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_core_properties_last_printed(const KREUZBERGCoreProperties *ptr); /** * Create a `SecurityLimits` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_security_limits_free`. */ KREUZBERGSecurityLimits *kreuzberg_security_limits_from_json(const char *json); /** * Serialize a `SecurityLimits` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_security_limits_to_json(const KREUZBERGSecurityLimits *ptr); /** * Free a `SecurityLimits` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_security_limits_free(KREUZBERGSecurityLimits *ptr); /** * Get the `max_archive_size` field from a `SecurityLimits`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_security_limits_max_archive_size(const KREUZBERGSecurityLimits *ptr); /** * Get the `max_compression_ratio` field from a `SecurityLimits`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_security_limits_max_compression_ratio(const KREUZBERGSecurityLimits *ptr); /** * Get the `max_files_in_archive` field from a `SecurityLimits`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_security_limits_max_files_in_archive(const KREUZBERGSecurityLimits *ptr); /** * Get the `max_nesting_depth` field from a `SecurityLimits`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_security_limits_max_nesting_depth(const KREUZBERGSecurityLimits *ptr); /** * Get the `max_entity_length` field from a `SecurityLimits`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_security_limits_max_entity_length(const KREUZBERGSecurityLimits *ptr); /** * Get the `max_content_size` field from a `SecurityLimits`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_security_limits_max_content_size(const KREUZBERGSecurityLimits *ptr); /** * Get the `max_iterations` field from a `SecurityLimits`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_security_limits_max_iterations(const KREUZBERGSecurityLimits *ptr); /** * Get the `max_xml_depth` field from a `SecurityLimits`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_security_limits_max_xml_depth(const KREUZBERGSecurityLimits *ptr); /** * Get the `max_table_cells` field from a `SecurityLimits`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_security_limits_max_table_cells(const KREUZBERGSecurityLimits *ptr); /** * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ KREUZBERGSecurityLimits *kreuzberg_security_limits_default(void); /** * Create a `TokenReductionConfig` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_token_reduction_config_free`. */ KREUZBERGTokenReductionConfig *kreuzberg_token_reduction_config_from_json(const char *json); /** * Serialize a `TokenReductionConfig` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_token_reduction_config_to_json(const KREUZBERGTokenReductionConfig *ptr); /** * Free a `TokenReductionConfig` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_token_reduction_config_free(KREUZBERGTokenReductionConfig *ptr); /** * Get the `level` field from a `TokenReductionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGReductionLevel *kreuzberg_token_reduction_config_level(const KREUZBERGTokenReductionConfig *ptr); /** * Get the `language_hint` field from a `TokenReductionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_token_reduction_config_language_hint(const KREUZBERGTokenReductionConfig *ptr); /** * Get the `preserve_markdown` field from a `TokenReductionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_token_reduction_config_preserve_markdown(const KREUZBERGTokenReductionConfig *ptr); /** * Get the `preserve_code` field from a `TokenReductionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_token_reduction_config_preserve_code(const KREUZBERGTokenReductionConfig *ptr); /** * Get the `semantic_threshold` field from a `TokenReductionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ float kreuzberg_token_reduction_config_semantic_threshold(const KREUZBERGTokenReductionConfig *ptr); /** * Get the `enable_parallel` field from a `TokenReductionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_token_reduction_config_enable_parallel(const KREUZBERGTokenReductionConfig *ptr); /** * Get the `use_simd` field from a `TokenReductionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_token_reduction_config_use_simd(const KREUZBERGTokenReductionConfig *ptr); /** * Get the `custom_stopwords` field from a `TokenReductionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_token_reduction_config_custom_stopwords(const KREUZBERGTokenReductionConfig *ptr); /** * Get the `preserve_patterns` field from a `TokenReductionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_token_reduction_config_preserve_patterns(const KREUZBERGTokenReductionConfig *ptr); /** * Get the `target_reduction` field from a `TokenReductionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ float kreuzberg_token_reduction_config_target_reduction(const KREUZBERGTokenReductionConfig *ptr); /** * Get the `enable_semantic_clustering` field from a `TokenReductionConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_token_reduction_config_enable_semantic_clustering(const KREUZBERGTokenReductionConfig *ptr); /** * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ KREUZBERGTokenReductionConfig *kreuzberg_token_reduction_config_default(void); /** * Create a `PdfAnnotation` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_pdf_annotation_free`. */ KREUZBERGPdfAnnotation *kreuzberg_pdf_annotation_from_json(const char *json); /** * Serialize a `PdfAnnotation` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_pdf_annotation_to_json(const KREUZBERGPdfAnnotation *ptr); /** * Free a `PdfAnnotation` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_pdf_annotation_free(KREUZBERGPdfAnnotation *ptr); /** * Get the `annotation_type` field from a `PdfAnnotation`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGPdfAnnotationType *kreuzberg_pdf_annotation_annotation_type(const KREUZBERGPdfAnnotation *ptr); /** * Get the `content` field from a `PdfAnnotation`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_pdf_annotation_content(const KREUZBERGPdfAnnotation *ptr); /** * Get the `page_number` field from a `PdfAnnotation`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_pdf_annotation_page_number(const KREUZBERGPdfAnnotation *ptr); /** * Get the `bounding_box` field from a `PdfAnnotation`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGBoundingBox *kreuzberg_pdf_annotation_bounding_box(const KREUZBERGPdfAnnotation *ptr); /** * Create a `DjotContent` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_djot_content_free`. */ KREUZBERGDjotContent *kreuzberg_djot_content_from_json(const char *json); /** * Serialize a `DjotContent` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_djot_content_to_json(const KREUZBERGDjotContent *ptr); /** * Free a `DjotContent` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_djot_content_free(KREUZBERGDjotContent *ptr); /** * Get the `plain_text` field from a `DjotContent`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_djot_content_plain_text(const KREUZBERGDjotContent *ptr); /** * Get the `blocks` field from a `DjotContent`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_djot_content_blocks(const KREUZBERGDjotContent *ptr); /** * Get the `metadata` field from a `DjotContent`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGMetadata *kreuzberg_djot_content_metadata(const KREUZBERGDjotContent *ptr); /** * Get the `tables` field from a `DjotContent`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_djot_content_tables(const KREUZBERGDjotContent *ptr); /** * Get the `images` field from a `DjotContent`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_djot_content_images(const KREUZBERGDjotContent *ptr); /** * Get the `links` field from a `DjotContent`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_djot_content_links(const KREUZBERGDjotContent *ptr); /** * Get the `footnotes` field from a `DjotContent`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_djot_content_footnotes(const KREUZBERGDjotContent *ptr); /** * Create a `FormattedBlock` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_formatted_block_free`. */ KREUZBERGFormattedBlock *kreuzberg_formatted_block_from_json(const char *json); /** * Serialize a `FormattedBlock` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_formatted_block_to_json(const KREUZBERGFormattedBlock *ptr); /** * Free a `FormattedBlock` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_formatted_block_free(KREUZBERGFormattedBlock *ptr); /** * Get the `block_type` field from a `FormattedBlock`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGBlockType *kreuzberg_formatted_block_block_type(const KREUZBERGFormattedBlock *ptr); /** * Get the `level` field from a `FormattedBlock`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_formatted_block_level(const KREUZBERGFormattedBlock *ptr); /** * Get the `inline_content` field from a `FormattedBlock`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_formatted_block_inline_content(const KREUZBERGFormattedBlock *ptr); /** * Get the `language` field from a `FormattedBlock`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_formatted_block_language(const KREUZBERGFormattedBlock *ptr); /** * Get the `code` field from a `FormattedBlock`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_formatted_block_code(const KREUZBERGFormattedBlock *ptr); /** * Get the `children` field from a `FormattedBlock`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_formatted_block_children(const KREUZBERGFormattedBlock *ptr); /** * Create a `InlineElement` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_inline_element_free`. */ KREUZBERGInlineElement *kreuzberg_inline_element_from_json(const char *json); /** * Serialize a `InlineElement` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_inline_element_to_json(const KREUZBERGInlineElement *ptr); /** * Free a `InlineElement` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_inline_element_free(KREUZBERGInlineElement *ptr); /** * Get the `element_type` field from a `InlineElement`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGInlineType *kreuzberg_inline_element_element_type(const KREUZBERGInlineElement *ptr); /** * Get the `content` field from a `InlineElement`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_inline_element_content(const KREUZBERGInlineElement *ptr); /** * Get the `metadata` field from a `InlineElement`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_inline_element_metadata(const KREUZBERGInlineElement *ptr); /** * Create a `DjotImage` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_djot_image_free`. */ KREUZBERGDjotImage *kreuzberg_djot_image_from_json(const char *json); /** * Serialize a `DjotImage` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_djot_image_to_json(const KREUZBERGDjotImage *ptr); /** * Free a `DjotImage` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_djot_image_free(KREUZBERGDjotImage *ptr); /** * Get the `src` field from a `DjotImage`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_djot_image_src(const KREUZBERGDjotImage *ptr); /** * Get the `alt` field from a `DjotImage`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_djot_image_alt(const KREUZBERGDjotImage *ptr); /** * Get the `title` field from a `DjotImage`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_djot_image_title(const KREUZBERGDjotImage *ptr); /** * Create a `DjotLink` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_djot_link_free`. */ KREUZBERGDjotLink *kreuzberg_djot_link_from_json(const char *json); /** * Serialize a `DjotLink` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_djot_link_to_json(const KREUZBERGDjotLink *ptr); /** * Free a `DjotLink` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_djot_link_free(KREUZBERGDjotLink *ptr); /** * Get the `url` field from a `DjotLink`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_djot_link_url(const KREUZBERGDjotLink *ptr); /** * Get the `text` field from a `DjotLink`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_djot_link_text(const KREUZBERGDjotLink *ptr); /** * Get the `title` field from a `DjotLink`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_djot_link_title(const KREUZBERGDjotLink *ptr); /** * Create a `Footnote` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_footnote_free`. */ KREUZBERGFootnote *kreuzberg_footnote_from_json(const char *json); /** * Serialize a `Footnote` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_footnote_to_json(const KREUZBERGFootnote *ptr); /** * Free a `Footnote` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_footnote_free(KREUZBERGFootnote *ptr); /** * Get the `label` field from a `Footnote`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_footnote_label(const KREUZBERGFootnote *ptr); /** * Get the `content` field from a `Footnote`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_footnote_content(const KREUZBERGFootnote *ptr); /** * Create a `DocumentStructure` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_document_structure_free`. */ KREUZBERGDocumentStructure *kreuzberg_document_structure_from_json(const char *json); /** * Serialize a `DocumentStructure` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_document_structure_to_json(const KREUZBERGDocumentStructure *ptr); /** * Free a `DocumentStructure` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_document_structure_free(KREUZBERGDocumentStructure *ptr); /** * Get the `nodes` field from a `DocumentStructure`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_document_structure_nodes(const KREUZBERGDocumentStructure *ptr); /** * Get the `source_format` field from a `DocumentStructure`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_document_structure_source_format(const KREUZBERGDocumentStructure *ptr); /** * Get the `relationships` field from a `DocumentStructure`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_document_structure_relationships(const KREUZBERGDocumentStructure *ptr); /** * Get the `node_types` field from a `DocumentStructure`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_document_structure_node_types(const KREUZBERGDocumentStructure *ptr); /** * Compute and populate the `node_types` field from the current `nodes`. * * Call this after all nodes have been added to the structure. Internal * construction paths (builder, derivation) call this automatically. * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. * \code * use kreuzberg::types::document_structure::{DocumentStructure, DocumentNode, NodeContent, NodeId}; * * let mut structure = DocumentStructure { * nodes: vec![DocumentNode { * id: NodeId::from("n1"), * content: NodeContent::Paragraph { text: "Hello".into() }, * parent: None, * children: vec![], * content_layer: Default::default(), * page: None, * page_end: None, * bbox: None, * annotations: vec![], * attributes: None, * }], * source_format: None, * relationships: vec![], * node_types: vec![], * }; * structure.finalize_node_types(); * assert!(structure.node_types.contains(&"paragraph".to_string())); * \endcode */ void kreuzberg_document_structure_finalize_node_types(KREUZBERGDocumentStructure *this_); /** * Check if the document structure is empty. * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ int32_t kreuzberg_document_structure_is_empty(const KREUZBERGDocumentStructure *this_); /** * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ KREUZBERGDocumentStructure *kreuzberg_document_structure_default(void); /** * Create a `DocumentRelationship` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_document_relationship_free`. */ KREUZBERGDocumentRelationship *kreuzberg_document_relationship_from_json(const char *json); /** * Serialize a `DocumentRelationship` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_document_relationship_to_json(const KREUZBERGDocumentRelationship *ptr); /** * Free a `DocumentRelationship` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_document_relationship_free(KREUZBERGDocumentRelationship *ptr); /** * Get the `source` field from a `DocumentRelationship`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_document_relationship_source(const KREUZBERGDocumentRelationship *ptr); /** * Get the `target` field from a `DocumentRelationship`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_document_relationship_target(const KREUZBERGDocumentRelationship *ptr); /** * Get the `kind` field from a `DocumentRelationship`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGRelationshipKind *kreuzberg_document_relationship_kind(const KREUZBERGDocumentRelationship *ptr); /** * Create a `DocumentNode` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_document_node_free`. */ KREUZBERGDocumentNode *kreuzberg_document_node_from_json(const char *json); /** * Serialize a `DocumentNode` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_document_node_to_json(const KREUZBERGDocumentNode *ptr); /** * Free a `DocumentNode` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_document_node_free(KREUZBERGDocumentNode *ptr); /** * Get the `content` field from a `DocumentNode`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGNodeContent *kreuzberg_document_node_content(const KREUZBERGDocumentNode *ptr); /** * Get the `parent` field from a `DocumentNode`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_document_node_parent(const KREUZBERGDocumentNode *ptr); /** * Get the `children` field from a `DocumentNode`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_document_node_children(const KREUZBERGDocumentNode *ptr); /** * Get the `content_layer` field from a `DocumentNode`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGContentLayer *kreuzberg_document_node_content_layer(const KREUZBERGDocumentNode *ptr); /** * Get the `page` field from a `DocumentNode`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_document_node_page(const KREUZBERGDocumentNode *ptr); /** * Get the `page_end` field from a `DocumentNode`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_document_node_page_end(const KREUZBERGDocumentNode *ptr); /** * Get the `bbox` field from a `DocumentNode`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGBoundingBox *kreuzberg_document_node_bbox(const KREUZBERGDocumentNode *ptr); /** * Get the `annotations` field from a `DocumentNode`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_document_node_annotations(const KREUZBERGDocumentNode *ptr); /** * Get the `attributes` field from a `DocumentNode`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_document_node_attributes(const KREUZBERGDocumentNode *ptr); /** * Create a `TableGrid` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_table_grid_free`. */ KREUZBERGTableGrid *kreuzberg_table_grid_from_json(const char *json); /** * Serialize a `TableGrid` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_table_grid_to_json(const KREUZBERGTableGrid *ptr); /** * Free a `TableGrid` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_table_grid_free(KREUZBERGTableGrid *ptr); /** * Get the `rows` field from a `TableGrid`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_table_grid_rows(const KREUZBERGTableGrid *ptr); /** * Get the `cols` field from a `TableGrid`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_table_grid_cols(const KREUZBERGTableGrid *ptr); /** * Get the `cells` field from a `TableGrid`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_table_grid_cells(const KREUZBERGTableGrid *ptr); /** * Create a `GridCell` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_grid_cell_free`. */ KREUZBERGGridCell *kreuzberg_grid_cell_from_json(const char *json); /** * Serialize a `GridCell` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_grid_cell_to_json(const KREUZBERGGridCell *ptr); /** * Free a `GridCell` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_grid_cell_free(KREUZBERGGridCell *ptr); /** * Get the `content` field from a `GridCell`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_grid_cell_content(const KREUZBERGGridCell *ptr); /** * Get the `row` field from a `GridCell`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_grid_cell_row(const KREUZBERGGridCell *ptr); /** * Get the `col` field from a `GridCell`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_grid_cell_col(const KREUZBERGGridCell *ptr); /** * Get the `row_span` field from a `GridCell`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_grid_cell_row_span(const KREUZBERGGridCell *ptr); /** * Get the `col_span` field from a `GridCell`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_grid_cell_col_span(const KREUZBERGGridCell *ptr); /** * Get the `is_header` field from a `GridCell`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_grid_cell_is_header(const KREUZBERGGridCell *ptr); /** * Get the `bbox` field from a `GridCell`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGBoundingBox *kreuzberg_grid_cell_bbox(const KREUZBERGGridCell *ptr); /** * Create a `TextAnnotation` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_text_annotation_free`. */ KREUZBERGTextAnnotation *kreuzberg_text_annotation_from_json(const char *json); /** * Serialize a `TextAnnotation` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_text_annotation_to_json(const KREUZBERGTextAnnotation *ptr); /** * Free a `TextAnnotation` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_text_annotation_free(KREUZBERGTextAnnotation *ptr); /** * Get the `start` field from a `TextAnnotation`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_text_annotation_start(const KREUZBERGTextAnnotation *ptr); /** * Get the `end` field from a `TextAnnotation`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_text_annotation_end(const KREUZBERGTextAnnotation *ptr); /** * Get the `kind` field from a `TextAnnotation`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGAnnotationKind *kreuzberg_text_annotation_kind(const KREUZBERGTextAnnotation *ptr); /** * Create a `ExtractionResult` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_extraction_result_free`. */ KREUZBERGExtractionResult *kreuzberg_extraction_result_from_json(const char *json); /** * Serialize a `ExtractionResult` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_extraction_result_to_json(const KREUZBERGExtractionResult *ptr); /** * Free a `ExtractionResult` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_extraction_result_free(KREUZBERGExtractionResult *ptr); /** * Get the `content` field from a `ExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_extraction_result_content(const KREUZBERGExtractionResult *ptr); /** * Get the `mime_type` field from a `ExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_extraction_result_mime_type(const KREUZBERGExtractionResult *ptr); /** * Get the `metadata` field from a `ExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGMetadata *kreuzberg_extraction_result_metadata(const KREUZBERGExtractionResult *ptr); /** * Get the `extraction_method` field from a `ExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGExtractionMethod *kreuzberg_extraction_result_extraction_method(const KREUZBERGExtractionResult *ptr); /** * Get the `tables` field from a `ExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_extraction_result_tables(const KREUZBERGExtractionResult *ptr); /** * Get the `detected_languages` field from a `ExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_extraction_result_detected_languages(const KREUZBERGExtractionResult *ptr); /** * Get the `chunks` field from a `ExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_extraction_result_chunks(const KREUZBERGExtractionResult *ptr); /** * Get the `images` field from a `ExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_extraction_result_images(const KREUZBERGExtractionResult *ptr); /** * Get the `pages` field from a `ExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_extraction_result_pages(const KREUZBERGExtractionResult *ptr); /** * Get the `elements` field from a `ExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_extraction_result_elements(const KREUZBERGExtractionResult *ptr); /** * Get the `djot_content` field from a `ExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGDjotContent *kreuzberg_extraction_result_djot_content(const KREUZBERGExtractionResult *ptr); /** * Get the `ocr_elements` field from a `ExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_extraction_result_ocr_elements(const KREUZBERGExtractionResult *ptr); /** * Get the `document` field from a `ExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGDocumentStructure *kreuzberg_extraction_result_document(const KREUZBERGExtractionResult *ptr); /** * Get the `extracted_keywords` field from a `ExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_extraction_result_extracted_keywords(const KREUZBERGExtractionResult *ptr); /** * Get the `quality_score` field from a `ExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ double kreuzberg_extraction_result_quality_score(const KREUZBERGExtractionResult *ptr); /** * Get the `processing_warnings` field from a `ExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_extraction_result_processing_warnings(const KREUZBERGExtractionResult *ptr); /** * Get the `annotations` field from a `ExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_extraction_result_annotations(const KREUZBERGExtractionResult *ptr); /** * Get the `children` field from a `ExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_extraction_result_children(const KREUZBERGExtractionResult *ptr); /** * Get the `uris` field from a `ExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_extraction_result_uris(const KREUZBERGExtractionResult *ptr); /** * Get the `structured_output` field from a `ExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_extraction_result_structured_output(const KREUZBERGExtractionResult *ptr); /** * Get the `code_intelligence` field from a `ExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_extraction_result_code_intelligence(const KREUZBERGExtractionResult *ptr); /** * Get the `llm_usage` field from a `ExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_extraction_result_llm_usage(const KREUZBERGExtractionResult *ptr); /** * Get the `formatted_content` field from a `ExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_extraction_result_formatted_content(const KREUZBERGExtractionResult *ptr); /** * Convert from an OCR result. * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ KREUZBERGExtractionResult *kreuzberg_extraction_result_from_ocr(const KREUZBERGOcrExtractionResult *ocr); /** * Create a `ArchiveEntry` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_archive_entry_free`. */ KREUZBERGArchiveEntry *kreuzberg_archive_entry_from_json(const char *json); /** * Serialize a `ArchiveEntry` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_archive_entry_to_json(const KREUZBERGArchiveEntry *ptr); /** * Free a `ArchiveEntry` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_archive_entry_free(KREUZBERGArchiveEntry *ptr); /** * Get the `path` field from a `ArchiveEntry`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_archive_entry_path(const KREUZBERGArchiveEntry *ptr); /** * Get the `mime_type` field from a `ArchiveEntry`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_archive_entry_mime_type(const KREUZBERGArchiveEntry *ptr); /** * Get the `result` field from a `ArchiveEntry`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGExtractionResult *kreuzberg_archive_entry_result(const KREUZBERGArchiveEntry *ptr); /** * Create a `ProcessingWarning` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_processing_warning_free`. */ KREUZBERGProcessingWarning *kreuzberg_processing_warning_from_json(const char *json); /** * Serialize a `ProcessingWarning` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_processing_warning_to_json(const KREUZBERGProcessingWarning *ptr); /** * Free a `ProcessingWarning` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_processing_warning_free(KREUZBERGProcessingWarning *ptr); /** * Get the `source` field from a `ProcessingWarning`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_processing_warning_source(const KREUZBERGProcessingWarning *ptr); /** * Get the `message` field from a `ProcessingWarning`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_processing_warning_message(const KREUZBERGProcessingWarning *ptr); /** * Create a `LlmUsage` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_llm_usage_free`. */ KREUZBERGLlmUsage *kreuzberg_llm_usage_from_json(const char *json); /** * Serialize a `LlmUsage` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_llm_usage_to_json(const KREUZBERGLlmUsage *ptr); /** * Free a `LlmUsage` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_llm_usage_free(KREUZBERGLlmUsage *ptr); /** * Get the `model` field from a `LlmUsage`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_llm_usage_model(const KREUZBERGLlmUsage *ptr); /** * Get the `source` field from a `LlmUsage`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_llm_usage_source(const KREUZBERGLlmUsage *ptr); /** * Get the `input_tokens` field from a `LlmUsage`. * # Safety * Pointer must be a valid handle returned by this library. */ uint64_t kreuzberg_llm_usage_input_tokens(const KREUZBERGLlmUsage *ptr); /** * Get the `output_tokens` field from a `LlmUsage`. * # Safety * Pointer must be a valid handle returned by this library. */ uint64_t kreuzberg_llm_usage_output_tokens(const KREUZBERGLlmUsage *ptr); /** * Get the `total_tokens` field from a `LlmUsage`. * # Safety * Pointer must be a valid handle returned by this library. */ uint64_t kreuzberg_llm_usage_total_tokens(const KREUZBERGLlmUsage *ptr); /** * Get the `estimated_cost` field from a `LlmUsage`. * # Safety * Pointer must be a valid handle returned by this library. */ double kreuzberg_llm_usage_estimated_cost(const KREUZBERGLlmUsage *ptr); /** * Get the `finish_reason` field from a `LlmUsage`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_llm_usage_finish_reason(const KREUZBERGLlmUsage *ptr); /** * Create a `Chunk` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_chunk_free`. */ KREUZBERGChunk *kreuzberg_chunk_from_json(const char *json); /** * Serialize a `Chunk` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_chunk_to_json(const KREUZBERGChunk *ptr); /** * Free a `Chunk` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_chunk_free(KREUZBERGChunk *ptr); /** * Get the `content` field from a `Chunk`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_chunk_content(const KREUZBERGChunk *ptr); /** * Get the `chunk_type` field from a `Chunk`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGChunkType *kreuzberg_chunk_chunk_type(const KREUZBERGChunk *ptr); /** * Get the `embedding` field from a `Chunk`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_chunk_embedding(const KREUZBERGChunk *ptr); /** * Get the `metadata` field from a `Chunk`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGChunkMetadata *kreuzberg_chunk_metadata(const KREUZBERGChunk *ptr); /** * Create a `HeadingContext` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_heading_context_free`. */ KREUZBERGHeadingContext *kreuzberg_heading_context_from_json(const char *json); /** * Serialize a `HeadingContext` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_heading_context_to_json(const KREUZBERGHeadingContext *ptr); /** * Free a `HeadingContext` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_heading_context_free(KREUZBERGHeadingContext *ptr); /** * Get the `headings` field from a `HeadingContext`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_heading_context_headings(const KREUZBERGHeadingContext *ptr); /** * Create a `HeadingLevel` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_heading_level_free`. */ KREUZBERGHeadingLevel *kreuzberg_heading_level_from_json(const char *json); /** * Serialize a `HeadingLevel` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_heading_level_to_json(const KREUZBERGHeadingLevel *ptr); /** * Free a `HeadingLevel` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_heading_level_free(KREUZBERGHeadingLevel *ptr); /** * Get the `level` field from a `HeadingLevel`. * # Safety * Pointer must be a valid handle returned by this library. */ uint8_t kreuzberg_heading_level_level(const KREUZBERGHeadingLevel *ptr); /** * Get the `text` field from a `HeadingLevel`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_heading_level_text(const KREUZBERGHeadingLevel *ptr); /** * Create a `ChunkMetadata` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_chunk_metadata_free`. */ KREUZBERGChunkMetadata *kreuzberg_chunk_metadata_from_json(const char *json); /** * Serialize a `ChunkMetadata` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_chunk_metadata_to_json(const KREUZBERGChunkMetadata *ptr); /** * Free a `ChunkMetadata` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_chunk_metadata_free(KREUZBERGChunkMetadata *ptr); /** * Get the `byte_start` field from a `ChunkMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_chunk_metadata_byte_start(const KREUZBERGChunkMetadata *ptr); /** * Get the `byte_end` field from a `ChunkMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_chunk_metadata_byte_end(const KREUZBERGChunkMetadata *ptr); /** * Get the `token_count` field from a `ChunkMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_chunk_metadata_token_count(const KREUZBERGChunkMetadata *ptr); /** * Get the `chunk_index` field from a `ChunkMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_chunk_metadata_chunk_index(const KREUZBERGChunkMetadata *ptr); /** * Get the `total_chunks` field from a `ChunkMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_chunk_metadata_total_chunks(const KREUZBERGChunkMetadata *ptr); /** * Get the `first_page` field from a `ChunkMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_chunk_metadata_first_page(const KREUZBERGChunkMetadata *ptr); /** * Get the `last_page` field from a `ChunkMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_chunk_metadata_last_page(const KREUZBERGChunkMetadata *ptr); /** * Get the `heading_context` field from a `ChunkMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGHeadingContext *kreuzberg_chunk_metadata_heading_context(const KREUZBERGChunkMetadata *ptr); /** * Get the `image_indices` field from a `ChunkMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_chunk_metadata_image_indices(const KREUZBERGChunkMetadata *ptr); /** * Create a `ExtractedImage` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_extracted_image_free`. */ KREUZBERGExtractedImage *kreuzberg_extracted_image_from_json(const char *json); /** * Serialize a `ExtractedImage` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_extracted_image_to_json(const KREUZBERGExtractedImage *ptr); /** * Free a `ExtractedImage` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_extracted_image_free(KREUZBERGExtractedImage *ptr); /** * Get the `data` field from a `ExtractedImage`. * # Safety * Pointer must be a valid handle returned by this library. */ uint8_t *kreuzberg_extracted_image_data(const KREUZBERGExtractedImage *ptr, uintptr_t *out_len); /** * Get the `format` field from a `ExtractedImage`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_extracted_image_format(const KREUZBERGExtractedImage *ptr); /** * Get the `image_index` field from a `ExtractedImage`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_extracted_image_image_index(const KREUZBERGExtractedImage *ptr); /** * Get the `page_number` field from a `ExtractedImage`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_extracted_image_page_number(const KREUZBERGExtractedImage *ptr); /** * Get the `width` field from a `ExtractedImage`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_extracted_image_width(const KREUZBERGExtractedImage *ptr); /** * Get the `height` field from a `ExtractedImage`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_extracted_image_height(const KREUZBERGExtractedImage *ptr); /** * Get the `colorspace` field from a `ExtractedImage`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_extracted_image_colorspace(const KREUZBERGExtractedImage *ptr); /** * Get the `bits_per_component` field from a `ExtractedImage`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_extracted_image_bits_per_component(const KREUZBERGExtractedImage *ptr); /** * Get the `is_mask` field from a `ExtractedImage`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_extracted_image_is_mask(const KREUZBERGExtractedImage *ptr); /** * Get the `description` field from a `ExtractedImage`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_extracted_image_description(const KREUZBERGExtractedImage *ptr); /** * Get the `ocr_result` field from a `ExtractedImage`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGExtractionResult *kreuzberg_extracted_image_ocr_result(const KREUZBERGExtractedImage *ptr); /** * Get the `bounding_box` field from a `ExtractedImage`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGBoundingBox *kreuzberg_extracted_image_bounding_box(const KREUZBERGExtractedImage *ptr); /** * Get the `source_path` field from a `ExtractedImage`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_extracted_image_source_path(const KREUZBERGExtractedImage *ptr); /** * Get the `image_kind` field from a `ExtractedImage`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGImageKind *kreuzberg_extracted_image_image_kind(const KREUZBERGExtractedImage *ptr); /** * Get the `kind_confidence` field from a `ExtractedImage`. * # Safety * Pointer must be a valid handle returned by this library. */ float kreuzberg_extracted_image_kind_confidence(const KREUZBERGExtractedImage *ptr); /** * Get the `cluster_id` field from a `ExtractedImage`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_extracted_image_cluster_id(const KREUZBERGExtractedImage *ptr); /** * Create a `BoundingBox` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_bounding_box_free`. */ KREUZBERGBoundingBox *kreuzberg_bounding_box_from_json(const char *json); /** * Serialize a `BoundingBox` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_bounding_box_to_json(const KREUZBERGBoundingBox *ptr); /** * Free a `BoundingBox` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_bounding_box_free(KREUZBERGBoundingBox *ptr); /** * Get the `x0` field from a `BoundingBox`. * # Safety * Pointer must be a valid handle returned by this library. */ double kreuzberg_bounding_box_x0(const KREUZBERGBoundingBox *ptr); /** * Get the `y0` field from a `BoundingBox`. * # Safety * Pointer must be a valid handle returned by this library. */ double kreuzberg_bounding_box_y0(const KREUZBERGBoundingBox *ptr); /** * Get the `x1` field from a `BoundingBox`. * # Safety * Pointer must be a valid handle returned by this library. */ double kreuzberg_bounding_box_x1(const KREUZBERGBoundingBox *ptr); /** * Get the `y1` field from a `BoundingBox`. * # Safety * Pointer must be a valid handle returned by this library. */ double kreuzberg_bounding_box_y1(const KREUZBERGBoundingBox *ptr); /** * Create a `ElementMetadata` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_element_metadata_free`. */ KREUZBERGElementMetadata *kreuzberg_element_metadata_from_json(const char *json); /** * Serialize a `ElementMetadata` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_element_metadata_to_json(const KREUZBERGElementMetadata *ptr); /** * Free a `ElementMetadata` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_element_metadata_free(KREUZBERGElementMetadata *ptr); /** * Get the `page_number` field from a `ElementMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_element_metadata_page_number(const KREUZBERGElementMetadata *ptr); /** * Get the `filename` field from a `ElementMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_element_metadata_filename(const KREUZBERGElementMetadata *ptr); /** * Get the `coordinates` field from a `ElementMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGBoundingBox *kreuzberg_element_metadata_coordinates(const KREUZBERGElementMetadata *ptr); /** * Get the `element_index` field from a `ElementMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_element_metadata_element_index(const KREUZBERGElementMetadata *ptr); /** * Get the `additional` field from a `ElementMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_element_metadata_additional(const KREUZBERGElementMetadata *ptr); /** * Create a `Element` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_element_free`. */ KREUZBERGElement *kreuzberg_element_from_json(const char *json); /** * Serialize a `Element` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_element_to_json(const KREUZBERGElement *ptr); /** * Free a `Element` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_element_free(KREUZBERGElement *ptr); /** * Get the `element_type` field from a `Element`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGElementType *kreuzberg_element_element_type(const KREUZBERGElement *ptr); /** * Get the `text` field from a `Element`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_element_text(const KREUZBERGElement *ptr); /** * Get the `metadata` field from a `Element`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGElementMetadata *kreuzberg_element_metadata(const KREUZBERGElement *ptr); /** * Create a `ExcelWorkbook` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_excel_workbook_free`. */ KREUZBERGExcelWorkbook *kreuzberg_excel_workbook_from_json(const char *json); /** * Serialize a `ExcelWorkbook` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_excel_workbook_to_json(const KREUZBERGExcelWorkbook *ptr); /** * Free a `ExcelWorkbook` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_excel_workbook_free(KREUZBERGExcelWorkbook *ptr); /** * Get the `sheets` field from a `ExcelWorkbook`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_excel_workbook_sheets(const KREUZBERGExcelWorkbook *ptr); /** * Get the `metadata` field from a `ExcelWorkbook`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_excel_workbook_metadata(const KREUZBERGExcelWorkbook *ptr); /** * Create a `ExcelSheet` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_excel_sheet_free`. */ KREUZBERGExcelSheet *kreuzberg_excel_sheet_from_json(const char *json); /** * Serialize a `ExcelSheet` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_excel_sheet_to_json(const KREUZBERGExcelSheet *ptr); /** * Free a `ExcelSheet` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_excel_sheet_free(KREUZBERGExcelSheet *ptr); /** * Get the `name` field from a `ExcelSheet`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_excel_sheet_name(const KREUZBERGExcelSheet *ptr); /** * Get the `markdown` field from a `ExcelSheet`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_excel_sheet_markdown(const KREUZBERGExcelSheet *ptr); /** * Get the `row_count` field from a `ExcelSheet`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_excel_sheet_row_count(const KREUZBERGExcelSheet *ptr); /** * Get the `col_count` field from a `ExcelSheet`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_excel_sheet_col_count(const KREUZBERGExcelSheet *ptr); /** * Get the `cell_count` field from a `ExcelSheet`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_excel_sheet_cell_count(const KREUZBERGExcelSheet *ptr); /** * Get the `table_cells` field from a `ExcelSheet`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_excel_sheet_table_cells(const KREUZBERGExcelSheet *ptr); /** * Create a `XmlExtractionResult` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_xml_extraction_result_free`. */ KREUZBERGXmlExtractionResult *kreuzberg_xml_extraction_result_from_json(const char *json); /** * Serialize a `XmlExtractionResult` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_xml_extraction_result_to_json(const KREUZBERGXmlExtractionResult *ptr); /** * Free a `XmlExtractionResult` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_xml_extraction_result_free(KREUZBERGXmlExtractionResult *ptr); /** * Get the `content` field from a `XmlExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_xml_extraction_result_content(const KREUZBERGXmlExtractionResult *ptr); /** * Get the `element_count` field from a `XmlExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_xml_extraction_result_element_count(const KREUZBERGXmlExtractionResult *ptr); /** * Get the `unique_elements` field from a `XmlExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_xml_extraction_result_unique_elements(const KREUZBERGXmlExtractionResult *ptr); /** * Create a `TextExtractionResult` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_text_extraction_result_free`. */ KREUZBERGTextExtractionResult *kreuzberg_text_extraction_result_from_json(const char *json); /** * Serialize a `TextExtractionResult` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_text_extraction_result_to_json(const KREUZBERGTextExtractionResult *ptr); /** * Free a `TextExtractionResult` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_text_extraction_result_free(KREUZBERGTextExtractionResult *ptr); /** * Get the `content` field from a `TextExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_text_extraction_result_content(const KREUZBERGTextExtractionResult *ptr); /** * Get the `line_count` field from a `TextExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_text_extraction_result_line_count(const KREUZBERGTextExtractionResult *ptr); /** * Get the `word_count` field from a `TextExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_text_extraction_result_word_count(const KREUZBERGTextExtractionResult *ptr); /** * Get the `character_count` field from a `TextExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_text_extraction_result_character_count(const KREUZBERGTextExtractionResult *ptr); /** * Get the `headers` field from a `TextExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_text_extraction_result_headers(const KREUZBERGTextExtractionResult *ptr); /** * Create a `PptxExtractionResult` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_pptx_extraction_result_free`. */ KREUZBERGPptxExtractionResult *kreuzberg_pptx_extraction_result_from_json(const char *json); /** * Serialize a `PptxExtractionResult` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_pptx_extraction_result_to_json(const KREUZBERGPptxExtractionResult *ptr); /** * Free a `PptxExtractionResult` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_pptx_extraction_result_free(KREUZBERGPptxExtractionResult *ptr); /** * Get the `content` field from a `PptxExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_pptx_extraction_result_content(const KREUZBERGPptxExtractionResult *ptr); /** * Get the `metadata` field from a `PptxExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGPptxMetadata *kreuzberg_pptx_extraction_result_metadata(const KREUZBERGPptxExtractionResult *ptr); /** * Get the `slide_count` field from a `PptxExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_pptx_extraction_result_slide_count(const KREUZBERGPptxExtractionResult *ptr); /** * Get the `image_count` field from a `PptxExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_pptx_extraction_result_image_count(const KREUZBERGPptxExtractionResult *ptr); /** * Get the `table_count` field from a `PptxExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_pptx_extraction_result_table_count(const KREUZBERGPptxExtractionResult *ptr); /** * Get the `images` field from a `PptxExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_pptx_extraction_result_images(const KREUZBERGPptxExtractionResult *ptr); /** * Get the `page_structure` field from a `PptxExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGPageStructure *kreuzberg_pptx_extraction_result_page_structure(const KREUZBERGPptxExtractionResult *ptr); /** * Get the `page_contents` field from a `PptxExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_pptx_extraction_result_page_contents(const KREUZBERGPptxExtractionResult *ptr); /** * Get the `document` field from a `PptxExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGDocumentStructure *kreuzberg_pptx_extraction_result_document(const KREUZBERGPptxExtractionResult *ptr); /** * Get the `office_metadata` field from a `PptxExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_pptx_extraction_result_office_metadata(const KREUZBERGPptxExtractionResult *ptr); /** * Create a `EmailExtractionResult` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_email_extraction_result_free`. */ KREUZBERGEmailExtractionResult *kreuzberg_email_extraction_result_from_json(const char *json); /** * Serialize a `EmailExtractionResult` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_email_extraction_result_to_json(const KREUZBERGEmailExtractionResult *ptr); /** * Free a `EmailExtractionResult` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_email_extraction_result_free(KREUZBERGEmailExtractionResult *ptr); /** * Get the `subject` field from a `EmailExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_email_extraction_result_subject(const KREUZBERGEmailExtractionResult *ptr); /** * Get the `from_email` field from a `EmailExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_email_extraction_result_from_email(const KREUZBERGEmailExtractionResult *ptr); /** * Get the `to_emails` field from a `EmailExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_email_extraction_result_to_emails(const KREUZBERGEmailExtractionResult *ptr); /** * Get the `cc_emails` field from a `EmailExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_email_extraction_result_cc_emails(const KREUZBERGEmailExtractionResult *ptr); /** * Get the `bcc_emails` field from a `EmailExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_email_extraction_result_bcc_emails(const KREUZBERGEmailExtractionResult *ptr); /** * Get the `date` field from a `EmailExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_email_extraction_result_date(const KREUZBERGEmailExtractionResult *ptr); /** * Get the `message_id` field from a `EmailExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_email_extraction_result_message_id(const KREUZBERGEmailExtractionResult *ptr); /** * Get the `plain_text` field from a `EmailExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_email_extraction_result_plain_text(const KREUZBERGEmailExtractionResult *ptr); /** * Get the `html_content` field from a `EmailExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_email_extraction_result_html_content(const KREUZBERGEmailExtractionResult *ptr); /** * Get the `content` field from a `EmailExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_email_extraction_result_content(const KREUZBERGEmailExtractionResult *ptr); /** * Get the `attachments` field from a `EmailExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_email_extraction_result_attachments(const KREUZBERGEmailExtractionResult *ptr); /** * Get the `metadata` field from a `EmailExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_email_extraction_result_metadata(const KREUZBERGEmailExtractionResult *ptr); /** * Create a `EmailAttachment` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_email_attachment_free`. */ KREUZBERGEmailAttachment *kreuzberg_email_attachment_from_json(const char *json); /** * Serialize a `EmailAttachment` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_email_attachment_to_json(const KREUZBERGEmailAttachment *ptr); /** * Free a `EmailAttachment` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_email_attachment_free(KREUZBERGEmailAttachment *ptr); /** * Get the `name` field from a `EmailAttachment`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_email_attachment_name(const KREUZBERGEmailAttachment *ptr); /** * Get the `filename` field from a `EmailAttachment`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_email_attachment_filename(const KREUZBERGEmailAttachment *ptr); /** * Get the `mime_type` field from a `EmailAttachment`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_email_attachment_mime_type(const KREUZBERGEmailAttachment *ptr); /** * Get the `size` field from a `EmailAttachment`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_email_attachment_size(const KREUZBERGEmailAttachment *ptr); /** * Get the `is_image` field from a `EmailAttachment`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_email_attachment_is_image(const KREUZBERGEmailAttachment *ptr); /** * Get the `data` field from a `EmailAttachment`. * # Safety * Pointer must be a valid handle returned by this library. */ uint8_t *kreuzberg_email_attachment_data(const KREUZBERGEmailAttachment *ptr, uintptr_t *out_len); /** * Create a `OcrExtractionResult` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_ocr_extraction_result_free`. */ KREUZBERGOcrExtractionResult *kreuzberg_ocr_extraction_result_from_json(const char *json); /** * Serialize a `OcrExtractionResult` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_ocr_extraction_result_to_json(const KREUZBERGOcrExtractionResult *ptr); /** * Free a `OcrExtractionResult` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_ocr_extraction_result_free(KREUZBERGOcrExtractionResult *ptr); /** * Get the `content` field from a `OcrExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_ocr_extraction_result_content(const KREUZBERGOcrExtractionResult *ptr); /** * Get the `mime_type` field from a `OcrExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_ocr_extraction_result_mime_type(const KREUZBERGOcrExtractionResult *ptr); /** * Get the `metadata` field from a `OcrExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_ocr_extraction_result_metadata(const KREUZBERGOcrExtractionResult *ptr); /** * Get the `tables` field from a `OcrExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_ocr_extraction_result_tables(const KREUZBERGOcrExtractionResult *ptr); /** * Get the `ocr_elements` field from a `OcrExtractionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_ocr_extraction_result_ocr_elements(const KREUZBERGOcrExtractionResult *ptr); /** * Create a `OcrTable` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_ocr_table_free`. */ KREUZBERGOcrTable *kreuzberg_ocr_table_from_json(const char *json); /** * Serialize a `OcrTable` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_ocr_table_to_json(const KREUZBERGOcrTable *ptr); /** * Free a `OcrTable` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_ocr_table_free(KREUZBERGOcrTable *ptr); /** * Get the `cells` field from a `OcrTable`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_ocr_table_cells(const KREUZBERGOcrTable *ptr); /** * Get the `markdown` field from a `OcrTable`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_ocr_table_markdown(const KREUZBERGOcrTable *ptr); /** * Get the `page_number` field from a `OcrTable`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_ocr_table_page_number(const KREUZBERGOcrTable *ptr); /** * Get the `bounding_box` field from a `OcrTable`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGOcrTableBoundingBox *kreuzberg_ocr_table_bounding_box(const KREUZBERGOcrTable *ptr); /** * Create a `OcrTableBoundingBox` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_ocr_table_bounding_box_free`. */ KREUZBERGOcrTableBoundingBox *kreuzberg_ocr_table_bounding_box_from_json(const char *json); /** * Serialize a `OcrTableBoundingBox` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_ocr_table_bounding_box_to_json(const KREUZBERGOcrTableBoundingBox *ptr); /** * Free a `OcrTableBoundingBox` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_ocr_table_bounding_box_free(KREUZBERGOcrTableBoundingBox *ptr); /** * Get the `left` field from a `OcrTableBoundingBox`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_ocr_table_bounding_box_left(const KREUZBERGOcrTableBoundingBox *ptr); /** * Get the `top` field from a `OcrTableBoundingBox`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_ocr_table_bounding_box_top(const KREUZBERGOcrTableBoundingBox *ptr); /** * Get the `right` field from a `OcrTableBoundingBox`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_ocr_table_bounding_box_right(const KREUZBERGOcrTableBoundingBox *ptr); /** * Get the `bottom` field from a `OcrTableBoundingBox`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_ocr_table_bounding_box_bottom(const KREUZBERGOcrTableBoundingBox *ptr); /** * Create a `ImagePreprocessingConfig` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_image_preprocessing_config_free`. */ KREUZBERGImagePreprocessingConfig *kreuzberg_image_preprocessing_config_from_json(const char *json); /** * Serialize a `ImagePreprocessingConfig` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_image_preprocessing_config_to_json(const KREUZBERGImagePreprocessingConfig *ptr); /** * Free a `ImagePreprocessingConfig` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_image_preprocessing_config_free(KREUZBERGImagePreprocessingConfig *ptr); /** * Get the `target_dpi` field from a `ImagePreprocessingConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_image_preprocessing_config_target_dpi(const KREUZBERGImagePreprocessingConfig *ptr); /** * Get the `auto_rotate` field from a `ImagePreprocessingConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_image_preprocessing_config_auto_rotate(const KREUZBERGImagePreprocessingConfig *ptr); /** * Get the `deskew` field from a `ImagePreprocessingConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_image_preprocessing_config_deskew(const KREUZBERGImagePreprocessingConfig *ptr); /** * Get the `denoise` field from a `ImagePreprocessingConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_image_preprocessing_config_denoise(const KREUZBERGImagePreprocessingConfig *ptr); /** * Get the `contrast_enhance` field from a `ImagePreprocessingConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_image_preprocessing_config_contrast_enhance(const KREUZBERGImagePreprocessingConfig *ptr); /** * Get the `binarization_method` field from a `ImagePreprocessingConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_image_preprocessing_config_binarization_method(const KREUZBERGImagePreprocessingConfig *ptr); /** * Get the `invert_colors` field from a `ImagePreprocessingConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_image_preprocessing_config_invert_colors(const KREUZBERGImagePreprocessingConfig *ptr); /** * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ KREUZBERGImagePreprocessingConfig *kreuzberg_image_preprocessing_config_default(void); /** * Create a `TesseractConfig` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_tesseract_config_free`. */ KREUZBERGTesseractConfig *kreuzberg_tesseract_config_from_json(const char *json); /** * Serialize a `TesseractConfig` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_tesseract_config_to_json(const KREUZBERGTesseractConfig *ptr); /** * Free a `TesseractConfig` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_tesseract_config_free(KREUZBERGTesseractConfig *ptr); /** * Get the `language` field from a `TesseractConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_tesseract_config_language(const KREUZBERGTesseractConfig *ptr); /** * Get the `psm` field from a `TesseractConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_tesseract_config_psm(const KREUZBERGTesseractConfig *ptr); /** * Get the `output_format` field from a `TesseractConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_tesseract_config_output_format(const KREUZBERGTesseractConfig *ptr); /** * Get the `oem` field from a `TesseractConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_tesseract_config_oem(const KREUZBERGTesseractConfig *ptr); /** * Get the `min_confidence` field from a `TesseractConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ double kreuzberg_tesseract_config_min_confidence(const KREUZBERGTesseractConfig *ptr); /** * Get the `preprocessing` field from a `TesseractConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGImagePreprocessingConfig *kreuzberg_tesseract_config_preprocessing(const KREUZBERGTesseractConfig *ptr); /** * Get the `enable_table_detection` field from a `TesseractConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_tesseract_config_enable_table_detection(const KREUZBERGTesseractConfig *ptr); /** * Get the `table_min_confidence` field from a `TesseractConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ double kreuzberg_tesseract_config_table_min_confidence(const KREUZBERGTesseractConfig *ptr); /** * Get the `table_column_threshold` field from a `TesseractConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_tesseract_config_table_column_threshold(const KREUZBERGTesseractConfig *ptr); /** * Get the `table_row_threshold_ratio` field from a `TesseractConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ double kreuzberg_tesseract_config_table_row_threshold_ratio(const KREUZBERGTesseractConfig *ptr); /** * Get the `use_cache` field from a `TesseractConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_tesseract_config_use_cache(const KREUZBERGTesseractConfig *ptr); /** * Get the `classify_use_pre_adapted_templates` field from a `TesseractConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_tesseract_config_classify_use_pre_adapted_templates(const KREUZBERGTesseractConfig *ptr); /** * Get the `language_model_ngram_on` field from a `TesseractConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_tesseract_config_language_model_ngram_on(const KREUZBERGTesseractConfig *ptr); /** * Get the `tessedit_dont_blkrej_good_wds` field from a `TesseractConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_tesseract_config_tessedit_dont_blkrej_good_wds(const KREUZBERGTesseractConfig *ptr); /** * Get the `tessedit_dont_rowrej_good_wds` field from a `TesseractConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_tesseract_config_tessedit_dont_rowrej_good_wds(const KREUZBERGTesseractConfig *ptr); /** * Get the `tessedit_enable_dict_correction` field from a `TesseractConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_tesseract_config_tessedit_enable_dict_correction(const KREUZBERGTesseractConfig *ptr); /** * Get the `tessedit_char_whitelist` field from a `TesseractConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_tesseract_config_tessedit_char_whitelist(const KREUZBERGTesseractConfig *ptr); /** * Get the `tessedit_char_blacklist` field from a `TesseractConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_tesseract_config_tessedit_char_blacklist(const KREUZBERGTesseractConfig *ptr); /** * Get the `tessedit_use_primary_params_model` field from a `TesseractConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_tesseract_config_tessedit_use_primary_params_model(const KREUZBERGTesseractConfig *ptr); /** * Get the `textord_space_size_is_variable` field from a `TesseractConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_tesseract_config_textord_space_size_is_variable(const KREUZBERGTesseractConfig *ptr); /** * Get the `thresholding_method` field from a `TesseractConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_tesseract_config_thresholding_method(const KREUZBERGTesseractConfig *ptr); /** * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ KREUZBERGTesseractConfig *kreuzberg_tesseract_config_default(void); /** * Create a `ImagePreprocessingMetadata` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_image_preprocessing_metadata_free`. */ KREUZBERGImagePreprocessingMetadata *kreuzberg_image_preprocessing_metadata_from_json(const char *json); /** * Serialize a `ImagePreprocessingMetadata` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_image_preprocessing_metadata_to_json(const KREUZBERGImagePreprocessingMetadata *ptr); /** * Free a `ImagePreprocessingMetadata` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_image_preprocessing_metadata_free(KREUZBERGImagePreprocessingMetadata *ptr); /** * Get the `target_dpi` field from a `ImagePreprocessingMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_image_preprocessing_metadata_target_dpi(const KREUZBERGImagePreprocessingMetadata *ptr); /** * Get the `scale_factor` field from a `ImagePreprocessingMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ double kreuzberg_image_preprocessing_metadata_scale_factor(const KREUZBERGImagePreprocessingMetadata *ptr); /** * Get the `auto_adjusted` field from a `ImagePreprocessingMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_image_preprocessing_metadata_auto_adjusted(const KREUZBERGImagePreprocessingMetadata *ptr); /** * Get the `final_dpi` field from a `ImagePreprocessingMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_image_preprocessing_metadata_final_dpi(const KREUZBERGImagePreprocessingMetadata *ptr); /** * Get the `resample_method` field from a `ImagePreprocessingMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_image_preprocessing_metadata_resample_method(const KREUZBERGImagePreprocessingMetadata *ptr); /** * Get the `dimension_clamped` field from a `ImagePreprocessingMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_image_preprocessing_metadata_dimension_clamped(const KREUZBERGImagePreprocessingMetadata *ptr); /** * Get the `calculated_dpi` field from a `ImagePreprocessingMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_image_preprocessing_metadata_calculated_dpi(const KREUZBERGImagePreprocessingMetadata *ptr); /** * Get the `skipped_resize` field from a `ImagePreprocessingMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_image_preprocessing_metadata_skipped_resize(const KREUZBERGImagePreprocessingMetadata *ptr); /** * Get the `resize_error` field from a `ImagePreprocessingMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_image_preprocessing_metadata_resize_error(const KREUZBERGImagePreprocessingMetadata *ptr); /** * Create a `Metadata` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_metadata_free`. */ KREUZBERGMetadata *kreuzberg_metadata_from_json(const char *json); /** * Serialize a `Metadata` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_metadata_to_json(const KREUZBERGMetadata *ptr); /** * Free a `Metadata` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_metadata_free(KREUZBERGMetadata *ptr); /** * Get the `title` field from a `Metadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_metadata_title(const KREUZBERGMetadata *ptr); /** * Get the `subject` field from a `Metadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_metadata_subject(const KREUZBERGMetadata *ptr); /** * Get the `authors` field from a `Metadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_metadata_authors(const KREUZBERGMetadata *ptr); /** * Get the `keywords` field from a `Metadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_metadata_keywords(const KREUZBERGMetadata *ptr); /** * Get the `language` field from a `Metadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_metadata_language(const KREUZBERGMetadata *ptr); /** * Get the `created_at` field from a `Metadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_metadata_created_at(const KREUZBERGMetadata *ptr); /** * Get the `modified_at` field from a `Metadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_metadata_modified_at(const KREUZBERGMetadata *ptr); /** * Get the `created_by` field from a `Metadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_metadata_created_by(const KREUZBERGMetadata *ptr); /** * Get the `modified_by` field from a `Metadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_metadata_modified_by(const KREUZBERGMetadata *ptr); /** * Get the `pages` field from a `Metadata`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGPageStructure *kreuzberg_metadata_pages(const KREUZBERGMetadata *ptr); /** * Get the `format` field from a `Metadata`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGFormatMetadata *kreuzberg_metadata_format(const KREUZBERGMetadata *ptr); /** * Get the `image_preprocessing` field from a `Metadata`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGImagePreprocessingMetadata *kreuzberg_metadata_image_preprocessing(const KREUZBERGMetadata *ptr); /** * Get the `json_schema` field from a `Metadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_metadata_json_schema(const KREUZBERGMetadata *ptr); /** * Get the `error` field from a `Metadata`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGErrorMetadata *kreuzberg_metadata_error(const KREUZBERGMetadata *ptr); /** * Get the `extraction_duration_ms` field from a `Metadata`. * # Safety * Pointer must be a valid handle returned by this library. */ uint64_t kreuzberg_metadata_extraction_duration_ms(const KREUZBERGMetadata *ptr); /** * Get the `category` field from a `Metadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_metadata_category(const KREUZBERGMetadata *ptr); /** * Get the `tags` field from a `Metadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_metadata_tags(const KREUZBERGMetadata *ptr); /** * Get the `document_version` field from a `Metadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_metadata_document_version(const KREUZBERGMetadata *ptr); /** * Get the `abstract_text` field from a `Metadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_metadata_abstract_text(const KREUZBERGMetadata *ptr); /** * Get the `output_format` field from a `Metadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_metadata_output_format(const KREUZBERGMetadata *ptr); /** * Get the `ocr_used` field from a `Metadata`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_metadata_ocr_used(const KREUZBERGMetadata *ptr); /** * Get the `additional` field from a `Metadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_metadata_additional(const KREUZBERGMetadata *ptr); /** * Returns `true` when no metadata fields, format-specific metadata, or * additional postprocessor fields are populated. * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ int32_t kreuzberg_metadata_is_empty(const KREUZBERGMetadata *this_); /** * Create a `ExcelMetadata` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_excel_metadata_free`. */ KREUZBERGExcelMetadata *kreuzberg_excel_metadata_from_json(const char *json); /** * Serialize a `ExcelMetadata` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_excel_metadata_to_json(const KREUZBERGExcelMetadata *ptr); /** * Free a `ExcelMetadata` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_excel_metadata_free(KREUZBERGExcelMetadata *ptr); /** * Get the `sheet_count` field from a `ExcelMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_excel_metadata_sheet_count(const KREUZBERGExcelMetadata *ptr); /** * Get the `sheet_names` field from a `ExcelMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_excel_metadata_sheet_names(const KREUZBERGExcelMetadata *ptr); /** * Create a `EmailMetadata` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_email_metadata_free`. */ KREUZBERGEmailMetadata *kreuzberg_email_metadata_from_json(const char *json); /** * Serialize a `EmailMetadata` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_email_metadata_to_json(const KREUZBERGEmailMetadata *ptr); /** * Free a `EmailMetadata` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_email_metadata_free(KREUZBERGEmailMetadata *ptr); /** * Get the `from_email` field from a `EmailMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_email_metadata_from_email(const KREUZBERGEmailMetadata *ptr); /** * Get the `from_name` field from a `EmailMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_email_metadata_from_name(const KREUZBERGEmailMetadata *ptr); /** * Get the `to_emails` field from a `EmailMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_email_metadata_to_emails(const KREUZBERGEmailMetadata *ptr); /** * Get the `cc_emails` field from a `EmailMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_email_metadata_cc_emails(const KREUZBERGEmailMetadata *ptr); /** * Get the `bcc_emails` field from a `EmailMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_email_metadata_bcc_emails(const KREUZBERGEmailMetadata *ptr); /** * Get the `message_id` field from a `EmailMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_email_metadata_message_id(const KREUZBERGEmailMetadata *ptr); /** * Get the `attachments` field from a `EmailMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_email_metadata_attachments(const KREUZBERGEmailMetadata *ptr); /** * Create a `ArchiveMetadata` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_archive_metadata_free`. */ KREUZBERGArchiveMetadata *kreuzberg_archive_metadata_from_json(const char *json); /** * Serialize a `ArchiveMetadata` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_archive_metadata_to_json(const KREUZBERGArchiveMetadata *ptr); /** * Free a `ArchiveMetadata` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_archive_metadata_free(KREUZBERGArchiveMetadata *ptr); /** * Get the `format` field from a `ArchiveMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_archive_metadata_format(const KREUZBERGArchiveMetadata *ptr); /** * Get the `file_count` field from a `ArchiveMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_archive_metadata_file_count(const KREUZBERGArchiveMetadata *ptr); /** * Get the `file_list` field from a `ArchiveMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_archive_metadata_file_list(const KREUZBERGArchiveMetadata *ptr); /** * Get the `total_size` field from a `ArchiveMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ uint64_t kreuzberg_archive_metadata_total_size(const KREUZBERGArchiveMetadata *ptr); /** * Get the `compressed_size` field from a `ArchiveMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ uint64_t kreuzberg_archive_metadata_compressed_size(const KREUZBERGArchiveMetadata *ptr); /** * Create a `ImageMetadata` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_image_metadata_free`. */ KREUZBERGImageMetadata *kreuzberg_image_metadata_from_json(const char *json); /** * Serialize a `ImageMetadata` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_image_metadata_to_json(const KREUZBERGImageMetadata *ptr); /** * Free a `ImageMetadata` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_image_metadata_free(KREUZBERGImageMetadata *ptr); /** * Get the `width` field from a `ImageMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_image_metadata_width(const KREUZBERGImageMetadata *ptr); /** * Get the `height` field from a `ImageMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_image_metadata_height(const KREUZBERGImageMetadata *ptr); /** * Get the `format` field from a `ImageMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_image_metadata_format(const KREUZBERGImageMetadata *ptr); /** * Get the `exif` field from a `ImageMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_image_metadata_exif(const KREUZBERGImageMetadata *ptr); /** * Create a `XmlMetadata` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_xml_metadata_free`. */ KREUZBERGXmlMetadata *kreuzberg_xml_metadata_from_json(const char *json); /** * Serialize a `XmlMetadata` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_xml_metadata_to_json(const KREUZBERGXmlMetadata *ptr); /** * Free a `XmlMetadata` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_xml_metadata_free(KREUZBERGXmlMetadata *ptr); /** * Get the `element_count` field from a `XmlMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_xml_metadata_element_count(const KREUZBERGXmlMetadata *ptr); /** * Get the `unique_elements` field from a `XmlMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_xml_metadata_unique_elements(const KREUZBERGXmlMetadata *ptr); /** * Create a `TextMetadata` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_text_metadata_free`. */ KREUZBERGTextMetadata *kreuzberg_text_metadata_from_json(const char *json); /** * Serialize a `TextMetadata` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_text_metadata_to_json(const KREUZBERGTextMetadata *ptr); /** * Free a `TextMetadata` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_text_metadata_free(KREUZBERGTextMetadata *ptr); /** * Get the `line_count` field from a `TextMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_text_metadata_line_count(const KREUZBERGTextMetadata *ptr); /** * Get the `word_count` field from a `TextMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_text_metadata_word_count(const KREUZBERGTextMetadata *ptr); /** * Get the `character_count` field from a `TextMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_text_metadata_character_count(const KREUZBERGTextMetadata *ptr); /** * Get the `headers` field from a `TextMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_text_metadata_headers(const KREUZBERGTextMetadata *ptr); /** * Create a `HeaderMetadata` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_header_metadata_free`. */ KREUZBERGHeaderMetadata *kreuzberg_header_metadata_from_json(const char *json); /** * Serialize a `HeaderMetadata` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_header_metadata_to_json(const KREUZBERGHeaderMetadata *ptr); /** * Free a `HeaderMetadata` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_header_metadata_free(KREUZBERGHeaderMetadata *ptr); /** * Get the `level` field from a `HeaderMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ uint8_t kreuzberg_header_metadata_level(const KREUZBERGHeaderMetadata *ptr); /** * Get the `text` field from a `HeaderMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_header_metadata_text(const KREUZBERGHeaderMetadata *ptr); /** * Get the `id` field from a `HeaderMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_header_metadata_id(const KREUZBERGHeaderMetadata *ptr); /** * Get the `depth` field from a `HeaderMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_header_metadata_depth(const KREUZBERGHeaderMetadata *ptr); /** * Get the `html_offset` field from a `HeaderMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_header_metadata_html_offset(const KREUZBERGHeaderMetadata *ptr); /** * Create a `LinkMetadata` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_link_metadata_free`. */ KREUZBERGLinkMetadata *kreuzberg_link_metadata_from_json(const char *json); /** * Serialize a `LinkMetadata` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_link_metadata_to_json(const KREUZBERGLinkMetadata *ptr); /** * Free a `LinkMetadata` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_link_metadata_free(KREUZBERGLinkMetadata *ptr); /** * Get the `href` field from a `LinkMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_link_metadata_href(const KREUZBERGLinkMetadata *ptr); /** * Get the `text` field from a `LinkMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_link_metadata_text(const KREUZBERGLinkMetadata *ptr); /** * Get the `title` field from a `LinkMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_link_metadata_title(const KREUZBERGLinkMetadata *ptr); /** * Get the `link_type` field from a `LinkMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGLinkType *kreuzberg_link_metadata_link_type(const KREUZBERGLinkMetadata *ptr); /** * Get the `rel` field from a `LinkMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_link_metadata_rel(const KREUZBERGLinkMetadata *ptr); /** * Create a `ImageMetadataType` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_image_metadata_type_free`. */ KREUZBERGImageMetadataType *kreuzberg_image_metadata_type_from_json(const char *json); /** * Serialize a `ImageMetadataType` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_image_metadata_type_to_json(const KREUZBERGImageMetadataType *ptr); /** * Free a `ImageMetadataType` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_image_metadata_type_free(KREUZBERGImageMetadataType *ptr); /** * Get the `src` field from a `ImageMetadataType`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_image_metadata_type_src(const KREUZBERGImageMetadataType *ptr); /** * Get the `alt` field from a `ImageMetadataType`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_image_metadata_type_alt(const KREUZBERGImageMetadataType *ptr); /** * Get the `title` field from a `ImageMetadataType`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_image_metadata_type_title(const KREUZBERGImageMetadataType *ptr); /** * Get the `image_type` field from a `ImageMetadataType`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGImageType *kreuzberg_image_metadata_type_image_type(const KREUZBERGImageMetadataType *ptr); /** * Create a `StructuredData` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_structured_data_free`. */ KREUZBERGStructuredData *kreuzberg_structured_data_from_json(const char *json); /** * Serialize a `StructuredData` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_structured_data_to_json(const KREUZBERGStructuredData *ptr); /** * Free a `StructuredData` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_structured_data_free(KREUZBERGStructuredData *ptr); /** * Get the `data_type` field from a `StructuredData`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGStructuredDataType *kreuzberg_structured_data_data_type(const KREUZBERGStructuredData *ptr); /** * Get the `raw_json` field from a `StructuredData`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_structured_data_raw_json(const KREUZBERGStructuredData *ptr); /** * Get the `schema_type` field from a `StructuredData`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_structured_data_schema_type(const KREUZBERGStructuredData *ptr); /** * Create a `HtmlMetadata` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_html_metadata_free`. */ KREUZBERGHtmlMetadata *kreuzberg_html_metadata_from_json(const char *json); /** * Serialize a `HtmlMetadata` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_html_metadata_to_json(const KREUZBERGHtmlMetadata *ptr); /** * Free a `HtmlMetadata` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_html_metadata_free(KREUZBERGHtmlMetadata *ptr); /** * Get the `title` field from a `HtmlMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_html_metadata_title(const KREUZBERGHtmlMetadata *ptr); /** * Get the `description` field from a `HtmlMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_html_metadata_description(const KREUZBERGHtmlMetadata *ptr); /** * Get the `keywords` field from a `HtmlMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_html_metadata_keywords(const KREUZBERGHtmlMetadata *ptr); /** * Get the `author` field from a `HtmlMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_html_metadata_author(const KREUZBERGHtmlMetadata *ptr); /** * Get the `canonical_url` field from a `HtmlMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_html_metadata_canonical_url(const KREUZBERGHtmlMetadata *ptr); /** * Get the `base_href` field from a `HtmlMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_html_metadata_base_href(const KREUZBERGHtmlMetadata *ptr); /** * Get the `language` field from a `HtmlMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_html_metadata_language(const KREUZBERGHtmlMetadata *ptr); /** * Get the `text_direction` field from a `HtmlMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGTextDirection *kreuzberg_html_metadata_text_direction(const KREUZBERGHtmlMetadata *ptr); /** * Get the `open_graph` field from a `HtmlMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_html_metadata_open_graph(const KREUZBERGHtmlMetadata *ptr); /** * Get the `twitter_card` field from a `HtmlMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_html_metadata_twitter_card(const KREUZBERGHtmlMetadata *ptr); /** * Get the `meta_tags` field from a `HtmlMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_html_metadata_meta_tags(const KREUZBERGHtmlMetadata *ptr); /** * Get the `headers` field from a `HtmlMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_html_metadata_headers(const KREUZBERGHtmlMetadata *ptr); /** * Get the `links` field from a `HtmlMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_html_metadata_links(const KREUZBERGHtmlMetadata *ptr); /** * Get the `images` field from a `HtmlMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_html_metadata_images(const KREUZBERGHtmlMetadata *ptr); /** * Get the `structured_data` field from a `HtmlMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_html_metadata_structured_data(const KREUZBERGHtmlMetadata *ptr); /** * Create a `OcrMetadata` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_ocr_metadata_free`. */ KREUZBERGOcrMetadata *kreuzberg_ocr_metadata_from_json(const char *json); /** * Serialize a `OcrMetadata` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_ocr_metadata_to_json(const KREUZBERGOcrMetadata *ptr); /** * Free a `OcrMetadata` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_ocr_metadata_free(KREUZBERGOcrMetadata *ptr); /** * Get the `language` field from a `OcrMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_ocr_metadata_language(const KREUZBERGOcrMetadata *ptr); /** * Get the `psm` field from a `OcrMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_ocr_metadata_psm(const KREUZBERGOcrMetadata *ptr); /** * Get the `output_format` field from a `OcrMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_ocr_metadata_output_format(const KREUZBERGOcrMetadata *ptr); /** * Get the `table_count` field from a `OcrMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_ocr_metadata_table_count(const KREUZBERGOcrMetadata *ptr); /** * Get the `table_rows` field from a `OcrMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_ocr_metadata_table_rows(const KREUZBERGOcrMetadata *ptr); /** * Get the `table_cols` field from a `OcrMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_ocr_metadata_table_cols(const KREUZBERGOcrMetadata *ptr); /** * Create a `ErrorMetadata` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_error_metadata_free`. */ KREUZBERGErrorMetadata *kreuzberg_error_metadata_from_json(const char *json); /** * Serialize a `ErrorMetadata` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_error_metadata_to_json(const KREUZBERGErrorMetadata *ptr); /** * Free a `ErrorMetadata` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_error_metadata_free(KREUZBERGErrorMetadata *ptr); /** * Get the `error_type` field from a `ErrorMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_error_metadata_error_type(const KREUZBERGErrorMetadata *ptr); /** * Get the `message` field from a `ErrorMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_error_metadata_message(const KREUZBERGErrorMetadata *ptr); /** * Create a `PptxMetadata` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_pptx_metadata_free`. */ KREUZBERGPptxMetadata *kreuzberg_pptx_metadata_from_json(const char *json); /** * Serialize a `PptxMetadata` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_pptx_metadata_to_json(const KREUZBERGPptxMetadata *ptr); /** * Free a `PptxMetadata` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_pptx_metadata_free(KREUZBERGPptxMetadata *ptr); /** * Get the `slide_count` field from a `PptxMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_pptx_metadata_slide_count(const KREUZBERGPptxMetadata *ptr); /** * Get the `slide_names` field from a `PptxMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_pptx_metadata_slide_names(const KREUZBERGPptxMetadata *ptr); /** * Get the `image_count` field from a `PptxMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_pptx_metadata_image_count(const KREUZBERGPptxMetadata *ptr); /** * Get the `table_count` field from a `PptxMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_pptx_metadata_table_count(const KREUZBERGPptxMetadata *ptr); /** * Create a `DocxMetadata` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_docx_metadata_free`. */ KREUZBERGDocxMetadata *kreuzberg_docx_metadata_from_json(const char *json); /** * Serialize a `DocxMetadata` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_docx_metadata_to_json(const KREUZBERGDocxMetadata *ptr); /** * Free a `DocxMetadata` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_docx_metadata_free(KREUZBERGDocxMetadata *ptr); /** * Get the `core_properties` field from a `DocxMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGCoreProperties *kreuzberg_docx_metadata_core_properties(const KREUZBERGDocxMetadata *ptr); /** * Get the `app_properties` field from a `DocxMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGDocxAppProperties *kreuzberg_docx_metadata_app_properties(const KREUZBERGDocxMetadata *ptr); /** * Get the `custom_properties` field from a `DocxMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_docx_metadata_custom_properties(const KREUZBERGDocxMetadata *ptr); /** * Create a `CsvMetadata` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_csv_metadata_free`. */ KREUZBERGCsvMetadata *kreuzberg_csv_metadata_from_json(const char *json); /** * Serialize a `CsvMetadata` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_csv_metadata_to_json(const KREUZBERGCsvMetadata *ptr); /** * Free a `CsvMetadata` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_csv_metadata_free(KREUZBERGCsvMetadata *ptr); /** * Get the `row_count` field from a `CsvMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_csv_metadata_row_count(const KREUZBERGCsvMetadata *ptr); /** * Get the `column_count` field from a `CsvMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_csv_metadata_column_count(const KREUZBERGCsvMetadata *ptr); /** * Get the `delimiter` field from a `CsvMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_csv_metadata_delimiter(const KREUZBERGCsvMetadata *ptr); /** * Get the `has_header` field from a `CsvMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_csv_metadata_has_header(const KREUZBERGCsvMetadata *ptr); /** * Get the `column_types` field from a `CsvMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_csv_metadata_column_types(const KREUZBERGCsvMetadata *ptr); /** * Create a `BibtexMetadata` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_bibtex_metadata_free`. */ KREUZBERGBibtexMetadata *kreuzberg_bibtex_metadata_from_json(const char *json); /** * Serialize a `BibtexMetadata` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_bibtex_metadata_to_json(const KREUZBERGBibtexMetadata *ptr); /** * Free a `BibtexMetadata` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_bibtex_metadata_free(KREUZBERGBibtexMetadata *ptr); /** * Get the `entry_count` field from a `BibtexMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_bibtex_metadata_entry_count(const KREUZBERGBibtexMetadata *ptr); /** * Get the `citation_keys` field from a `BibtexMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_bibtex_metadata_citation_keys(const KREUZBERGBibtexMetadata *ptr); /** * Get the `authors` field from a `BibtexMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_bibtex_metadata_authors(const KREUZBERGBibtexMetadata *ptr); /** * Get the `year_range` field from a `BibtexMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGYearRange *kreuzberg_bibtex_metadata_year_range(const KREUZBERGBibtexMetadata *ptr); /** * Get the `entry_types` field from a `BibtexMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_bibtex_metadata_entry_types(const KREUZBERGBibtexMetadata *ptr); /** * Create a `CitationMetadata` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_citation_metadata_free`. */ KREUZBERGCitationMetadata *kreuzberg_citation_metadata_from_json(const char *json); /** * Serialize a `CitationMetadata` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_citation_metadata_to_json(const KREUZBERGCitationMetadata *ptr); /** * Free a `CitationMetadata` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_citation_metadata_free(KREUZBERGCitationMetadata *ptr); /** * Get the `citation_count` field from a `CitationMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_citation_metadata_citation_count(const KREUZBERGCitationMetadata *ptr); /** * Get the `format` field from a `CitationMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_citation_metadata_format(const KREUZBERGCitationMetadata *ptr); /** * Get the `authors` field from a `CitationMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_citation_metadata_authors(const KREUZBERGCitationMetadata *ptr); /** * Get the `year_range` field from a `CitationMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGYearRange *kreuzberg_citation_metadata_year_range(const KREUZBERGCitationMetadata *ptr); /** * Get the `dois` field from a `CitationMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_citation_metadata_dois(const KREUZBERGCitationMetadata *ptr); /** * Get the `keywords` field from a `CitationMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_citation_metadata_keywords(const KREUZBERGCitationMetadata *ptr); /** * Create a `YearRange` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_year_range_free`. */ KREUZBERGYearRange *kreuzberg_year_range_from_json(const char *json); /** * Serialize a `YearRange` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_year_range_to_json(const KREUZBERGYearRange *ptr); /** * Free a `YearRange` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_year_range_free(KREUZBERGYearRange *ptr); /** * Get the `min` field from a `YearRange`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_year_range_min(const KREUZBERGYearRange *ptr); /** * Get the `max` field from a `YearRange`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_year_range_max(const KREUZBERGYearRange *ptr); /** * Get the `years` field from a `YearRange`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_year_range_years(const KREUZBERGYearRange *ptr); /** * Create a `FictionBookMetadata` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_fiction_book_metadata_free`. */ KREUZBERGFictionBookMetadata *kreuzberg_fiction_book_metadata_from_json(const char *json); /** * Serialize a `FictionBookMetadata` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_fiction_book_metadata_to_json(const KREUZBERGFictionBookMetadata *ptr); /** * Free a `FictionBookMetadata` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_fiction_book_metadata_free(KREUZBERGFictionBookMetadata *ptr); /** * Get the `genres` field from a `FictionBookMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_fiction_book_metadata_genres(const KREUZBERGFictionBookMetadata *ptr); /** * Get the `sequences` field from a `FictionBookMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_fiction_book_metadata_sequences(const KREUZBERGFictionBookMetadata *ptr); /** * Get the `annotation` field from a `FictionBookMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_fiction_book_metadata_annotation(const KREUZBERGFictionBookMetadata *ptr); /** * Create a `DbfMetadata` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_dbf_metadata_free`. */ KREUZBERGDbfMetadata *kreuzberg_dbf_metadata_from_json(const char *json); /** * Serialize a `DbfMetadata` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_dbf_metadata_to_json(const KREUZBERGDbfMetadata *ptr); /** * Free a `DbfMetadata` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_dbf_metadata_free(KREUZBERGDbfMetadata *ptr); /** * Get the `record_count` field from a `DbfMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_dbf_metadata_record_count(const KREUZBERGDbfMetadata *ptr); /** * Get the `field_count` field from a `DbfMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_dbf_metadata_field_count(const KREUZBERGDbfMetadata *ptr); /** * Get the `fields` field from a `DbfMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_dbf_metadata_fields(const KREUZBERGDbfMetadata *ptr); /** * Create a `DbfFieldInfo` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_dbf_field_info_free`. */ KREUZBERGDbfFieldInfo *kreuzberg_dbf_field_info_from_json(const char *json); /** * Serialize a `DbfFieldInfo` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_dbf_field_info_to_json(const KREUZBERGDbfFieldInfo *ptr); /** * Free a `DbfFieldInfo` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_dbf_field_info_free(KREUZBERGDbfFieldInfo *ptr); /** * Get the `name` field from a `DbfFieldInfo`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_dbf_field_info_name(const KREUZBERGDbfFieldInfo *ptr); /** * Get the `field_type` field from a `DbfFieldInfo`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_dbf_field_info_field_type(const KREUZBERGDbfFieldInfo *ptr); /** * Create a `JatsMetadata` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_jats_metadata_free`. */ KREUZBERGJatsMetadata *kreuzberg_jats_metadata_from_json(const char *json); /** * Serialize a `JatsMetadata` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_jats_metadata_to_json(const KREUZBERGJatsMetadata *ptr); /** * Free a `JatsMetadata` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_jats_metadata_free(KREUZBERGJatsMetadata *ptr); /** * Get the `copyright` field from a `JatsMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_jats_metadata_copyright(const KREUZBERGJatsMetadata *ptr); /** * Get the `license` field from a `JatsMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_jats_metadata_license(const KREUZBERGJatsMetadata *ptr); /** * Get the `history_dates` field from a `JatsMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_jats_metadata_history_dates(const KREUZBERGJatsMetadata *ptr); /** * Get the `contributor_roles` field from a `JatsMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_jats_metadata_contributor_roles(const KREUZBERGJatsMetadata *ptr); /** * Create a `ContributorRole` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_contributor_role_free`. */ KREUZBERGContributorRole *kreuzberg_contributor_role_from_json(const char *json); /** * Serialize a `ContributorRole` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_contributor_role_to_json(const KREUZBERGContributorRole *ptr); /** * Free a `ContributorRole` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_contributor_role_free(KREUZBERGContributorRole *ptr); /** * Get the `name` field from a `ContributorRole`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_contributor_role_name(const KREUZBERGContributorRole *ptr); /** * Get the `role` field from a `ContributorRole`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_contributor_role_role(const KREUZBERGContributorRole *ptr); /** * Create a `EpubMetadata` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_epub_metadata_free`. */ KREUZBERGEpubMetadata *kreuzberg_epub_metadata_from_json(const char *json); /** * Serialize a `EpubMetadata` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_epub_metadata_to_json(const KREUZBERGEpubMetadata *ptr); /** * Free a `EpubMetadata` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_epub_metadata_free(KREUZBERGEpubMetadata *ptr); /** * Get the `coverage` field from a `EpubMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_epub_metadata_coverage(const KREUZBERGEpubMetadata *ptr); /** * Get the `dc_format` field from a `EpubMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_epub_metadata_dc_format(const KREUZBERGEpubMetadata *ptr); /** * Get the `relation` field from a `EpubMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_epub_metadata_relation(const KREUZBERGEpubMetadata *ptr); /** * Get the `source` field from a `EpubMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_epub_metadata_source(const KREUZBERGEpubMetadata *ptr); /** * Get the `dc_type` field from a `EpubMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_epub_metadata_dc_type(const KREUZBERGEpubMetadata *ptr); /** * Get the `cover_image` field from a `EpubMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_epub_metadata_cover_image(const KREUZBERGEpubMetadata *ptr); /** * Create a `PstMetadata` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_pst_metadata_free`. */ KREUZBERGPstMetadata *kreuzberg_pst_metadata_from_json(const char *json); /** * Serialize a `PstMetadata` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_pst_metadata_to_json(const KREUZBERGPstMetadata *ptr); /** * Free a `PstMetadata` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_pst_metadata_free(KREUZBERGPstMetadata *ptr); /** * Get the `message_count` field from a `PstMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_pst_metadata_message_count(const KREUZBERGPstMetadata *ptr); /** * Create a `OcrConfidence` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_ocr_confidence_free`. */ KREUZBERGOcrConfidence *kreuzberg_ocr_confidence_from_json(const char *json); /** * Serialize a `OcrConfidence` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_ocr_confidence_to_json(const KREUZBERGOcrConfidence *ptr); /** * Free a `OcrConfidence` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_ocr_confidence_free(KREUZBERGOcrConfidence *ptr); /** * Get the `detection` field from a `OcrConfidence`. * # Safety * Pointer must be a valid handle returned by this library. */ double kreuzberg_ocr_confidence_detection(const KREUZBERGOcrConfidence *ptr); /** * Get the `recognition` field from a `OcrConfidence`. * # Safety * Pointer must be a valid handle returned by this library. */ double kreuzberg_ocr_confidence_recognition(const KREUZBERGOcrConfidence *ptr); /** * Create a `OcrRotation` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_ocr_rotation_free`. */ KREUZBERGOcrRotation *kreuzberg_ocr_rotation_from_json(const char *json); /** * Serialize a `OcrRotation` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_ocr_rotation_to_json(const KREUZBERGOcrRotation *ptr); /** * Free a `OcrRotation` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_ocr_rotation_free(KREUZBERGOcrRotation *ptr); /** * Get the `angle_degrees` field from a `OcrRotation`. * # Safety * Pointer must be a valid handle returned by this library. */ double kreuzberg_ocr_rotation_angle_degrees(const KREUZBERGOcrRotation *ptr); /** * Get the `confidence` field from a `OcrRotation`. * # Safety * Pointer must be a valid handle returned by this library. */ double kreuzberg_ocr_rotation_confidence(const KREUZBERGOcrRotation *ptr); /** * Create a `OcrElement` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_ocr_element_free`. */ KREUZBERGOcrElement *kreuzberg_ocr_element_from_json(const char *json); /** * Serialize a `OcrElement` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_ocr_element_to_json(const KREUZBERGOcrElement *ptr); /** * Free a `OcrElement` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_ocr_element_free(KREUZBERGOcrElement *ptr); /** * Get the `text` field from a `OcrElement`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_ocr_element_text(const KREUZBERGOcrElement *ptr); /** * Get the `geometry` field from a `OcrElement`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGOcrBoundingGeometry *kreuzberg_ocr_element_geometry(const KREUZBERGOcrElement *ptr); /** * Get the `confidence` field from a `OcrElement`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGOcrConfidence *kreuzberg_ocr_element_confidence(const KREUZBERGOcrElement *ptr); /** * Get the `level` field from a `OcrElement`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGOcrElementLevel *kreuzberg_ocr_element_level(const KREUZBERGOcrElement *ptr); /** * Get the `rotation` field from a `OcrElement`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGOcrRotation *kreuzberg_ocr_element_rotation(const KREUZBERGOcrElement *ptr); /** * Get the `page_number` field from a `OcrElement`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_ocr_element_page_number(const KREUZBERGOcrElement *ptr); /** * Get the `parent_id` field from a `OcrElement`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_ocr_element_parent_id(const KREUZBERGOcrElement *ptr); /** * Get the `backend_metadata` field from a `OcrElement`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_ocr_element_backend_metadata(const KREUZBERGOcrElement *ptr); /** * Create a `OcrElementConfig` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_ocr_element_config_free`. */ KREUZBERGOcrElementConfig *kreuzberg_ocr_element_config_from_json(const char *json); /** * Serialize a `OcrElementConfig` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_ocr_element_config_to_json(const KREUZBERGOcrElementConfig *ptr); /** * Free a `OcrElementConfig` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_ocr_element_config_free(KREUZBERGOcrElementConfig *ptr); /** * Get the `include_elements` field from a `OcrElementConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_ocr_element_config_include_elements(const KREUZBERGOcrElementConfig *ptr); /** * Get the `min_level` field from a `OcrElementConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGOcrElementLevel *kreuzberg_ocr_element_config_min_level(const KREUZBERGOcrElementConfig *ptr); /** * Get the `min_confidence` field from a `OcrElementConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ double kreuzberg_ocr_element_config_min_confidence(const KREUZBERGOcrElementConfig *ptr); /** * Get the `build_hierarchy` field from a `OcrElementConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_ocr_element_config_build_hierarchy(const KREUZBERGOcrElementConfig *ptr); /** * Create a `PageStructure` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_page_structure_free`. */ KREUZBERGPageStructure *kreuzberg_page_structure_from_json(const char *json); /** * Serialize a `PageStructure` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_page_structure_to_json(const KREUZBERGPageStructure *ptr); /** * Free a `PageStructure` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_page_structure_free(KREUZBERGPageStructure *ptr); /** * Get the `total_count` field from a `PageStructure`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_page_structure_total_count(const KREUZBERGPageStructure *ptr); /** * Get the `unit_type` field from a `PageStructure`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGPageUnitType *kreuzberg_page_structure_unit_type(const KREUZBERGPageStructure *ptr); /** * Get the `boundaries` field from a `PageStructure`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_page_structure_boundaries(const KREUZBERGPageStructure *ptr); /** * Get the `pages` field from a `PageStructure`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_page_structure_pages(const KREUZBERGPageStructure *ptr); /** * Create a `PageBoundary` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_page_boundary_free`. */ KREUZBERGPageBoundary *kreuzberg_page_boundary_from_json(const char *json); /** * Serialize a `PageBoundary` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_page_boundary_to_json(const KREUZBERGPageBoundary *ptr); /** * Free a `PageBoundary` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_page_boundary_free(KREUZBERGPageBoundary *ptr); /** * Get the `byte_start` field from a `PageBoundary`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_page_boundary_byte_start(const KREUZBERGPageBoundary *ptr); /** * Get the `byte_end` field from a `PageBoundary`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_page_boundary_byte_end(const KREUZBERGPageBoundary *ptr); /** * Get the `page_number` field from a `PageBoundary`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_page_boundary_page_number(const KREUZBERGPageBoundary *ptr); /** * Create a `PageInfo` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_page_info_free`. */ KREUZBERGPageInfo *kreuzberg_page_info_from_json(const char *json); /** * Serialize a `PageInfo` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_page_info_to_json(const KREUZBERGPageInfo *ptr); /** * Free a `PageInfo` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_page_info_free(KREUZBERGPageInfo *ptr); /** * Get the `number` field from a `PageInfo`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_page_info_number(const KREUZBERGPageInfo *ptr); /** * Get the `title` field from a `PageInfo`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_page_info_title(const KREUZBERGPageInfo *ptr); /** * Get the `image_count` field from a `PageInfo`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_page_info_image_count(const KREUZBERGPageInfo *ptr); /** * Get the `table_count` field from a `PageInfo`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_page_info_table_count(const KREUZBERGPageInfo *ptr); /** * Get the `hidden` field from a `PageInfo`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_page_info_hidden(const KREUZBERGPageInfo *ptr); /** * Get the `is_blank` field from a `PageInfo`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_page_info_is_blank(const KREUZBERGPageInfo *ptr); /** * Get the `has_vector_graphics` field from a `PageInfo`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_page_info_has_vector_graphics(const KREUZBERGPageInfo *ptr); /** * Create a `PageContent` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_page_content_free`. */ KREUZBERGPageContent *kreuzberg_page_content_from_json(const char *json); /** * Serialize a `PageContent` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_page_content_to_json(const KREUZBERGPageContent *ptr); /** * Free a `PageContent` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_page_content_free(KREUZBERGPageContent *ptr); /** * Get the `page_number` field from a `PageContent`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_page_content_page_number(const KREUZBERGPageContent *ptr); /** * Get the `content` field from a `PageContent`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_page_content_content(const KREUZBERGPageContent *ptr); /** * Get the `tables` field from a `PageContent`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_page_content_tables(const KREUZBERGPageContent *ptr); /** * Get the `image_indices` field from a `PageContent`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_page_content_image_indices(const KREUZBERGPageContent *ptr); /** * Get the `hierarchy` field from a `PageContent`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGPageHierarchy *kreuzberg_page_content_hierarchy(const KREUZBERGPageContent *ptr); /** * Get the `is_blank` field from a `PageContent`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_page_content_is_blank(const KREUZBERGPageContent *ptr); /** * Get the `layout_regions` field from a `PageContent`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_page_content_layout_regions(const KREUZBERGPageContent *ptr); /** * Get the `speaker_notes` field from a `PageContent`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_page_content_speaker_notes(const KREUZBERGPageContent *ptr); /** * Get the `section_name` field from a `PageContent`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_page_content_section_name(const KREUZBERGPageContent *ptr); /** * Create a `LayoutRegion` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_layout_region_free`. */ KREUZBERGLayoutRegion *kreuzberg_layout_region_from_json(const char *json); /** * Serialize a `LayoutRegion` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_layout_region_to_json(const KREUZBERGLayoutRegion *ptr); /** * Free a `LayoutRegion` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_layout_region_free(KREUZBERGLayoutRegion *ptr); /** * Get the `class_name` field from a `LayoutRegion`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_layout_region_class_name(const KREUZBERGLayoutRegion *ptr); /** * Get the `confidence` field from a `LayoutRegion`. * # Safety * Pointer must be a valid handle returned by this library. */ double kreuzberg_layout_region_confidence(const KREUZBERGLayoutRegion *ptr); /** * Get the `bounding_box` field from a `LayoutRegion`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGBoundingBox *kreuzberg_layout_region_bounding_box(const KREUZBERGLayoutRegion *ptr); /** * Get the `area_fraction` field from a `LayoutRegion`. * # Safety * Pointer must be a valid handle returned by this library. */ double kreuzberg_layout_region_area_fraction(const KREUZBERGLayoutRegion *ptr); /** * Create a `PageHierarchy` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_page_hierarchy_free`. */ KREUZBERGPageHierarchy *kreuzberg_page_hierarchy_from_json(const char *json); /** * Serialize a `PageHierarchy` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_page_hierarchy_to_json(const KREUZBERGPageHierarchy *ptr); /** * Free a `PageHierarchy` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_page_hierarchy_free(KREUZBERGPageHierarchy *ptr); /** * Get the `block_count` field from a `PageHierarchy`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_page_hierarchy_block_count(const KREUZBERGPageHierarchy *ptr); /** * Get the `blocks` field from a `PageHierarchy`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_page_hierarchy_blocks(const KREUZBERGPageHierarchy *ptr); /** * Create a `HierarchicalBlock` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_hierarchical_block_free`. */ KREUZBERGHierarchicalBlock *kreuzberg_hierarchical_block_from_json(const char *json); /** * Serialize a `HierarchicalBlock` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_hierarchical_block_to_json(const KREUZBERGHierarchicalBlock *ptr); /** * Free a `HierarchicalBlock` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_hierarchical_block_free(KREUZBERGHierarchicalBlock *ptr); /** * Get the `text` field from a `HierarchicalBlock`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_hierarchical_block_text(const KREUZBERGHierarchicalBlock *ptr); /** * Get the `font_size` field from a `HierarchicalBlock`. * # Safety * Pointer must be a valid handle returned by this library. */ float kreuzberg_hierarchical_block_font_size(const KREUZBERGHierarchicalBlock *ptr); /** * Get the `level` field from a `HierarchicalBlock`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_hierarchical_block_level(const KREUZBERGHierarchicalBlock *ptr); /** * Create a `Table` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_table_free`. */ KREUZBERGTable *kreuzberg_table_from_json(const char *json); /** * Serialize a `Table` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_table_to_json(const KREUZBERGTable *ptr); /** * Free a `Table` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_table_free(KREUZBERGTable *ptr); /** * Get the `cells` field from a `Table`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_table_cells(const KREUZBERGTable *ptr); /** * Get the `markdown` field from a `Table`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_table_markdown(const KREUZBERGTable *ptr); /** * Get the `page_number` field from a `Table`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_table_page_number(const KREUZBERGTable *ptr); /** * Get the `bounding_box` field from a `Table`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGBoundingBox *kreuzberg_table_bounding_box(const KREUZBERGTable *ptr); /** * Create a `TableCell` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_table_cell_free`. */ KREUZBERGTableCell *kreuzberg_table_cell_from_json(const char *json); /** * Serialize a `TableCell` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_table_cell_to_json(const KREUZBERGTableCell *ptr); /** * Free a `TableCell` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_table_cell_free(KREUZBERGTableCell *ptr); /** * Get the `content` field from a `TableCell`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_table_cell_content(const KREUZBERGTableCell *ptr); /** * Get the `row_span` field from a `TableCell`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_table_cell_row_span(const KREUZBERGTableCell *ptr); /** * Get the `col_span` field from a `TableCell`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_table_cell_col_span(const KREUZBERGTableCell *ptr); /** * Get the `is_header` field from a `TableCell`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_table_cell_is_header(const KREUZBERGTableCell *ptr); /** * Create a `ExtractedUri` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_extracted_uri_free`. */ KREUZBERGExtractedUri *kreuzberg_extracted_uri_from_json(const char *json); /** * Serialize a `ExtractedUri` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_extracted_uri_to_json(const KREUZBERGExtractedUri *ptr); /** * Free a `ExtractedUri` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_extracted_uri_free(KREUZBERGExtractedUri *ptr); /** * Get the `url` field from a `ExtractedUri`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_extracted_uri_url(const KREUZBERGExtractedUri *ptr); /** * Get the `label` field from a `ExtractedUri`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_extracted_uri_label(const KREUZBERGExtractedUri *ptr); /** * Get the `page` field from a `ExtractedUri`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_extracted_uri_page(const KREUZBERGExtractedUri *ptr); /** * Get the `kind` field from a `ExtractedUri`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGUriKind *kreuzberg_extracted_uri_kind(const KREUZBERGExtractedUri *ptr); /** * Create a `DetectResponse` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_detect_response_free`. */ KREUZBERGDetectResponse *kreuzberg_detect_response_from_json(const char *json); /** * Serialize a `DetectResponse` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_detect_response_to_json(const KREUZBERGDetectResponse *ptr); /** * Free a `DetectResponse` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_detect_response_free(KREUZBERGDetectResponse *ptr); /** * Get the `mime_type` field from a `DetectResponse`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_detect_response_mime_type(const KREUZBERGDetectResponse *ptr); /** * Get the `filename` field from a `DetectResponse`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_detect_response_filename(const KREUZBERGDetectResponse *ptr); /** * Create a `EmbeddingPreset` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_embedding_preset_free`. */ KREUZBERGEmbeddingPreset *kreuzberg_embedding_preset_from_json(const char *json); /** * Serialize a `EmbeddingPreset` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_embedding_preset_to_json(const KREUZBERGEmbeddingPreset *ptr); /** * Free a `EmbeddingPreset` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_embedding_preset_free(KREUZBERGEmbeddingPreset *ptr); /** * Get the `name` field from a `EmbeddingPreset`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_embedding_preset_name(const KREUZBERGEmbeddingPreset *ptr); /** * Get the `chunk_size` field from a `EmbeddingPreset`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_embedding_preset_chunk_size(const KREUZBERGEmbeddingPreset *ptr); /** * Get the `overlap` field from a `EmbeddingPreset`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_embedding_preset_overlap(const KREUZBERGEmbeddingPreset *ptr); /** * Get the `model_repo` field from a `EmbeddingPreset`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_embedding_preset_model_repo(const KREUZBERGEmbeddingPreset *ptr); /** * Get the `pooling` field from a `EmbeddingPreset`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_embedding_preset_pooling(const KREUZBERGEmbeddingPreset *ptr); /** * Get the `model_file` field from a `EmbeddingPreset`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_embedding_preset_model_file(const KREUZBERGEmbeddingPreset *ptr); /** * Get the `dimensions` field from a `EmbeddingPreset`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_embedding_preset_dimensions(const KREUZBERGEmbeddingPreset *ptr); /** * Get the `description` field from a `EmbeddingPreset`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_embedding_preset_description(const KREUZBERGEmbeddingPreset *ptr); /** * Create a `YakeParams` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_yake_params_free`. */ KREUZBERGYakeParams *kreuzberg_yake_params_from_json(const char *json); /** * Serialize a `YakeParams` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_yake_params_to_json(const KREUZBERGYakeParams *ptr); /** * Free a `YakeParams` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_yake_params_free(KREUZBERGYakeParams *ptr); /** * Get the `window_size` field from a `YakeParams`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_yake_params_window_size(const KREUZBERGYakeParams *ptr); /** * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ KREUZBERGYakeParams *kreuzberg_yake_params_default(void); /** * Create a `RakeParams` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_rake_params_free`. */ KREUZBERGRakeParams *kreuzberg_rake_params_from_json(const char *json); /** * Serialize a `RakeParams` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_rake_params_to_json(const KREUZBERGRakeParams *ptr); /** * Free a `RakeParams` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_rake_params_free(KREUZBERGRakeParams *ptr); /** * Get the `min_word_length` field from a `RakeParams`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_rake_params_min_word_length(const KREUZBERGRakeParams *ptr); /** * Get the `max_words_per_phrase` field from a `RakeParams`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_rake_params_max_words_per_phrase(const KREUZBERGRakeParams *ptr); /** * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ KREUZBERGRakeParams *kreuzberg_rake_params_default(void); /** * Create a `KeywordConfig` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_keyword_config_free`. */ KREUZBERGKeywordConfig *kreuzberg_keyword_config_from_json(const char *json); /** * Serialize a `KeywordConfig` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_keyword_config_to_json(const KREUZBERGKeywordConfig *ptr); /** * Free a `KeywordConfig` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_keyword_config_free(KREUZBERGKeywordConfig *ptr); /** * Get the `algorithm` field from a `KeywordConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGKeywordAlgorithm *kreuzberg_keyword_config_algorithm(const KREUZBERGKeywordConfig *ptr); /** * Get the `max_keywords` field from a `KeywordConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ uintptr_t kreuzberg_keyword_config_max_keywords(const KREUZBERGKeywordConfig *ptr); /** * Get the `min_score` field from a `KeywordConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ float kreuzberg_keyword_config_min_score(const KREUZBERGKeywordConfig *ptr); /** * Get the `language` field from a `KeywordConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_keyword_config_language(const KREUZBERGKeywordConfig *ptr); /** * Get the `yake_params` field from a `KeywordConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGYakeParams *kreuzberg_keyword_config_yake_params(const KREUZBERGKeywordConfig *ptr); /** * Get the `rake_params` field from a `KeywordConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGRakeParams *kreuzberg_keyword_config_rake_params(const KREUZBERGKeywordConfig *ptr); /** * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ KREUZBERGKeywordConfig *kreuzberg_keyword_config_default(void); /** * Create a `Keyword` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_keyword_free`. */ KREUZBERGKeyword *kreuzberg_keyword_from_json(const char *json); /** * Serialize a `Keyword` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_keyword_to_json(const KREUZBERGKeyword *ptr); /** * Free a `Keyword` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_keyword_free(KREUZBERGKeyword *ptr); /** * Get the `text` field from a `Keyword`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_keyword_text(const KREUZBERGKeyword *ptr); /** * Get the `score` field from a `Keyword`. * # Safety * Pointer must be a valid handle returned by this library. */ float kreuzberg_keyword_score(const KREUZBERGKeyword *ptr); /** * Get the `algorithm` field from a `Keyword`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGKeywordAlgorithm *kreuzberg_keyword_algorithm(const KREUZBERGKeyword *ptr); /** * Get the `positions` field from a `Keyword`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_keyword_positions(const KREUZBERGKeyword *ptr); /** * Create a `PaddleOcrConfig` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_paddle_ocr_config_free`. */ KREUZBERGPaddleOcrConfig *kreuzberg_paddle_ocr_config_from_json(const char *json); /** * Serialize a `PaddleOcrConfig` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_paddle_ocr_config_to_json(const KREUZBERGPaddleOcrConfig *ptr); /** * Free a `PaddleOcrConfig` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_paddle_ocr_config_free(KREUZBERGPaddleOcrConfig *ptr); /** * Get the `language` field from a `PaddleOcrConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_paddle_ocr_config_language(const KREUZBERGPaddleOcrConfig *ptr); /** * Get the `cache_dir` field from a `PaddleOcrConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_paddle_ocr_config_cache_dir(const KREUZBERGPaddleOcrConfig *ptr); /** * Get the `use_angle_cls` field from a `PaddleOcrConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_paddle_ocr_config_use_angle_cls(const KREUZBERGPaddleOcrConfig *ptr); /** * Get the `enable_table_detection` field from a `PaddleOcrConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_paddle_ocr_config_enable_table_detection(const KREUZBERGPaddleOcrConfig *ptr); /** * Get the `det_db_thresh` field from a `PaddleOcrConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ float kreuzberg_paddle_ocr_config_det_db_thresh(const KREUZBERGPaddleOcrConfig *ptr); /** * Get the `det_db_box_thresh` field from a `PaddleOcrConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ float kreuzberg_paddle_ocr_config_det_db_box_thresh(const KREUZBERGPaddleOcrConfig *ptr); /** * Get the `det_db_unclip_ratio` field from a `PaddleOcrConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ float kreuzberg_paddle_ocr_config_det_db_unclip_ratio(const KREUZBERGPaddleOcrConfig *ptr); /** * Get the `det_limit_side_len` field from a `PaddleOcrConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_paddle_ocr_config_det_limit_side_len(const KREUZBERGPaddleOcrConfig *ptr); /** * Get the `rec_batch_num` field from a `PaddleOcrConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_paddle_ocr_config_rec_batch_num(const KREUZBERGPaddleOcrConfig *ptr); /** * Get the `padding` field from a `PaddleOcrConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_paddle_ocr_config_padding(const KREUZBERGPaddleOcrConfig *ptr); /** * Get the `drop_score` field from a `PaddleOcrConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ float kreuzberg_paddle_ocr_config_drop_score(const KREUZBERGPaddleOcrConfig *ptr); /** * Get the `model_tier` field from a `PaddleOcrConfig`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_paddle_ocr_config_model_tier(const KREUZBERGPaddleOcrConfig *ptr); /** * Sets a custom cache directory for model files. * \param path Path to cache directory * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. * \code * use kreuzberg::PaddleOcrConfig; * use std::path::PathBuf; * * let config = PaddleOcrConfig::new("en") * .with_cache_dir(PathBuf::from("/tmp/paddle-cache")); * \endcode */ KREUZBERGPaddleOcrConfig *kreuzberg_paddle_ocr_config_with_cache_dir(KREUZBERGPaddleOcrConfig *this_, const char *path); /** * Enables or disables table structure detection. * \param enable Whether to enable table detection * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. * \code * use kreuzberg::PaddleOcrConfig; * * let config = PaddleOcrConfig::new("en") * .with_table_detection(true); * \endcode */ KREUZBERGPaddleOcrConfig *kreuzberg_paddle_ocr_config_with_table_detection(KREUZBERGPaddleOcrConfig *this_, int32_t enable); /** * Enables or disables angle classification for rotated text. * \param enable Whether to enable angle classification * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ KREUZBERGPaddleOcrConfig *kreuzberg_paddle_ocr_config_with_angle_cls(KREUZBERGPaddleOcrConfig *this_, int32_t enable); /** * Sets the database threshold for text detection. * \param threshold Detection threshold (0.0-1.0) * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ KREUZBERGPaddleOcrConfig *kreuzberg_paddle_ocr_config_with_det_db_thresh(KREUZBERGPaddleOcrConfig *this_, float threshold); /** * Sets the box threshold for text bounding box refinement. * \param threshold Box threshold (0.0-1.0) * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ KREUZBERGPaddleOcrConfig *kreuzberg_paddle_ocr_config_with_det_db_box_thresh(KREUZBERGPaddleOcrConfig *this_, float threshold); /** * Sets the unclip ratio for expanding text bounding boxes. * \param ratio Unclip ratio (typically 1.5-2.0) * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ KREUZBERGPaddleOcrConfig *kreuzberg_paddle_ocr_config_with_det_db_unclip_ratio(KREUZBERGPaddleOcrConfig *this_, float ratio); /** * Sets the maximum side length for detection images. * \param length Maximum side length in pixels * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ KREUZBERGPaddleOcrConfig *kreuzberg_paddle_ocr_config_with_det_limit_side_len(KREUZBERGPaddleOcrConfig *this_, uint32_t length); /** * Sets the batch size for recognition inference. * \param batch_size Number of text regions to process simultaneously * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ KREUZBERGPaddleOcrConfig *kreuzberg_paddle_ocr_config_with_rec_batch_num(KREUZBERGPaddleOcrConfig *this_, uint32_t batch_size); /** * Sets the minimum recognition confidence threshold. * \param score Minimum confidence (0.0-1.0), text below this is dropped * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ KREUZBERGPaddleOcrConfig *kreuzberg_paddle_ocr_config_with_drop_score(KREUZBERGPaddleOcrConfig *this_, float score); /** * Sets padding in pixels added around images before detection. * \param padding Padding in pixels (0-100) * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ KREUZBERGPaddleOcrConfig *kreuzberg_paddle_ocr_config_with_padding(KREUZBERGPaddleOcrConfig *this_, uint32_t padding); /** * Sets the model tier controlling detection/recognition model size. * \param tier `"mobile"` (default, lightweight, faster) or `"server"` (high accuracy, GPU/complex * documents) * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ KREUZBERGPaddleOcrConfig *kreuzberg_paddle_ocr_config_with_model_tier(KREUZBERGPaddleOcrConfig *this_, const char *tier); /** * Creates a default configuration with English language support. * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ KREUZBERGPaddleOcrConfig *kreuzberg_paddle_ocr_config_default(void); /** * Create a `ModelPaths` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_model_paths_free`. */ KREUZBERGModelPaths *kreuzberg_model_paths_from_json(const char *json); /** * Serialize a `ModelPaths` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_model_paths_to_json(const KREUZBERGModelPaths *ptr); /** * Free a `ModelPaths` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_model_paths_free(KREUZBERGModelPaths *ptr); /** * Get the `det_model` field from a `ModelPaths`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_model_paths_det_model(const KREUZBERGModelPaths *ptr); /** * Get the `cls_model` field from a `ModelPaths`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_model_paths_cls_model(const KREUZBERGModelPaths *ptr); /** * Get the `rec_model` field from a `ModelPaths`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_model_paths_rec_model(const KREUZBERGModelPaths *ptr); /** * Get the `dict_file` field from a `ModelPaths`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_model_paths_dict_file(const KREUZBERGModelPaths *ptr); /** * Create a `OrientationResult` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_orientation_result_free`. */ KREUZBERGOrientationResult *kreuzberg_orientation_result_from_json(const char *json); /** * Serialize a `OrientationResult` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_orientation_result_to_json(const KREUZBERGOrientationResult *ptr); /** * Free a `OrientationResult` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_orientation_result_free(KREUZBERGOrientationResult *ptr); /** * Get the `degrees` field from a `OrientationResult`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_orientation_result_degrees(const KREUZBERGOrientationResult *ptr); /** * Get the `confidence` field from a `OrientationResult`. * # Safety * Pointer must be a valid handle returned by this library. */ float kreuzberg_orientation_result_confidence(const KREUZBERGOrientationResult *ptr); /** * Create a `BBox` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_b_box_free`. */ KREUZBERGBBox *kreuzberg_b_box_from_json(const char *json); /** * Serialize a `BBox` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_b_box_to_json(const KREUZBERGBBox *ptr); /** * Free a `BBox` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_b_box_free(KREUZBERGBBox *ptr); /** * Get the `x1` field from a `BBox`. * # Safety * Pointer must be a valid handle returned by this library. */ float kreuzberg_b_box_x1(const KREUZBERGBBox *ptr); /** * Get the `y1` field from a `BBox`. * # Safety * Pointer must be a valid handle returned by this library. */ float kreuzberg_b_box_y1(const KREUZBERGBBox *ptr); /** * Get the `x2` field from a `BBox`. * # Safety * Pointer must be a valid handle returned by this library. */ float kreuzberg_b_box_x2(const KREUZBERGBBox *ptr); /** * Get the `y2` field from a `BBox`. * # Safety * Pointer must be a valid handle returned by this library. */ float kreuzberg_b_box_y2(const KREUZBERGBBox *ptr); /** * Create a `LayoutDetection` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_layout_detection_free`. */ KREUZBERGLayoutDetection *kreuzberg_layout_detection_from_json(const char *json); /** * Serialize a `LayoutDetection` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_layout_detection_to_json(const KREUZBERGLayoutDetection *ptr); /** * Free a `LayoutDetection` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_layout_detection_free(KREUZBERGLayoutDetection *ptr); /** * Get the `class_name` field from a `LayoutDetection`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGLayoutClass *kreuzberg_layout_detection_class_name(const KREUZBERGLayoutDetection *ptr); /** * Get the `confidence` field from a `LayoutDetection`. * # Safety * Pointer must be a valid handle returned by this library. */ float kreuzberg_layout_detection_confidence(const KREUZBERGLayoutDetection *ptr); /** * Get the `bbox` field from a `LayoutDetection`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGBBox *kreuzberg_layout_detection_bbox(const KREUZBERGLayoutDetection *ptr); /** * Create a `RecognizedTable` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_recognized_table_free`. */ KREUZBERGRecognizedTable *kreuzberg_recognized_table_from_json(const char *json); /** * Serialize a `RecognizedTable` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_recognized_table_to_json(const KREUZBERGRecognizedTable *ptr); /** * Free a `RecognizedTable` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_recognized_table_free(KREUZBERGRecognizedTable *ptr); /** * Get the `detection_bbox` field from a `RecognizedTable`. * # Safety * Pointer must be a valid handle returned by this library. */ KREUZBERGBBox *kreuzberg_recognized_table_detection_bbox(const KREUZBERGRecognizedTable *ptr); /** * Get the `cells` field from a `RecognizedTable`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_recognized_table_cells(const KREUZBERGRecognizedTable *ptr); /** * Get the `markdown` field from a `RecognizedTable`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_recognized_table_markdown(const KREUZBERGRecognizedTable *ptr); /** * Create a `DetectionResult` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_detection_result_free`. */ KREUZBERGDetectionResult *kreuzberg_detection_result_from_json(const char *json); /** * Serialize a `DetectionResult` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_detection_result_to_json(const KREUZBERGDetectionResult *ptr); /** * Free a `DetectionResult` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_detection_result_free(KREUZBERGDetectionResult *ptr); /** * Get the `page_width` field from a `DetectionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_detection_result_page_width(const KREUZBERGDetectionResult *ptr); /** * Get the `page_height` field from a `DetectionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_detection_result_page_height(const KREUZBERGDetectionResult *ptr); /** * Get the `detections` field from a `DetectionResult`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_detection_result_detections(const KREUZBERGDetectionResult *ptr); /** * Create a `EmbeddedFile` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_embedded_file_free`. */ KREUZBERGEmbeddedFile *kreuzberg_embedded_file_from_json(const char *json); /** * Serialize a `EmbeddedFile` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_embedded_file_to_json(const KREUZBERGEmbeddedFile *ptr); /** * Free a `EmbeddedFile` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_embedded_file_free(KREUZBERGEmbeddedFile *ptr); /** * Get the `name` field from a `EmbeddedFile`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_embedded_file_name(const KREUZBERGEmbeddedFile *ptr); /** * Get the `data` field from a `EmbeddedFile`. * # Safety * Pointer must be a valid handle returned by this library. */ uint8_t *kreuzberg_embedded_file_data(const KREUZBERGEmbeddedFile *ptr, uintptr_t *out_len); /** * Get the `mime_type` field from a `EmbeddedFile`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_embedded_file_mime_type(const KREUZBERGEmbeddedFile *ptr); /** * Create a `PdfMetadata` from a JSON string. Returns null on failure. * # Safety * JSON string must be valid UTF-8 and null-terminated. * Returned handle must be freed with `kreuzberg_pdf_metadata_free`. */ KREUZBERGPdfMetadata *kreuzberg_pdf_metadata_from_json(const char *json); /** * Serialize a `PdfMetadata` to a JSON string. Returns null on failure. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_pdf_metadata_to_json(const KREUZBERGPdfMetadata *ptr); /** * Free a `PdfMetadata` handle. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_pdf_metadata_free(KREUZBERGPdfMetadata *ptr); /** * Get the `pdf_version` field from a `PdfMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_pdf_metadata_pdf_version(const KREUZBERGPdfMetadata *ptr); /** * Get the `producer` field from a `PdfMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ char *kreuzberg_pdf_metadata_producer(const KREUZBERGPdfMetadata *ptr); /** * Get the `is_encrypted` field from a `PdfMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ int32_t kreuzberg_pdf_metadata_is_encrypted(const KREUZBERGPdfMetadata *ptr); /** * Get the `width` field from a `PdfMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ int64_t kreuzberg_pdf_metadata_width(const KREUZBERGPdfMetadata *ptr); /** * Get the `height` field from a `PdfMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ int64_t kreuzberg_pdf_metadata_height(const KREUZBERGPdfMetadata *ptr); /** * Get the `page_count` field from a `PdfMetadata`. * # Safety * Pointer must be a valid handle returned by this library. */ uint32_t kreuzberg_pdf_metadata_page_count(const KREUZBERGPdfMetadata *ptr); /** * Convert an integer to a `ExecutionProviderType` variant. Returns -1 on invalid input. * # Safety * Caller must ensure all pointer arguments are valid or null. * Returned pointers must be freed with the appropriate free function. */ int32_t kreuzberg_execution_provider_type_from_i32(int32_t value); /** * Convert a `ExecutionProviderType` variant name (C string) to its integer value. Returns -1 on invalid input. * # Safety * Caller must ensure `ptr` is a valid pointer to a `c_char` or null. */ int32_t kreuzberg_execution_provider_type_from_str(const char *name); /** * Convert an integer to a `OutputFormat` variant. Returns -1 on invalid input. * # Safety * Caller must ensure all pointer arguments are valid or null. * Returned pointers must be freed with the appropriate free function. */ int32_t kreuzberg_output_format_from_i32(int32_t value); /** * Convert a `OutputFormat` variant name (C string) to its integer value. Returns -1 on invalid input. * # Safety * Caller must ensure `ptr` is a valid pointer to a `c_char` or null. */ int32_t kreuzberg_output_format_from_str(const char *name); /** * Convert an integer to a `HtmlTheme` variant. Returns -1 on invalid input. * # Safety * Caller must ensure all pointer arguments are valid or null. * Returned pointers must be freed with the appropriate free function. */ int32_t kreuzberg_html_theme_from_i32(int32_t value); /** * Convert a `HtmlTheme` variant name (C string) to its integer value. Returns -1 on invalid input. * # Safety * Caller must ensure `ptr` is a valid pointer to a `c_char` or null. */ int32_t kreuzberg_html_theme_from_str(const char *name); /** * Convert an integer to a `TableModel` variant. Returns -1 on invalid input. * # Safety * Caller must ensure all pointer arguments are valid or null. * Returned pointers must be freed with the appropriate free function. */ int32_t kreuzberg_table_model_from_i32(int32_t value); /** * Convert a `TableModel` variant name (C string) to its integer value. Returns -1 on invalid input. * # Safety * Caller must ensure `ptr` is a valid pointer to a `c_char` or null. */ int32_t kreuzberg_table_model_from_str(const char *name); /** * Convert an integer to a `ChunkerType` variant. Returns -1 on invalid input. * # Safety * Caller must ensure all pointer arguments are valid or null. * Returned pointers must be freed with the appropriate free function. */ int32_t kreuzberg_chunker_type_from_i32(int32_t value); /** * Convert a `ChunkerType` variant name (C string) to its integer value. Returns -1 on invalid input. * # Safety * Caller must ensure `ptr` is a valid pointer to a `c_char` or null. */ int32_t kreuzberg_chunker_type_from_str(const char *name); /** * Convert an integer to a `ChunkSizing` variant. Returns -1 on invalid input. * # Safety * Caller must ensure all pointer arguments are valid or null. * Returned pointers must be freed with the appropriate free function. */ int32_t kreuzberg_chunk_sizing_from_i32(int32_t value); /** * Convert a `ChunkSizing` variant name (C string) to its integer value. Returns -1 on invalid input. * # Safety * Caller must ensure `ptr` is a valid pointer to a `c_char` or null. */ int32_t kreuzberg_chunk_sizing_from_str(const char *name); /** * Convert an integer to a `EmbeddingModelType` variant. Returns -1 on invalid input. * # Safety * Caller must ensure all pointer arguments are valid or null. * Returned pointers must be freed with the appropriate free function. */ int32_t kreuzberg_embedding_model_type_from_i32(int32_t value); /** * Convert a `EmbeddingModelType` variant name (C string) to its integer value. Returns -1 on invalid input. * # Safety * Caller must ensure `ptr` is a valid pointer to a `c_char` or null. */ int32_t kreuzberg_embedding_model_type_from_str(const char *name); /** * Convert an integer to a `CodeContentMode` variant. Returns -1 on invalid input. * # Safety * Caller must ensure all pointer arguments are valid or null. * Returned pointers must be freed with the appropriate free function. */ int32_t kreuzberg_code_content_mode_from_i32(int32_t value); /** * Convert a `CodeContentMode` variant name (C string) to its integer value. Returns -1 on invalid input. * # Safety * Caller must ensure `ptr` is a valid pointer to a `c_char` or null. */ int32_t kreuzberg_code_content_mode_from_str(const char *name); /** * Convert an integer to a `ListType` variant. Returns -1 on invalid input. * # Safety * Caller must ensure all pointer arguments are valid or null. * Returned pointers must be freed with the appropriate free function. */ int32_t kreuzberg_list_type_from_i32(int32_t value); /** * Convert a `ListType` variant name (C string) to its integer value. Returns -1 on invalid input. * # Safety * Caller must ensure `ptr` is a valid pointer to a `c_char` or null. */ int32_t kreuzberg_list_type_from_str(const char *name); /** * Convert an integer to a `OcrBackendType` variant. Returns -1 on invalid input. * # Safety * Caller must ensure all pointer arguments are valid or null. * Returned pointers must be freed with the appropriate free function. */ int32_t kreuzberg_ocr_backend_type_from_i32(int32_t value); /** * Convert a `OcrBackendType` variant name (C string) to its integer value. Returns -1 on invalid input. * # Safety * Caller must ensure `ptr` is a valid pointer to a `c_char` or null. */ int32_t kreuzberg_ocr_backend_type_from_str(const char *name); /** * Convert an integer to a `ProcessingStage` variant. Returns -1 on invalid input. * # Safety * Caller must ensure all pointer arguments are valid or null. * Returned pointers must be freed with the appropriate free function. */ int32_t kreuzberg_processing_stage_from_i32(int32_t value); /** * Convert a `ProcessingStage` variant name (C string) to its integer value. Returns -1 on invalid input. * # Safety * Caller must ensure `ptr` is a valid pointer to a `c_char` or null. */ int32_t kreuzberg_processing_stage_from_str(const char *name); /** * Convert an integer to a `ReductionLevel` variant. Returns -1 on invalid input. * # Safety * Caller must ensure all pointer arguments are valid or null. * Returned pointers must be freed with the appropriate free function. */ int32_t kreuzberg_reduction_level_from_i32(int32_t value); /** * Convert a `ReductionLevel` variant name (C string) to its integer value. Returns -1 on invalid input. * # Safety * Caller must ensure `ptr` is a valid pointer to a `c_char` or null. */ int32_t kreuzberg_reduction_level_from_str(const char *name); /** * Convert an integer to a `PdfAnnotationType` variant. Returns -1 on invalid input. * # Safety * Caller must ensure all pointer arguments are valid or null. * Returned pointers must be freed with the appropriate free function. */ int32_t kreuzberg_pdf_annotation_type_from_i32(int32_t value); /** * Convert a `PdfAnnotationType` variant name (C string) to its integer value. Returns -1 on invalid input. * # Safety * Caller must ensure `ptr` is a valid pointer to a `c_char` or null. */ int32_t kreuzberg_pdf_annotation_type_from_str(const char *name); /** * Convert an integer to a `BlockType` variant. Returns -1 on invalid input. * # Safety * Caller must ensure all pointer arguments are valid or null. * Returned pointers must be freed with the appropriate free function. */ int32_t kreuzberg_block_type_from_i32(int32_t value); /** * Convert a `BlockType` variant name (C string) to its integer value. Returns -1 on invalid input. * # Safety * Caller must ensure `ptr` is a valid pointer to a `c_char` or null. */ int32_t kreuzberg_block_type_from_str(const char *name); /** * Convert an integer to a `InlineType` variant. Returns -1 on invalid input. * # Safety * Caller must ensure all pointer arguments are valid or null. * Returned pointers must be freed with the appropriate free function. */ int32_t kreuzberg_inline_type_from_i32(int32_t value); /** * Convert a `InlineType` variant name (C string) to its integer value. Returns -1 on invalid input. * # Safety * Caller must ensure `ptr` is a valid pointer to a `c_char` or null. */ int32_t kreuzberg_inline_type_from_str(const char *name); /** * Convert an integer to a `RelationshipKind` variant. Returns -1 on invalid input. * # Safety * Caller must ensure all pointer arguments are valid or null. * Returned pointers must be freed with the appropriate free function. */ int32_t kreuzberg_relationship_kind_from_i32(int32_t value); /** * Convert a `RelationshipKind` variant name (C string) to its integer value. Returns -1 on invalid input. * # Safety * Caller must ensure `ptr` is a valid pointer to a `c_char` or null. */ int32_t kreuzberg_relationship_kind_from_str(const char *name); /** * Convert an integer to a `ContentLayer` variant. Returns -1 on invalid input. * # Safety * Caller must ensure all pointer arguments are valid or null. * Returned pointers must be freed with the appropriate free function. */ int32_t kreuzberg_content_layer_from_i32(int32_t value); /** * Convert a `ContentLayer` variant name (C string) to its integer value. Returns -1 on invalid input. * # Safety * Caller must ensure `ptr` is a valid pointer to a `c_char` or null. */ int32_t kreuzberg_content_layer_from_str(const char *name); /** * Convert an integer to a `NodeContent` variant. Returns -1 on invalid input. * # Safety * Caller must ensure all pointer arguments are valid or null. * Returned pointers must be freed with the appropriate free function. */ int32_t kreuzberg_node_content_from_i32(int32_t value); /** * Convert a `NodeContent` variant name (C string) to its integer value. Returns -1 on invalid input. * # Safety * Caller must ensure `ptr` is a valid pointer to a `c_char` or null. */ int32_t kreuzberg_node_content_from_str(const char *name); /** * Convert an integer to a `AnnotationKind` variant. Returns -1 on invalid input. * # Safety * Caller must ensure all pointer arguments are valid or null. * Returned pointers must be freed with the appropriate free function. */ int32_t kreuzberg_annotation_kind_from_i32(int32_t value); /** * Convert a `AnnotationKind` variant name (C string) to its integer value. Returns -1 on invalid input. * # Safety * Caller must ensure `ptr` is a valid pointer to a `c_char` or null. */ int32_t kreuzberg_annotation_kind_from_str(const char *name); /** * Convert an integer to a `ExtractionMethod` variant. Returns -1 on invalid input. * # Safety * Caller must ensure all pointer arguments are valid or null. * Returned pointers must be freed with the appropriate free function. */ int32_t kreuzberg_extraction_method_from_i32(int32_t value); /** * Convert a `ExtractionMethod` variant name (C string) to its integer value. Returns -1 on invalid input. * # Safety * Caller must ensure `ptr` is a valid pointer to a `c_char` or null. */ int32_t kreuzberg_extraction_method_from_str(const char *name); /** * Convert an integer to a `ChunkType` variant. Returns -1 on invalid input. * # Safety * Caller must ensure all pointer arguments are valid or null. * Returned pointers must be freed with the appropriate free function. */ int32_t kreuzberg_chunk_type_from_i32(int32_t value); /** * Convert a `ChunkType` variant name (C string) to its integer value. Returns -1 on invalid input. * # Safety * Caller must ensure `ptr` is a valid pointer to a `c_char` or null. */ int32_t kreuzberg_chunk_type_from_str(const char *name); /** * Convert an integer to a `ImageKind` variant. Returns -1 on invalid input. * # Safety * Caller must ensure all pointer arguments are valid or null. * Returned pointers must be freed with the appropriate free function. */ int32_t kreuzberg_image_kind_from_i32(int32_t value); /** * Convert a `ImageKind` variant name (C string) to its integer value. Returns -1 on invalid input. * # Safety * Caller must ensure `ptr` is a valid pointer to a `c_char` or null. */ int32_t kreuzberg_image_kind_from_str(const char *name); /** * Convert an integer to a `ResultFormat` variant. Returns -1 on invalid input. * # Safety * Caller must ensure all pointer arguments are valid or null. * Returned pointers must be freed with the appropriate free function. */ int32_t kreuzberg_result_format_from_i32(int32_t value); /** * Convert a `ResultFormat` variant name (C string) to its integer value. Returns -1 on invalid input. * # Safety * Caller must ensure `ptr` is a valid pointer to a `c_char` or null. */ int32_t kreuzberg_result_format_from_str(const char *name); /** * Convert an integer to a `ElementType` variant. Returns -1 on invalid input. * # Safety * Caller must ensure all pointer arguments are valid or null. * Returned pointers must be freed with the appropriate free function. */ int32_t kreuzberg_element_type_from_i32(int32_t value); /** * Convert a `ElementType` variant name (C string) to its integer value. Returns -1 on invalid input. * # Safety * Caller must ensure `ptr` is a valid pointer to a `c_char` or null. */ int32_t kreuzberg_element_type_from_str(const char *name); /** * Convert an integer to a `FormatMetadata` variant. Returns -1 on invalid input. * # Safety * Caller must ensure all pointer arguments are valid or null. * Returned pointers must be freed with the appropriate free function. */ int32_t kreuzberg_format_metadata_from_i32(int32_t value); /** * Convert a `FormatMetadata` variant name (C string) to its integer value. Returns -1 on invalid input. * # Safety * Caller must ensure `ptr` is a valid pointer to a `c_char` or null. */ int32_t kreuzberg_format_metadata_from_str(const char *name); /** * Convert an integer to a `TextDirection` variant. Returns -1 on invalid input. * # Safety * Caller must ensure all pointer arguments are valid or null. * Returned pointers must be freed with the appropriate free function. */ int32_t kreuzberg_text_direction_from_i32(int32_t value); /** * Convert a `TextDirection` variant name (C string) to its integer value. Returns -1 on invalid input. * # Safety * Caller must ensure `ptr` is a valid pointer to a `c_char` or null. */ int32_t kreuzberg_text_direction_from_str(const char *name); /** * Convert an integer to a `LinkType` variant. Returns -1 on invalid input. * # Safety * Caller must ensure all pointer arguments are valid or null. * Returned pointers must be freed with the appropriate free function. */ int32_t kreuzberg_link_type_from_i32(int32_t value); /** * Convert a `LinkType` variant name (C string) to its integer value. Returns -1 on invalid input. * # Safety * Caller must ensure `ptr` is a valid pointer to a `c_char` or null. */ int32_t kreuzberg_link_type_from_str(const char *name); /** * Convert an integer to a `ImageType` variant. Returns -1 on invalid input. * # Safety * Caller must ensure all pointer arguments are valid or null. * Returned pointers must be freed with the appropriate free function. */ int32_t kreuzberg_image_type_from_i32(int32_t value); /** * Convert a `ImageType` variant name (C string) to its integer value. Returns -1 on invalid input. * # Safety * Caller must ensure `ptr` is a valid pointer to a `c_char` or null. */ int32_t kreuzberg_image_type_from_str(const char *name); /** * Convert an integer to a `StructuredDataType` variant. Returns -1 on invalid input. * # Safety * Caller must ensure all pointer arguments are valid or null. * Returned pointers must be freed with the appropriate free function. */ int32_t kreuzberg_structured_data_type_from_i32(int32_t value); /** * Convert a `StructuredDataType` variant name (C string) to its integer value. Returns -1 on invalid input. * # Safety * Caller must ensure `ptr` is a valid pointer to a `c_char` or null. */ int32_t kreuzberg_structured_data_type_from_str(const char *name); /** * Convert an integer to a `OcrBoundingGeometry` variant. Returns -1 on invalid input. * # Safety * Caller must ensure all pointer arguments are valid or null. * Returned pointers must be freed with the appropriate free function. */ int32_t kreuzberg_ocr_bounding_geometry_from_i32(int32_t value); /** * Convert a `OcrBoundingGeometry` variant name (C string) to its integer value. Returns -1 on invalid input. * # Safety * Caller must ensure `ptr` is a valid pointer to a `c_char` or null. */ int32_t kreuzberg_ocr_bounding_geometry_from_str(const char *name); /** * Convert an integer to a `OcrElementLevel` variant. Returns -1 on invalid input. * # Safety * Caller must ensure all pointer arguments are valid or null. * Returned pointers must be freed with the appropriate free function. */ int32_t kreuzberg_ocr_element_level_from_i32(int32_t value); /** * Convert a `OcrElementLevel` variant name (C string) to its integer value. Returns -1 on invalid input. * # Safety * Caller must ensure `ptr` is a valid pointer to a `c_char` or null. */ int32_t kreuzberg_ocr_element_level_from_str(const char *name); /** * Convert an integer to a `PageUnitType` variant. Returns -1 on invalid input. * # Safety * Caller must ensure all pointer arguments are valid or null. * Returned pointers must be freed with the appropriate free function. */ int32_t kreuzberg_page_unit_type_from_i32(int32_t value); /** * Convert a `PageUnitType` variant name (C string) to its integer value. Returns -1 on invalid input. * # Safety * Caller must ensure `ptr` is a valid pointer to a `c_char` or null. */ int32_t kreuzberg_page_unit_type_from_str(const char *name); /** * Convert an integer to a `UriKind` variant. Returns -1 on invalid input. * # Safety * Caller must ensure all pointer arguments are valid or null. * Returned pointers must be freed with the appropriate free function. */ int32_t kreuzberg_uri_kind_from_i32(int32_t value); /** * Convert a `UriKind` variant name (C string) to its integer value. Returns -1 on invalid input. * # Safety * Caller must ensure `ptr` is a valid pointer to a `c_char` or null. */ int32_t kreuzberg_uri_kind_from_str(const char *name); /** * Convert an integer to a `KeywordAlgorithm` variant. Returns -1 on invalid input. * # Safety * Caller must ensure all pointer arguments are valid or null. * Returned pointers must be freed with the appropriate free function. */ int32_t kreuzberg_keyword_algorithm_from_i32(int32_t value); /** * Convert a `KeywordAlgorithm` variant name (C string) to its integer value. Returns -1 on invalid input. * # Safety * Caller must ensure `ptr` is a valid pointer to a `c_char` or null. */ int32_t kreuzberg_keyword_algorithm_from_str(const char *name); /** * Convert an integer to a `PSMMode` variant. Returns -1 on invalid input. * # Safety * Caller must ensure all pointer arguments are valid or null. * Returned pointers must be freed with the appropriate free function. */ int32_t kreuzberg_psm_mode_from_i32(int32_t value); /** * Convert a `PSMMode` variant name (C string) to its integer value. Returns -1 on invalid input. * # Safety * Caller must ensure `ptr` is a valid pointer to a `c_char` or null. */ int32_t kreuzberg_psm_mode_from_str(const char *name); /** * Convert an integer to a `PaddleLanguage` variant. Returns -1 on invalid input. * # Safety * Caller must ensure all pointer arguments are valid or null. * Returned pointers must be freed with the appropriate free function. */ int32_t kreuzberg_paddle_language_from_i32(int32_t value); /** * Convert a `PaddleLanguage` variant name (C string) to its integer value. Returns -1 on invalid input. * # Safety * Caller must ensure `ptr` is a valid pointer to a `c_char` or null. */ int32_t kreuzberg_paddle_language_from_str(const char *name); /** * Convert an integer to a `LayoutClass` variant. Returns -1 on invalid input. * # Safety * Caller must ensure all pointer arguments are valid or null. * Returned pointers must be freed with the appropriate free function. */ int32_t kreuzberg_layout_class_from_i32(int32_t value); /** * Convert a `LayoutClass` variant name (C string) to its integer value. Returns -1 on invalid input. * # Safety * Caller must ensure `ptr` is a valid pointer to a `c_char` or null. */ int32_t kreuzberg_layout_class_from_str(const char *name); /** * Free a heap-allocated `ExecutionProviderType` returned by a pointer-returning FFI function. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_execution_provider_type_free(KREUZBERGExecutionProviderType *ptr); /** * Serialize a heap-allocated `ExecutionProviderType` to a JSON string. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_execution_provider_type_to_json(const KREUZBERGExecutionProviderType *ptr); /** * Render a heap-allocated `ExecutionProviderType` as its string representation * (the unit-variant name as serialized by serde — e.g. `"completed"`, * without surrounding JSON quotes). * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_execution_provider_type_to_string(const KREUZBERGExecutionProviderType *ptr); /** * Free a heap-allocated `OutputFormat` returned by a pointer-returning FFI function. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_output_format_free(KREUZBERGOutputFormat *ptr); /** * Serialize a heap-allocated `OutputFormat` to a JSON string. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_output_format_to_json(const KREUZBERGOutputFormat *ptr); /** * Render a heap-allocated `OutputFormat` as its string representation * (the unit-variant name as serialized by serde — e.g. `"completed"`, * without surrounding JSON quotes). * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_output_format_to_string(const KREUZBERGOutputFormat *ptr); /** * Free a heap-allocated `HtmlTheme` returned by a pointer-returning FFI function. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_html_theme_free(KREUZBERGHtmlTheme *ptr); /** * Serialize a heap-allocated `HtmlTheme` to a JSON string. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_html_theme_to_json(const KREUZBERGHtmlTheme *ptr); /** * Render a heap-allocated `HtmlTheme` as its string representation * (the unit-variant name as serialized by serde — e.g. `"completed"`, * without surrounding JSON quotes). * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_html_theme_to_string(const KREUZBERGHtmlTheme *ptr); /** * Free a heap-allocated `TableModel` returned by a pointer-returning FFI function. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_table_model_free(KREUZBERGTableModel *ptr); /** * Serialize a heap-allocated `TableModel` to a JSON string. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_table_model_to_json(const KREUZBERGTableModel *ptr); /** * Render a heap-allocated `TableModel` as its string representation * (the unit-variant name as serialized by serde — e.g. `"completed"`, * without surrounding JSON quotes). * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_table_model_to_string(const KREUZBERGTableModel *ptr); /** * Free a heap-allocated `ChunkerType` returned by a pointer-returning FFI function. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_chunker_type_free(KREUZBERGChunkerType *ptr); /** * Serialize a heap-allocated `ChunkerType` to a JSON string. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_chunker_type_to_json(const KREUZBERGChunkerType *ptr); /** * Render a heap-allocated `ChunkerType` as its string representation * (the unit-variant name as serialized by serde — e.g. `"completed"`, * without surrounding JSON quotes). * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_chunker_type_to_string(const KREUZBERGChunkerType *ptr); /** * Free a heap-allocated `ChunkSizing` returned by a pointer-returning FFI function. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_chunk_sizing_free(KREUZBERGChunkSizing *ptr); /** * Serialize a heap-allocated `ChunkSizing` to a JSON string. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_chunk_sizing_to_json(const KREUZBERGChunkSizing *ptr); /** * Render a heap-allocated `ChunkSizing` as its string representation * (the unit-variant name as serialized by serde — e.g. `"completed"`, * without surrounding JSON quotes). * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_chunk_sizing_to_string(const KREUZBERGChunkSizing *ptr); /** * Free a heap-allocated `EmbeddingModelType` returned by a pointer-returning FFI function. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_embedding_model_type_free(KREUZBERGEmbeddingModelType *ptr); /** * Serialize a heap-allocated `EmbeddingModelType` to a JSON string. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_embedding_model_type_to_json(const KREUZBERGEmbeddingModelType *ptr); /** * Render a heap-allocated `EmbeddingModelType` as its string representation * (the unit-variant name as serialized by serde — e.g. `"completed"`, * without surrounding JSON quotes). * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_embedding_model_type_to_string(const KREUZBERGEmbeddingModelType *ptr); /** * Free a heap-allocated `CodeContentMode` returned by a pointer-returning FFI function. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_code_content_mode_free(KREUZBERGCodeContentMode *ptr); /** * Serialize a heap-allocated `CodeContentMode` to a JSON string. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_code_content_mode_to_json(const KREUZBERGCodeContentMode *ptr); /** * Render a heap-allocated `CodeContentMode` as its string representation * (the unit-variant name as serialized by serde — e.g. `"completed"`, * without surrounding JSON quotes). * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_code_content_mode_to_string(const KREUZBERGCodeContentMode *ptr); /** * Free a heap-allocated `ReductionLevel` returned by a pointer-returning FFI function. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_reduction_level_free(KREUZBERGReductionLevel *ptr); /** * Serialize a heap-allocated `ReductionLevel` to a JSON string. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_reduction_level_to_json(const KREUZBERGReductionLevel *ptr); /** * Render a heap-allocated `ReductionLevel` as its string representation * (the unit-variant name as serialized by serde — e.g. `"completed"`, * without surrounding JSON quotes). * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_reduction_level_to_string(const KREUZBERGReductionLevel *ptr); /** * Free a heap-allocated `PdfAnnotationType` returned by a pointer-returning FFI function. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_pdf_annotation_type_free(KREUZBERGPdfAnnotationType *ptr); /** * Serialize a heap-allocated `PdfAnnotationType` to a JSON string. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_pdf_annotation_type_to_json(const KREUZBERGPdfAnnotationType *ptr); /** * Render a heap-allocated `PdfAnnotationType` as its string representation * (the unit-variant name as serialized by serde — e.g. `"completed"`, * without surrounding JSON quotes). * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_pdf_annotation_type_to_string(const KREUZBERGPdfAnnotationType *ptr); /** * Free a heap-allocated `BlockType` returned by a pointer-returning FFI function. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_block_type_free(KREUZBERGBlockType *ptr); /** * Serialize a heap-allocated `BlockType` to a JSON string. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_block_type_to_json(const KREUZBERGBlockType *ptr); /** * Render a heap-allocated `BlockType` as its string representation * (the unit-variant name as serialized by serde — e.g. `"completed"`, * without surrounding JSON quotes). * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_block_type_to_string(const KREUZBERGBlockType *ptr); /** * Free a heap-allocated `InlineType` returned by a pointer-returning FFI function. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_inline_type_free(KREUZBERGInlineType *ptr); /** * Serialize a heap-allocated `InlineType` to a JSON string. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_inline_type_to_json(const KREUZBERGInlineType *ptr); /** * Render a heap-allocated `InlineType` as its string representation * (the unit-variant name as serialized by serde — e.g. `"completed"`, * without surrounding JSON quotes). * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_inline_type_to_string(const KREUZBERGInlineType *ptr); /** * Free a heap-allocated `RelationshipKind` returned by a pointer-returning FFI function. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_relationship_kind_free(KREUZBERGRelationshipKind *ptr); /** * Serialize a heap-allocated `RelationshipKind` to a JSON string. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_relationship_kind_to_json(const KREUZBERGRelationshipKind *ptr); /** * Render a heap-allocated `RelationshipKind` as its string representation * (the unit-variant name as serialized by serde — e.g. `"completed"`, * without surrounding JSON quotes). * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_relationship_kind_to_string(const KREUZBERGRelationshipKind *ptr); /** * Free a heap-allocated `ContentLayer` returned by a pointer-returning FFI function. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_content_layer_free(KREUZBERGContentLayer *ptr); /** * Serialize a heap-allocated `ContentLayer` to a JSON string. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_content_layer_to_json(const KREUZBERGContentLayer *ptr); /** * Render a heap-allocated `ContentLayer` as its string representation * (the unit-variant name as serialized by serde — e.g. `"completed"`, * without surrounding JSON quotes). * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_content_layer_to_string(const KREUZBERGContentLayer *ptr); /** * Free a heap-allocated `NodeContent` returned by a pointer-returning FFI function. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_node_content_free(KREUZBERGNodeContent *ptr); /** * Serialize a heap-allocated `NodeContent` to a JSON string. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_node_content_to_json(const KREUZBERGNodeContent *ptr); /** * Render a heap-allocated `NodeContent` as its string representation * (the unit-variant name as serialized by serde — e.g. `"completed"`, * without surrounding JSON quotes). * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_node_content_to_string(const KREUZBERGNodeContent *ptr); /** * Free a heap-allocated `AnnotationKind` returned by a pointer-returning FFI function. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_annotation_kind_free(KREUZBERGAnnotationKind *ptr); /** * Serialize a heap-allocated `AnnotationKind` to a JSON string. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_annotation_kind_to_json(const KREUZBERGAnnotationKind *ptr); /** * Render a heap-allocated `AnnotationKind` as its string representation * (the unit-variant name as serialized by serde — e.g. `"completed"`, * without surrounding JSON quotes). * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_annotation_kind_to_string(const KREUZBERGAnnotationKind *ptr); /** * Free a heap-allocated `ExtractionMethod` returned by a pointer-returning FFI function. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_extraction_method_free(KREUZBERGExtractionMethod *ptr); /** * Serialize a heap-allocated `ExtractionMethod` to a JSON string. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_extraction_method_to_json(const KREUZBERGExtractionMethod *ptr); /** * Render a heap-allocated `ExtractionMethod` as its string representation * (the unit-variant name as serialized by serde — e.g. `"completed"`, * without surrounding JSON quotes). * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_extraction_method_to_string(const KREUZBERGExtractionMethod *ptr); /** * Free a heap-allocated `ChunkType` returned by a pointer-returning FFI function. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_chunk_type_free(KREUZBERGChunkType *ptr); /** * Serialize a heap-allocated `ChunkType` to a JSON string. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_chunk_type_to_json(const KREUZBERGChunkType *ptr); /** * Render a heap-allocated `ChunkType` as its string representation * (the unit-variant name as serialized by serde — e.g. `"completed"`, * without surrounding JSON quotes). * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_chunk_type_to_string(const KREUZBERGChunkType *ptr); /** * Free a heap-allocated `ImageKind` returned by a pointer-returning FFI function. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_image_kind_free(KREUZBERGImageKind *ptr); /** * Serialize a heap-allocated `ImageKind` to a JSON string. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_image_kind_to_json(const KREUZBERGImageKind *ptr); /** * Render a heap-allocated `ImageKind` as its string representation * (the unit-variant name as serialized by serde — e.g. `"completed"`, * without surrounding JSON quotes). * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_image_kind_to_string(const KREUZBERGImageKind *ptr); /** * Free a heap-allocated `ResultFormat` returned by a pointer-returning FFI function. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_result_format_free(KREUZBERGResultFormat *ptr); /** * Serialize a heap-allocated `ResultFormat` to a JSON string. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_result_format_to_json(const KREUZBERGResultFormat *ptr); /** * Render a heap-allocated `ResultFormat` as its string representation * (the unit-variant name as serialized by serde — e.g. `"completed"`, * without surrounding JSON quotes). * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_result_format_to_string(const KREUZBERGResultFormat *ptr); /** * Free a heap-allocated `ElementType` returned by a pointer-returning FFI function. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_element_type_free(KREUZBERGElementType *ptr); /** * Serialize a heap-allocated `ElementType` to a JSON string. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_element_type_to_json(const KREUZBERGElementType *ptr); /** * Render a heap-allocated `ElementType` as its string representation * (the unit-variant name as serialized by serde — e.g. `"completed"`, * without surrounding JSON quotes). * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_element_type_to_string(const KREUZBERGElementType *ptr); /** * Free a heap-allocated `FormatMetadata` returned by a pointer-returning FFI function. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_format_metadata_free(KREUZBERGFormatMetadata *ptr); /** * Serialize a heap-allocated `FormatMetadata` to a JSON string. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_format_metadata_to_json(const KREUZBERGFormatMetadata *ptr); /** * Render a heap-allocated `FormatMetadata` as its string representation * (the unit-variant name as serialized by serde — e.g. `"completed"`, * without surrounding JSON quotes). * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_format_metadata_to_string(const KREUZBERGFormatMetadata *ptr); /** * Free a heap-allocated `TextDirection` returned by a pointer-returning FFI function. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_text_direction_free(KREUZBERGTextDirection *ptr); /** * Serialize a heap-allocated `TextDirection` to a JSON string. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_text_direction_to_json(const KREUZBERGTextDirection *ptr); /** * Render a heap-allocated `TextDirection` as its string representation * (the unit-variant name as serialized by serde — e.g. `"completed"`, * without surrounding JSON quotes). * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_text_direction_to_string(const KREUZBERGTextDirection *ptr); /** * Free a heap-allocated `LinkType` returned by a pointer-returning FFI function. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_link_type_free(KREUZBERGLinkType *ptr); /** * Serialize a heap-allocated `LinkType` to a JSON string. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_link_type_to_json(const KREUZBERGLinkType *ptr); /** * Render a heap-allocated `LinkType` as its string representation * (the unit-variant name as serialized by serde — e.g. `"completed"`, * without surrounding JSON quotes). * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_link_type_to_string(const KREUZBERGLinkType *ptr); /** * Free a heap-allocated `ImageType` returned by a pointer-returning FFI function. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_image_type_free(KREUZBERGImageType *ptr); /** * Serialize a heap-allocated `ImageType` to a JSON string. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_image_type_to_json(const KREUZBERGImageType *ptr); /** * Render a heap-allocated `ImageType` as its string representation * (the unit-variant name as serialized by serde — e.g. `"completed"`, * without surrounding JSON quotes). * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_image_type_to_string(const KREUZBERGImageType *ptr); /** * Free a heap-allocated `StructuredDataType` returned by a pointer-returning FFI function. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_structured_data_type_free(KREUZBERGStructuredDataType *ptr); /** * Serialize a heap-allocated `StructuredDataType` to a JSON string. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_structured_data_type_to_json(const KREUZBERGStructuredDataType *ptr); /** * Render a heap-allocated `StructuredDataType` as its string representation * (the unit-variant name as serialized by serde — e.g. `"completed"`, * without surrounding JSON quotes). * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_structured_data_type_to_string(const KREUZBERGStructuredDataType *ptr); /** * Free a heap-allocated `OcrBoundingGeometry` returned by a pointer-returning FFI function. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_ocr_bounding_geometry_free(KREUZBERGOcrBoundingGeometry *ptr); /** * Serialize a heap-allocated `OcrBoundingGeometry` to a JSON string. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_ocr_bounding_geometry_to_json(const KREUZBERGOcrBoundingGeometry *ptr); /** * Render a heap-allocated `OcrBoundingGeometry` as its string representation * (the unit-variant name as serialized by serde — e.g. `"completed"`, * without surrounding JSON quotes). * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_ocr_bounding_geometry_to_string(const KREUZBERGOcrBoundingGeometry *ptr); /** * Free a heap-allocated `OcrElementLevel` returned by a pointer-returning FFI function. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_ocr_element_level_free(KREUZBERGOcrElementLevel *ptr); /** * Serialize a heap-allocated `OcrElementLevel` to a JSON string. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_ocr_element_level_to_json(const KREUZBERGOcrElementLevel *ptr); /** * Render a heap-allocated `OcrElementLevel` as its string representation * (the unit-variant name as serialized by serde — e.g. `"completed"`, * without surrounding JSON quotes). * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_ocr_element_level_to_string(const KREUZBERGOcrElementLevel *ptr); /** * Free a heap-allocated `PageUnitType` returned by a pointer-returning FFI function. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_page_unit_type_free(KREUZBERGPageUnitType *ptr); /** * Serialize a heap-allocated `PageUnitType` to a JSON string. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_page_unit_type_to_json(const KREUZBERGPageUnitType *ptr); /** * Render a heap-allocated `PageUnitType` as its string representation * (the unit-variant name as serialized by serde — e.g. `"completed"`, * without surrounding JSON quotes). * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_page_unit_type_to_string(const KREUZBERGPageUnitType *ptr); /** * Free a heap-allocated `UriKind` returned by a pointer-returning FFI function. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_uri_kind_free(KREUZBERGUriKind *ptr); /** * Serialize a heap-allocated `UriKind` to a JSON string. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_uri_kind_to_json(const KREUZBERGUriKind *ptr); /** * Render a heap-allocated `UriKind` as its string representation * (the unit-variant name as serialized by serde — e.g. `"completed"`, * without surrounding JSON quotes). * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_uri_kind_to_string(const KREUZBERGUriKind *ptr); /** * Free a heap-allocated `KeywordAlgorithm` returned by a pointer-returning FFI function. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_keyword_algorithm_free(KREUZBERGKeywordAlgorithm *ptr); /** * Serialize a heap-allocated `KeywordAlgorithm` to a JSON string. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_keyword_algorithm_to_json(const KREUZBERGKeywordAlgorithm *ptr); /** * Render a heap-allocated `KeywordAlgorithm` as its string representation * (the unit-variant name as serialized by serde — e.g. `"completed"`, * without surrounding JSON quotes). * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_keyword_algorithm_to_string(const KREUZBERGKeywordAlgorithm *ptr); /** * Free a heap-allocated `LayoutClass` returned by a pointer-returning FFI function. * # Safety * Pointer must have been returned by this library, or be null. */ void kreuzberg_layout_class_free(KREUZBERGLayoutClass *ptr); /** * Serialize a heap-allocated `LayoutClass` to a JSON string. * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_layout_class_to_json(const KREUZBERGLayoutClass *ptr); /** * Render a heap-allocated `LayoutClass` as its string representation * (the unit-variant name as serialized by serde — e.g. `"completed"`, * without surrounding JSON quotes). * # Safety * `ptr` must be a valid, non-null pointer returned by a `kreuzberg` function. * The returned string must be freed with `kreuzberg_free_string`. */ char *kreuzberg_layout_class_to_string(const KREUZBERGLayoutClass *ptr); /** * Extract content from a byte array. * * This is the main entry point for in-memory extraction. It performs the following steps: * 1. Validate MIME type * 2. Handle legacy format conversion if needed * 3. Select appropriate extractor from registry * 4. Extract content * 5. Run post-processing pipeline * \param content The byte array to extract * \param mime_type MIME type of the content * \param config Extraction configuration * \return An `ExtractionResult` containing the extracted content and metadata. * \note Returns `KreuzbergError::Validation` if MIME type is invalid. * Returns `KreuzbergError::UnsupportedFormat` if MIME type is not supported. * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. * \code * use kreuzberg::core::extractor::extract_bytes; * use kreuzberg::core::config::ExtractionConfig; * * let config = ExtractionConfig::default(); * let bytes = b"Hello, world!"; * let result = extract_bytes(bytes, "text/plain", &config).await?; * println!("Content: {}", result.content); * \endcode */ KREUZBERGExtractionResult *kreuzberg_extract_bytes(const uint8_t *content, uintptr_t content_len, const char *mime_type, const KREUZBERGExtractionConfig *config); /** * Extract content from a file. * * This is the main entry point for file-based extraction. It performs the following steps: * 1. Check cache for existing result (if caching enabled) * 2. Detect or validate MIME type * 3. Select appropriate extractor from registry * 4. Extract content * 5. Run post-processing pipeline * 6. Store result in cache (if caching enabled) * \param path Path to the file to extract * \param mime_type Optional MIME type override. If None, will be auto-detected * \param config Extraction configuration * \return An `ExtractionResult` containing the extracted content and metadata. * \note Returns `KreuzbergError::Io` if the file doesn't exist (NotFound) or for other file I/O * errors. * Returns `KreuzbergError::UnsupportedFormat` if MIME type is not supported. * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. * \code * use kreuzberg::core::extractor::extract_file; * use kreuzberg::core::config::ExtractionConfig; * * let config = ExtractionConfig::default(); * let result = extract_file("document.pdf", None, &config).await?; * println!("Content: {}", result.content); * \endcode */ KREUZBERGExtractionResult *kreuzberg_extract_file(const char *path, const char *mime_type, const KREUZBERGExtractionConfig *config); /** * Synchronous wrapper for `extract_file`. * * This is a convenience function that blocks the current thread until extraction completes. * For async code, use `extract_file` directly. * * Uses the global Tokio runtime for 100x+ performance improvement over creating * a new runtime per call. Always uses the global runtime to avoid nested runtime issues. * * This function is only available with the `tokio-runtime` feature. For WASM targets, * use a truly synchronous extraction approach instead. * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. * \code * use kreuzberg::core::extractor::extract_file_sync; * use kreuzberg::core::config::ExtractionConfig; * * let config = ExtractionConfig::default(); * let result = extract_file_sync("document.pdf", None, &config)?; * println!("Content: {}", result.content); * \endcode */ KREUZBERGExtractionResult *kreuzberg_extract_file_sync(const char *path, const char *mime_type, const KREUZBERGExtractionConfig *config); /** * Synchronous wrapper for `extract_bytes`. * * Uses the global Tokio runtime for 100x+ performance improvement over creating * a new runtime per call. * * With the `tokio-runtime` feature, this blocks the current thread using the global * Tokio runtime. Without it (WASM), this calls a truly synchronous implementation. * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. * \code * use kreuzberg::core::extractor::extract_bytes_sync; * use kreuzberg::core::config::ExtractionConfig; * * let config = ExtractionConfig::default(); * let bytes = b"Hello, world!"; * let result = extract_bytes_sync(bytes, "text/plain", &config)?; * println!("Content: {}", result.content); * \endcode */ KREUZBERGExtractionResult *kreuzberg_extract_bytes_sync(const uint8_t *content, uintptr_t content_len, const char *mime_type, const KREUZBERGExtractionConfig *config); /** * Synchronous wrapper for `batch_extract_files`. * * Uses the global Tokio runtime for optimal performance. * Only available with `tokio-runtime` (WASM has no filesystem). * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. * \code * use kreuzberg::core::extractor::batch_extract_files_sync; * use kreuzberg::core::config::{ExtractionConfig, BatchFileItem, FileExtractionConfig}; * * let config = ExtractionConfig::default(); * let items = vec![ * BatchFileItem { * path: "doc1.pdf".into(), * config: Some(FileExtractionConfig { force_ocr: Some(true), ..Default::default() }), * }, * BatchFileItem { path: "doc2.pdf".into(), config: None }, * ]; * let results = batch_extract_files_sync(items, &config)?; * \endcode */ char *kreuzberg_batch_extract_files_sync(const char *items, const KREUZBERGExtractionConfig *config); /** * Return the byte length of the C string most recently returned by * `kreuzberg_batch_extract_files_sync` on this thread. Returns 0 when the primary call returned null * or failed before producing a string. Enables safe slice construction in Zig and Java FFM Panama * without a NUL-scan. * \note SAFETY: Pointer arguments are ignored and are present only to keep the companion ABI aligned * with `kreuzberg_batch_extract_files_sync`. */ uintptr_t kreuzberg_batch_extract_files_sync_len(const char *_items, const KREUZBERGExtractionConfig *_config); /** * Synchronous wrapper for `batch_extract_bytes`. * * Uses the global Tokio runtime for optimal performance. * With the `tokio-runtime` feature, this blocks the current thread using the global * Tokio runtime. Without it (WASM), this calls a truly synchronous implementation * that iterates through items and calls `extract_bytes_sync()`. * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. * \code * use kreuzberg::core::extractor::batch_extract_bytes_sync; * use kreuzberg::core::config::{ExtractionConfig, BatchBytesItem, FileExtractionConfig}; * * let config = ExtractionConfig::default(); * let items = vec![ * BatchBytesItem { content: b"content".to_vec(), mime_type: "text/plain".to_string(), config: None }, * BatchBytesItem { * content: b"other".to_vec(), * mime_type: "text/plain".to_string(), * config: Some(FileExtractionConfig { force_ocr: Some(true), ..Default::default() }), * }, * ]; * let results = batch_extract_bytes_sync(items, &config)?; * \endcode */ char *kreuzberg_batch_extract_bytes_sync(const char *items, const KREUZBERGExtractionConfig *config); /** * Return the byte length of the C string most recently returned by * `kreuzberg_batch_extract_bytes_sync` on this thread. Returns 0 when the primary call returned null * or failed before producing a string. Enables safe slice construction in Zig and Java FFM Panama * without a NUL-scan. * \note SAFETY: Pointer arguments are ignored and are present only to keep the companion ABI aligned * with `kreuzberg_batch_extract_bytes_sync`. */ uintptr_t kreuzberg_batch_extract_bytes_sync_len(const char *_items, const KREUZBERGExtractionConfig *_config); /** * Extract content from multiple files concurrently. * * This function processes multiple files in parallel, automatically managing * concurrency to prevent resource exhaustion. The concurrency limit can be * configured via `ExtractionConfig::max_concurrent_extractions` or defaults * to `(num_cpus * 1.5).ceil()`. * * Each file can optionally specify a [`FileExtractionConfig`] that overrides specific * fields from the batch-level `config`. Pass `None` for a file to use the batch defaults. * Batch-level settings like `max_concurrent_extractions` and `use_cache` are always * taken from the batch-level `config`. * \param items Vector of `BatchFileItem` structs, each containing a path and optional per-file * configuration overrides. * \param config Batch-level extraction configuration (provides defaults and batch settings) * \return A vector of `ExtractionResult` in the same order as the input items. * \note Individual file errors are captured in the result metadata. System errors * (IO, RuntimeError equivalents) will bubble up and fail the entire batch. * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. * \code * Simple usage with no per-file overrides: * * use kreuzberg::core::extractor::batch_extract_files; * use kreuzberg::core::config::{ExtractionConfig, BatchFileItem}; * use std::path::PathBuf; * * let config = ExtractionConfig::default(); * let items = vec![ * BatchFileItem { path: "doc1.pdf".into(), config: None }, * BatchFileItem { path: "doc2.pdf".into(), config: None }, * ]; * let results = batch_extract_files(items, &config).await?; * println!("Processed {} files", results.len()); * * Per-file configuration overrides: * * use kreuzberg::core::extractor::batch_extract_files; * use kreuzberg::core::config::{ExtractionConfig, BatchFileItem, FileExtractionConfig}; * use std::path::PathBuf; * * let config = ExtractionConfig::default(); * let items = vec![ * BatchFileItem { * path: "scan.pdf".into(), * config: Some(FileExtractionConfig { force_ocr: Some(true), ..Default::default() }), * }, * BatchFileItem { path: "notes.txt".into(), config: None }, * ]; * let results = batch_extract_files(items, &config).await?; * \endcode */ char *kreuzberg_batch_extract_files(const char *items, const KREUZBERGExtractionConfig *config); /** * Return the byte length of the C string most recently returned by `kreuzberg_batch_extract_files` on * this thread. Returns 0 when the primary call returned null or failed before producing a string. * Enables safe slice construction in Zig and Java FFM Panama without a NUL-scan. * \note SAFETY: Pointer arguments are ignored and are present only to keep the companion ABI aligned * with `kreuzberg_batch_extract_files`. */ uintptr_t kreuzberg_batch_extract_files_len(const char *_items, const KREUZBERGExtractionConfig *_config); /** * Extract content from multiple byte arrays concurrently. * * This function processes multiple byte arrays in parallel, automatically managing * concurrency to prevent resource exhaustion. The concurrency limit can be * configured via `ExtractionConfig::max_concurrent_extractions` or defaults * to `(num_cpus * 1.5).ceil()`. * * Each item can optionally specify a [`FileExtractionConfig`] that overrides specific * fields from the batch-level `config`. Pass `None` as the config to use * the batch-level defaults for that item. * \param items Vector of `BatchBytesItem` structs, each containing content bytes, MIME type, and * optional per-item configuration overrides. * \param config Batch-level extraction configuration * \return A vector of `ExtractionResult` in the same order as the input items. * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. * \code * Simple usage with no per-item overrides: * * use kreuzberg::core::extractor::batch_extract_bytes; * use kreuzberg::core::config::{ExtractionConfig, BatchBytesItem}; * * let config = ExtractionConfig::default(); * let items = vec![ * BatchBytesItem { content: b"content 1".to_vec(), mime_type: "text/plain".to_string(), config: None }, * BatchBytesItem { content: b"content 2".to_vec(), mime_type: "text/plain".to_string(), config: None }, * ]; * let results = batch_extract_bytes(items, &config).await?; * println!("Processed {} items", results.len()); * * Per-item configuration overrides: * * use kreuzberg::core::extractor::batch_extract_bytes; * use kreuzberg::core::config::{ExtractionConfig, BatchBytesItem, FileExtractionConfig}; * * let config = ExtractionConfig::default(); * let items = vec![ * BatchBytesItem { content: b"content".to_vec(), mime_type: "text/plain".to_string(), config: None }, * BatchBytesItem { * content: b"test".to_vec(), * mime_type: "text/html".to_string(), * config: Some(FileExtractionConfig { force_ocr: Some(true), ..Default::default() }), * }, * ]; * let results = batch_extract_bytes(items, &config).await?; * \endcode */ char *kreuzberg_batch_extract_bytes(const char *items, const KREUZBERGExtractionConfig *config); /** * Return the byte length of the C string most recently returned by `kreuzberg_batch_extract_bytes` on * this thread. Returns 0 when the primary call returned null or failed before producing a string. * Enables safe slice construction in Zig and Java FFM Panama without a NUL-scan. * \note SAFETY: Pointer arguments are ignored and are present only to keep the companion ABI aligned * with `kreuzberg_batch_extract_bytes`. */ uintptr_t kreuzberg_batch_extract_bytes_len(const char *_items, const KREUZBERGExtractionConfig *_config); /** * Detect MIME type from raw file bytes. * * Uses magic byte signatures to detect file type from content. * Falls back to `infer` crate for comprehensive detection. * * For ZIP-based files, inspects contents to distinguish Office Open XML * formats (DOCX, XLSX, PPTX) from plain ZIP archives. * \param content Raw file bytes * \return The detected MIME type string. * \note Returns `KreuzbergError::UnsupportedFormat` if MIME type cannot be determined. * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ char *kreuzberg_detect_mime_type_from_bytes(const uint8_t *content, uintptr_t content_len); /** * Return the byte length of the C string most recently returned by * `kreuzberg_detect_mime_type_from_bytes` on this thread. Returns 0 when the primary call returned * null or failed before producing a string. Enables safe slice construction in Zig and Java FFM Panama * without a NUL-scan. * \note SAFETY: Pointer arguments are ignored and are present only to keep the companion ABI aligned * with `kreuzberg_detect_mime_type_from_bytes`. */ uintptr_t kreuzberg_detect_mime_type_from_bytes_len(const uint8_t *_content, uintptr_t _content_len); /** * Get file extensions for a given MIME type. * * Returns all known file extensions that map to the specified MIME type. * \param mime_type The MIME type to look up * \return A vector of file extensions (without leading dot) for the MIME type. * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. * \code * use kreuzberg::core::mime::get_extensions_for_mime; * * let extensions = get_extensions_for_mime("application/pdf").unwrap(); * assert_eq!(extensions, vec!["pdf"]); * * let doc_extensions = get_extensions_for_mime("application/vnd.openxmlformats-officedocument.wordprocessingml.document").unwrap(); * assert!(doc_extensions.contains(&"docx".to_string())); * \endcode */ char *kreuzberg_get_extensions_for_mime(const char *mime_type); /** * Return the byte length of the C string most recently returned by `kreuzberg_get_extensions_for_mime` * on this thread. Returns 0 when the primary call returned null or failed before producing a string. * Enables safe slice construction in Zig and Java FFM Panama without a NUL-scan. * \note SAFETY: Pointer arguments are ignored and are present only to keep the companion ABI aligned * with `kreuzberg_get_extensions_for_mime`. */ uintptr_t kreuzberg_get_extensions_for_mime_len(const char *_mime_type); /** * List the names of all registered embedding backends. * * Used by `kreuzberg-cli` and the api/mcp endpoints; excluded from the * language bindings via `alef.toml [exclude].functions`. * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ char *kreuzberg_list_embedding_backends(void); /** * Return the byte length of the C string most recently returned by `kreuzberg_list_embedding_backends` * on this thread. Returns 0 when the primary call returned null or failed before producing a string. * Enables safe slice construction in Zig and Java FFM Panama without a NUL-scan. * \note SAFETY: Pointer arguments are ignored and are present only to keep the companion ABI aligned * with `kreuzberg_list_embedding_backends`. */ uintptr_t kreuzberg_list_embedding_backends_len(void); /** * List names of all registered document extractors. * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ char *kreuzberg_list_document_extractors(void); /** * Return the byte length of the C string most recently returned by * `kreuzberg_list_document_extractors` on this thread. Returns 0 when the primary call returned null * or failed before producing a string. Enables safe slice construction in Zig and Java FFM Panama * without a NUL-scan. * \note SAFETY: Pointer arguments are ignored and are present only to keep the companion ABI aligned * with `kreuzberg_list_document_extractors`. */ uintptr_t kreuzberg_list_document_extractors_len(void); /** * List all registered OCR backends. * * Returns the names of all OCR backends currently registered in the global registry. * \return A vector of OCR backend names. * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. * \code * use kreuzberg::plugins::list_ocr_backends; * * let backends = list_ocr_backends()?; * for name in backends { * println!("Registered OCR backend: {}", name); * } * \endcode */ char *kreuzberg_list_ocr_backends(void); /** * Return the byte length of the C string most recently returned by `kreuzberg_list_ocr_backends` on * this thread. Returns 0 when the primary call returned null or failed before producing a string. * Enables safe slice construction in Zig and Java FFM Panama without a NUL-scan. * \note SAFETY: Pointer arguments are ignored and are present only to keep the companion ABI aligned * with `kreuzberg_list_ocr_backends`. */ uintptr_t kreuzberg_list_ocr_backends_len(void); /** * List all registered post-processor names. * * Returns a vector of all post-processor names currently registered in the * global registry. * \return - `Ok(Vec)` - Vector of post-processor names * - `Err(...)` if the registry lock is poisoned * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. * \code * use kreuzberg::plugins::list_post_processors; * * let processors = list_post_processors()?; * for name in processors { * println!("Registered post-processor: {}", name); * } * \endcode */ char *kreuzberg_list_post_processors(void); /** * Return the byte length of the C string most recently returned by `kreuzberg_list_post_processors` on * this thread. Returns 0 when the primary call returned null or failed before producing a string. * Enables safe slice construction in Zig and Java FFM Panama without a NUL-scan. * \note SAFETY: Pointer arguments are ignored and are present only to keep the companion ABI aligned * with `kreuzberg_list_post_processors`. */ uintptr_t kreuzberg_list_post_processors_len(void); /** * List names of all registered renderers. * \note Returns an error if the registry lock is poisoned. * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ char *kreuzberg_list_renderers(void); /** * Return the byte length of the C string most recently returned by `kreuzberg_list_renderers` on this * thread. Returns 0 when the primary call returned null or failed before producing a string. Enables * safe slice construction in Zig and Java FFM Panama without a NUL-scan. * \note SAFETY: Pointer arguments are ignored and are present only to keep the companion ABI aligned * with `kreuzberg_list_renderers`. */ uintptr_t kreuzberg_list_renderers_len(void); /** * List names of all registered validators. * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ char *kreuzberg_list_validators(void); /** * Return the byte length of the C string most recently returned by `kreuzberg_list_validators` on this * thread. Returns 0 when the primary call returned null or failed before producing a string. Enables * safe slice construction in Zig and Java FFM Panama without a NUL-scan. * \note SAFETY: Pointer arguments are ignored and are present only to keep the companion ABI aligned * with `kreuzberg_list_validators`. */ uintptr_t kreuzberg_list_validators_len(void); /** * Generate embeddings asynchronously for a list of text strings. * * This is the async counterpart to [`embed_texts`]. It offloads the blocking * ONNX inference work to a dedicated blocking thread pool via Tokio's * `spawn_blocking`, keeping the async executor free. * * Returns one embedding vector per input text in the same order. * \param texts Vec of strings to embed (owned, sent to blocking thread) * \param config Embedding configuration specifying model, batch size, and normalization * \note - `KreuzbergError::MissingDependency` if ONNX Runtime is not installed * - `KreuzbergError::Embedding` if the preset name is unknown, model download fails, * or the blocking inference task panics * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. * \code * use kreuzberg::{embed_texts_async, EmbeddingConfig}; * * let embeddings = embed_texts_async( * vec!["Hello!".to_string()], * &EmbeddingConfig::default(), * ).await?; * \endcode */ char *kreuzberg_embed_texts_async(const char *texts, const KREUZBERGEmbeddingConfig *config); /** * Return the byte length of the C string most recently returned by `kreuzberg_embed_texts_async` on * this thread. Returns 0 when the primary call returned null or failed before producing a string. * Enables safe slice construction in Zig and Java FFM Panama without a NUL-scan. * \note SAFETY: Pointer arguments are ignored and are present only to keep the companion ABI aligned * with `kreuzberg_embed_texts_async`. */ uintptr_t kreuzberg_embed_texts_async_len(const char *_texts, const KREUZBERGEmbeddingConfig *_config); /** * Render a single PDF page to PNG bytes. * * Returns raw PNG-encoded bytes for the specified page at the given DPI. * Uses pdf_oxide with tiny-skia for pure-Rust rendering. * \param pdf_bytes Raw PDF file bytes * \param page_index Zero-based page index * \param dpi Resolution in dots per inch (default: 150) * \param password Optional password for encrypted PDFs * \note Returns `KreuzbergError::Parsing` if the PDF cannot be opened, authenticated, * or rendered, or if `page_index` is out of range. * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ int32_t kreuzberg_render_pdf_page_to_png(const uint8_t *pdf_bytes, uintptr_t pdf_bytes_len, uintptr_t page_index, int32_t dpi, const char *password, uint8_t **out_ptr, uintptr_t *out_len, uintptr_t *out_cap); /** * Detect the MIME type of a file at the given path. * * Uses the file extension and optionally the file content to determine the MIME type. * Set `check_exists` to `true` to verify the file exists before detection. * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ char *kreuzberg_detect_mime_type(const char *path, int32_t check_exists); /** * Return the byte length of the C string most recently returned by `kreuzberg_detect_mime_type` on * this thread. Returns 0 when the primary call returned null or failed before producing a string. * Enables safe slice construction in Zig and Java FFM Panama without a NUL-scan. * \note SAFETY: Pointer arguments are ignored and are present only to keep the companion ABI aligned * with `kreuzberg_detect_mime_type`. */ uintptr_t kreuzberg_detect_mime_type_len(const char *_path, int32_t _check_exists); /** * Embed a list of texts using the configured embedding model. * * Returns a 2D vector where each inner vector is the embedding for the corresponding text. * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ char *kreuzberg_embed_texts(const char *texts, const KREUZBERGEmbeddingConfig *config); /** * Return the byte length of the C string most recently returned by `kreuzberg_embed_texts` on this * thread. Returns 0 when the primary call returned null or failed before producing a string. Enables * safe slice construction in Zig and Java FFM Panama without a NUL-scan. * \note SAFETY: Pointer arguments are ignored and are present only to keep the companion ABI aligned * with `kreuzberg_embed_texts`. */ uintptr_t kreuzberg_embed_texts_len(const char *_texts, const KREUZBERGEmbeddingConfig *_config); /** * Get an embedding preset by name. * * Returns `None` if no preset with the given name exists. Returns an owned * clone so the value is safe to pass across FFI boundaries. * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ KREUZBERGEmbeddingPreset *kreuzberg_get_embedding_preset(const char *name); /** * List the names of all available embedding presets. * * Returns owned `String`s so the values are safe to pass across FFI boundaries. * \note SAFETY: Caller must ensure all pointer arguments are valid or null. Returned pointers must be * freed with the appropriate free function. */ char *kreuzberg_list_embedding_presets(void); /** * Return the byte length of the C string most recently returned by `kreuzberg_list_embedding_presets` * on this thread. Returns 0 when the primary call returned null or failed before producing a string. * Enables safe slice construction in Zig and Java FFM Panama without a NUL-scan. * \note SAFETY: Pointer arguments are ignored and are present only to keep the companion ABI aligned * with `kreuzberg_list_embedding_presets`. */ uintptr_t kreuzberg_list_embedding_presets_len(void); /** * Register a C plugin implementing `OcrBackend` via a vtable. * * # Parameters * * - `name`: null-terminated UTF-8 plugin name. Must not be null. * - `vtable`: vtable with function pointers implementing the trait. * - `user_data`: opaque pointer forwarded to every vtable function. * - `out_error`: receives a heap-allocated error string on failure. * * # Safety * * All function pointers in `vtable` must remain valid until the plugin is * unregistered. `user_data` must be safe to use from any thread that calls * into the plugin. */ int32_t kreuzberg_register_ocr_backend(const char *name, struct KREUZBERGKreuzbergOcrBackendVTable vtable, const void *user_data, char **out_error); /** * Unregister a previously registered C plugin by name. * * # Parameters * * - `name`: null-terminated UTF-8 plugin name. Must not be null. * - `out_error`: receives a heap-allocated error string on failure. * * # Safety * * `name` must point to a valid null-terminated C string. */ int32_t kreuzberg_unregister_ocr_backend(const char *name, char **out_error); /** * Remove all registered C plugins of this trait. * * # Parameters * * - `out_error`: receives a heap-allocated error string on failure. * * # Safety * * `out_error` may be null. When non-null, the caller owns the resulting string * and must free it with `kreuzberg_free_string`. */ int32_t kreuzberg_clear_ocr_backend(char **out_error); /** * Register a C plugin implementing `PostProcessor` via a vtable. * * # Parameters * * - `name`: null-terminated UTF-8 plugin name. Must not be null. * - `vtable`: vtable with function pointers implementing the trait. * - `user_data`: opaque pointer forwarded to every vtable function. * - `out_error`: receives a heap-allocated error string on failure. * * # Safety * * All function pointers in `vtable` must remain valid until the plugin is * unregistered. `user_data` must be safe to use from any thread that calls * into the plugin. */ int32_t kreuzberg_register_post_processor(const char *name, struct KREUZBERGKreuzbergPostProcessorVTable vtable, const void *user_data, char **out_error); /** * Unregister a previously registered C plugin by name. * * # Parameters * * - `name`: null-terminated UTF-8 plugin name. Must not be null. * - `out_error`: receives a heap-allocated error string on failure. * * # Safety * * `name` must point to a valid null-terminated C string. */ int32_t kreuzberg_unregister_post_processor(const char *name, char **out_error); /** * Remove all registered C plugins of this trait. * * # Parameters * * - `out_error`: receives a heap-allocated error string on failure. * * # Safety * * `out_error` may be null. When non-null, the caller owns the resulting string * and must free it with `kreuzberg_free_string`. */ int32_t kreuzberg_clear_post_processor(char **out_error); /** * Register a C plugin implementing `Validator` via a vtable. * * # Parameters * * - `name`: null-terminated UTF-8 plugin name. Must not be null. * - `vtable`: vtable with function pointers implementing the trait. * - `user_data`: opaque pointer forwarded to every vtable function. * - `out_error`: receives a heap-allocated error string on failure. * * # Safety * * All function pointers in `vtable` must remain valid until the plugin is * unregistered. `user_data` must be safe to use from any thread that calls * into the plugin. */ int32_t kreuzberg_register_validator(const char *name, struct KREUZBERGKreuzbergValidatorVTable vtable, const void *user_data, char **out_error); /** * Unregister a previously registered C plugin by name. * * # Parameters * * - `name`: null-terminated UTF-8 plugin name. Must not be null. * - `out_error`: receives a heap-allocated error string on failure. * * # Safety * * `name` must point to a valid null-terminated C string. */ int32_t kreuzberg_unregister_validator(const char *name, char **out_error); /** * Remove all registered C plugins of this trait. * * # Parameters * * - `out_error`: receives a heap-allocated error string on failure. * * # Safety * * `out_error` may be null. When non-null, the caller owns the resulting string * and must free it with `kreuzberg_free_string`. */ int32_t kreuzberg_clear_validator(char **out_error); /** * Register a C plugin implementing `EmbeddingBackend` via a vtable. * * # Parameters * * - `name`: null-terminated UTF-8 plugin name. Must not be null. * - `vtable`: vtable with function pointers implementing the trait. * - `user_data`: opaque pointer forwarded to every vtable function. * - `out_error`: receives a heap-allocated error string on failure. * * # Safety * * All function pointers in `vtable` must remain valid until the plugin is * unregistered. `user_data` must be safe to use from any thread that calls * into the plugin. */ int32_t kreuzberg_register_embedding_backend(const char *name, struct KREUZBERGKreuzbergEmbeddingBackendVTable vtable, const void *user_data, char **out_error); /** * Unregister a previously registered C plugin by name. * * # Parameters * * - `name`: null-terminated UTF-8 plugin name. Must not be null. * - `out_error`: receives a heap-allocated error string on failure. * * # Safety * * `name` must point to a valid null-terminated C string. */ int32_t kreuzberg_unregister_embedding_backend(const char *name, char **out_error); /** * Remove all registered C plugins of this trait. * * # Parameters * * - `out_error`: receives a heap-allocated error string on failure. * * # Safety * * `out_error` may be null. When non-null, the caller owns the resulting string * and must free it with `kreuzberg_free_string`. */ int32_t kreuzberg_clear_embedding_backend(char **out_error); /** * Register a C plugin implementing `DocumentExtractor` via a vtable. * * # Parameters * * - `name`: null-terminated UTF-8 plugin name. Must not be null. * - `vtable`: vtable with function pointers implementing the trait. * - `user_data`: opaque pointer forwarded to every vtable function. * - `out_error`: receives a heap-allocated error string on failure. * * # Safety * * All function pointers in `vtable` must remain valid until the plugin is * unregistered. `user_data` must be safe to use from any thread that calls * into the plugin. */ int32_t kreuzberg_register_document_extractor(const char *name, struct KREUZBERGKreuzbergDocumentExtractorVTable vtable, const void *user_data, char **out_error); /** * Unregister a previously registered C plugin by name. * * # Parameters * * - `name`: null-terminated UTF-8 plugin name. Must not be null. * - `out_error`: receives a heap-allocated error string on failure. * * # Safety * * `name` must point to a valid null-terminated C string. */ int32_t kreuzberg_unregister_document_extractor(const char *name, char **out_error); /** * Remove all registered C plugins of this trait. * * # Parameters * * - `out_error`: receives a heap-allocated error string on failure. * * # Safety * * `out_error` may be null. When non-null, the caller owns the resulting string * and must free it with `kreuzberg_free_string`. */ int32_t kreuzberg_clear_document_extractor(char **out_error); /** * Register a C plugin implementing `Renderer` via a vtable. * * # Parameters * * - `name`: null-terminated UTF-8 plugin name. Must not be null. * - `vtable`: vtable with function pointers implementing the trait. * - `user_data`: opaque pointer forwarded to every vtable function. * - `out_error`: receives a heap-allocated error string on failure. * * # Safety * * All function pointers in `vtable` must remain valid until the plugin is * unregistered. `user_data` must be safe to use from any thread that calls * into the plugin. */ int32_t kreuzberg_register_renderer(const char *name, struct KREUZBERGKreuzbergRendererVTable vtable, const void *user_data, char **out_error); /** * Unregister a previously registered C plugin by name. * * # Parameters * * - `name`: null-terminated UTF-8 plugin name. Must not be null. * - `out_error`: receives a heap-allocated error string on failure. * * # Safety * * `name` must point to a valid null-terminated C string. */ int32_t kreuzberg_unregister_renderer(const char *name, char **out_error); /** * Remove all registered C plugins of this trait. * * # Parameters * * - `out_error`: receives a heap-allocated error string on failure. * * # Safety * * `out_error` may be null. When non-null, the caller owns the resulting string * and must free it with `kreuzberg_free_string`. */ int32_t kreuzberg_clear_renderer(char **out_error); #endif /* KREUZBERG_H */