1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
//! REST API server for Kreuzberg document extraction.
//!
//! This module provides an Axum-based HTTP server for document extraction
//! with endpoints for single and batch extraction operations.
//!
//! # Endpoints
//!
//! - `POST /extract` - Extract text from uploaded files (multipart form data)
//! - `POST /detect` - Detect MIME type of an uploaded file (multipart form data)
//! - `POST /embed` - Generate embeddings for text (JSON body with texts array)
//! - `POST /chunk` - Chunk text into smaller pieces (JSON body with text and config)
//! - `GET /health` - Health check endpoint
//! - `GET /info` - Server information
//! - `GET /version` - Version information
//! - `GET /cache/stats` - Get cache statistics
//! - `GET /cache/manifest` - Get model manifest with checksums and sizes
//! - `POST /cache/warm` - Pre-download models to cache
//! - `DELETE /cache/clear` - Clear all cached files
//!
//! # Examples
//!
//! ## Starting the server
//!
//! ```no_run
//! use kreuzberg::api::serve;
//!
//! #[tokio::main]
//! async fn main() -> kreuzberg::Result<()> {
//! // Local development
//! serve("127.0.0.1", 8000).await?;
//! Ok(())
//! }
//! ```
//!
//! ## Embedding the router in your app
//!
//! ```no_run
//! use kreuzberg::{ExtractionConfig, api::create_router};
//! use axum::Router;
//!
//! #[tokio::main]
//! async fn main() -> kreuzberg::Result<()> {
//! // Load config (from file or use default)
//! let config = ExtractionConfig::default();
//! let kreuzberg_router = create_router(config);
//!
//! // Nest under /api prefix
//! let app = Router::new().nest("/api", kreuzberg_router);
//!
//! // Add your own routes
//! // ...
//!
//! Ok(())
//! }
//! ```
//!
//! # cURL Examples
//!
//! ```bash
//! # Single file extraction
//! curl -F "files=@document.pdf" http://localhost:8000/extract
//!
//! # Multiple files with OCR config
//! curl -F "files=@doc1.pdf" -F "files=@doc2.jpg" \
//! -F 'config={"ocr":{"language":"eng"}}' \
//! http://localhost:8000/extract
//!
//! # Health check
//! curl http://localhost:8000/health
//!
//! # Server info
//! curl http://localhost:8000/info
//!
//! # Cache statistics
//! curl http://localhost:8000/cache/stats
//!
//! # Clear cache
//! curl -X DELETE http://localhost:8000/cache/clear
//!
//! # Generate embeddings
//! curl -X POST http://localhost:8000/embed \
//! -H "Content-Type: application/json" \
//! -d '{"texts":["Hello world","Second text"]}'
//!
//! # Chunk text
//! curl -X POST http://localhost:8000/chunk \
//! -H "Content-Type: application/json" \
//! -d '{"text":"Long text to chunk...","chunker_type":"text"}'
//! ```
pub use load_server_config;
pub use ApiError;
pub use ;
pub use ;
pub use ;