Crate oxify_connect_vision

Crate oxify_connect_vision 

Source
Expand description

§oxify-connect-vision

Vision/OCR connector for OxiFY workflows.

This crate provides OCR (Optical Character Recognition) capabilities for extracting text from images and documents.

§Features

  • Mock provider: For testing and development
  • Tesseract: Traditional OCR engine (requires system installation)
  • Surya: Deep learning OCR with layout analysis (ONNX)
  • PaddleOCR: High-quality multilingual OCR (ONNX)
  • Google Cloud Vision: Cloud-based OCR with Google’s Vision API

§Usage

use oxify_connect_vision::{providers, VisionProvider};

// Create a mock provider for testing
let provider = providers::MockVisionProvider::new();

// Process an image
let result = provider.process_image(&image_bytes).await?;

println!("Extracted text: {}", result.text);
println!("Markdown: {}", result.markdown);

§Feature Flags

  • mock (default): Enable mock provider
  • tesseract: Enable Tesseract OCR support
  • surya: Enable Surya OCR (requires ONNX models)
  • paddle: Enable PaddleOCR (requires ONNX models)
  • google-vision: Enable Google Cloud Vision API support
  • cuda: Enable CUDA GPU acceleration
  • coreml: Enable CoreML GPU acceleration (macOS)
  • all-providers: Enable all OCR providers

Re-exports§

pub use access_control::AccessController;
pub use access_control::AccessError;
pub use access_control::ApiKey;
pub use access_control::Permission;
pub use access_control::UsageSnapshot;
pub use access_control::UsageStats;
pub use audit::AuditEvent;
pub use audit::AuditEventType;
pub use audit::AuditLogger;
pub use audit::AuditResult;
pub use audit::AuditSeverity;
pub use audit::AuditStats;
pub use audit::RetentionPolicy;
pub use batch::process_batch_simple;
pub use batch::BatchConfig;
pub use batch::BatchItemResult;
pub use batch::BatchProcessor;
pub use batch::BatchProgress;
pub use batch::BatchResult;
pub use benchmark::BenchmarkResult;
pub use benchmark::BenchmarkRunner;
pub use benchmark::ComparisonReport;
pub use benchmark::MemoryProfile;
pub use cache::CacheKey;
pub use cache::CacheStats;
pub use cache::VisionCache;
pub use config::BatchConfig as ConfigBatch;
pub use config::CacheConfig as ConfigCache;
pub use config::ConfigWatcher;
pub use config::DownloaderConfig as ConfigDownloader;
pub use config::PreprocessingConfig as ConfigPreprocessing;
pub use config::ProviderConfig as ConfigProvider;
pub use config::VisionConfig;
pub use diagnostics::ErrorCategory;
pub use diagnostics::ErrorDiagnostic;
pub use diagnostics::SystemDiagnostics;
pub use downloader::compute_checksum;
pub use downloader::default_cache_dir;
pub use downloader::DownloadProgress;
pub use downloader::DownloaderConfig;
pub use downloader::ModelDownloader;
pub use downloader::ModelInfo;
pub use encryption::EncryptedData;
pub use encryption::EncryptionAlgorithm;
pub use encryption::EncryptionConfig;
pub use encryption::EncryptionError;
pub use encryption::EncryptionProvider;
pub use encryption::EncryptionStats;
pub use encryption::KeyDerivationFunction;
pub use errors::Result;
pub use errors::VisionError;
pub use form_detection::Checkbox;
pub use form_detection::FieldType;
pub use form_detection::FormDetectionConfig;
pub use form_detection::FormDetectionResult;
pub use form_detection::FormDetector;
pub use form_detection::FormField;
pub use form_detection::RadioButton;
pub use form_detection::RadioGroup;
pub use form_detection::Signature;
pub use gpu::GpuConfig;
pub use gpu::GpuInfo;
pub use gpu::GpuProvider;
pub use logging::LogEntry;
pub use logging::LogLevel;
pub use logging::LogSampler;
pub use logging::SamplingConfig;
pub use logging::StructuredLogger;
pub use metrics::Counter;
pub use metrics::Gauge;
pub use metrics::Histogram;
pub use metrics::MetricsSummary;
pub use metrics::OcrMetrics;
pub use metrics::Timer;
pub use model_loading::LoadingStrategy;
pub use model_loading::MemoryStats;
pub use model_loading::ModelHandle;
pub use model_loading::ModelLoader;
pub use model_loading::ModelLoadingConfig;
pub use otel::OtelConfig;
pub use otel::OtelError;
pub use otel::Span;
pub use otel::SpanAttributes;
pub use otel::SpanContext;
pub use otel::SpanData;
pub use otel::SpanEvent;
pub use otel::SpanStatus;
pub use otel::TracingProvider;
pub use otel::TracingStats;
pub use pdf_processing::PdfDocumentResult;
pub use pdf_processing::PdfMetadata;
pub use pdf_processing::PdfPage;
pub use pdf_processing::PdfProcessingConfig;
pub use pdf_processing::PdfProcessor;
pub use pdf_processing::SearchResult;
pub use pdf_processing::TocEntry;
pub use persistent_cache::CacheBackend;
pub use persistent_cache::CacheStats as PersistentCacheStats;
pub use persistent_cache::EvictionPolicy;
pub use persistent_cache::PersistentCache;
pub use persistent_cache::RedisConfig;
pub use persistent_cache::SqliteConfig;
pub use preprocessing::ImagePreprocessor;
pub use preprocessing::PreprocessConfig;
pub use profiling::BottleneckInfo;
pub use profiling::CallTreeNode;
pub use profiling::MemorySnapshot;
pub use profiling::ProfileEntry;
pub use profiling::Profiler;
pub use profiling::ProfilerConfig;
pub use profiling::ProfilingError;
pub use profiling::ProfilingReport;
pub use profiling::ReportStats;
pub use providers::create_provider;
pub use providers::ProviderCapabilities;
pub use providers::VisionProvider;
pub use providers::VisionProviderConfig;
pub use quantization::ModelQuantizer;
pub use quantization::QuantizationBenefits;
pub use quantization::QuantizationConfig;
pub use quantization::QuantizationMethod;
pub use quantization::QuantizationPrecision;
pub use quantization::QuantizedModelInfo;
pub use simd::SimdConfig;
pub use simd::SimdError;
pub use simd::SimdInstructionSet;
pub use simd::SimdProcessor;
pub use simd::SimdStats;
pub use streaming::AsyncFrameStream;
pub use streaming::FrameMetadata;
pub use streaming::SamplingStrategy;
pub use streaming::StreamConfig;
pub use streaming::StreamError;
pub use streaming::StreamProcessor;
pub use streaming::StreamStats;
pub use table_extraction::Table;
pub use table_extraction::TableCell;
pub use table_extraction::TableExtractionConfig;
pub use table_extraction::TableExtractor;
pub use types::BlockRole;
pub use types::ImageInput;
pub use types::OcrMetadata;
pub use types::OcrResult;
pub use types::OutputFormat;
pub use types::TextBlock;
pub use validation::validate_image_bytes;
pub use validation::validate_image_file;
pub use validation::ImageValidator;
pub use validation::ValidationConfig;

Modules§

access_control
Access control module for API key management, rate limiting, and quotas.
audit
Audit logging module for compliance and security tracking.
batch
Batch processing API for OCR operations.
benchmark
Benchmark and comparison utilities.
cache
Caching for OCR results.
config
Configuration management for vision/OCR system.
diagnostics
Diagnostic utilities for vision/OCR troubleshooting.
downloader
Model downloader with progress reporting and verification.
encryption
Data Encryption for Cached Results and Models
errors
Error types for vision/OCR operations.
form_detection
Form field detection and extraction.
gpu
GPU detection and management utilities.
logging
Enhanced logging module for structured and secure logging.
metrics
Metrics collection and reporting module.
model_loading
Memory-mapped model loading for ONNX Runtime.
otel
OpenTelemetry Integration for Distributed Tracing
pdf_processing
Multi-page PDF document processing.
persistent_cache
Persistent caching backends for OCR results.
prelude
Prelude module for common imports.
preprocessing
Image preprocessing utilities for OCR.
profiling
Performance Profiling for OCR Operations
providers
Vision/OCR provider implementations.
quantization
Model quantization support for performance optimization.
simd
SIMD Optimizations for Image Processing
streaming
Streaming Processing for Video Frames
table_extraction
Table extraction and structure detection.
types
Core types for OCR/Vision processing results.
validation
Input validation module for secure image processing.

Macros§

profile
Helper macro for profiling a block
traced
Helper macro for creating traced blocks