Metadata-Version: 2.5
Name: openform-core
Version: 0.1.0
Summary: Headless PDF form discovery, AI extraction, and port-agnostic LLM/audio provider core.
Project-URL: Homepage, https://github.com/fireform-core/fireform-core
Project-URL: Issues, https://github.com/fireform-core/fireform-core/issues
Author: OpenForm / FireForm contributors
License: MIT License
        
        Copyright (c) 2026 FireForm
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: extraction,forms,llama.cpp,llm,ollama,pdf,whisper
Requires-Python: >=3.11
Requires-Dist: openai>=1.0
Requires-Dist: pdfplumber>=0.11
Requires-Dist: pydantic>=2.0
Requires-Dist: pypdf>=4.0
Requires-Dist: requests>=2.31
Requires-Dist: websockets>=12.0
Provides-Extra: all
Requires-Dist: av>=12.0; extra == 'all'
Requires-Dist: commonforms>=0.2.1; extra == 'all'
Requires-Dist: faster-whisper>=1.0; extra == 'all'
Requires-Dist: llama-cpp-python>=0.3; extra == 'all'
Requires-Dist: numpy<2; extra == 'all'
Provides-Extra: audio
Requires-Dist: av>=12.0; extra == 'audio'
Requires-Dist: faster-whisper>=1.0; extra == 'audio'
Requires-Dist: numpy<2; extra == 'audio'
Provides-Extra: dev
Requires-Dist: numpy<2; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Provides-Extra: fillable
Requires-Dist: commonforms>=0.2.1; extra == 'fillable'
Provides-Extra: local
Requires-Dist: llama-cpp-python>=0.3; extra == 'local'
Description-Content-Type: text/markdown

# openform-core

Headless, port-agnostic Python core for PDF form discovery, table-aware JSON schema extraction, and multi-provider LLM & speech-to-text automation.

No database, no web framework, and no hardcoded ports or services — connect any LLM endpoint (`Ollama`, `llama.cpp`, `vLLM`, `OpenAI`, `Gemini`, `Claude`) and any audio endpoint (`faster-whisper-server`, `whisper.cpp`, `/asr`, or in-process `faster-whisper`) to whatever port or engine you run.

## Install

```bash
pip install openform-core

# Optional extras
pip install "openform-core[audio]"     # in-process faster-whisper + PyAV streaming
pip install "openform-core[fillable]"  # commonforms: convert flat/scanned PDFs into fillable forms
pip install "openform-core[local]"     # in-process llama-cpp-python GGUF support
pip install "openform-core[all]"       # everything
```

## Quickstart

```python
from openform import FormEngine, OllamaLLM, OpenAICompatibleAudioProvider

engine = FormEngine(
    llm=OllamaLLM(host="http://localhost:11434", model="qwen2.5:3b"),
    audio=OpenAICompatibleAudioProvider(base_url="http://localhost:9000/v1"),
)

result = engine.fill(
    "form.pdf",
    "Narrative text...",
    out_path="filled.pdf",
)
print(result.values)
```

## Architecture (Ports & Adapters)

- **`openform.pdf`**: Ruling-line table & widget geometry discovery (`pdfplumber` + `pypdf`), tooltip/radio-group schema builder, and `commonforms` wrapper (`[fillable]`).
- **`openform.ai`**: `LLM` / `LLMProvider` port, `OllamaLLM`, `OpenAICompatibleLLM` (`llama.cpp`, `vLLM`, `OpenAI`, `Gemini`, `Anthropic`, custom URLs), `LlamaCppLLM` (`[local]`), and `LLMRegistry`.
- **`openform.audio`**: `AudioProvider` port, `OpenAICompatibleAudioProvider`, `LegacyWhisperASRProvider`, `AutoWhisperProvider`, and `LocalWhisperProvider` + `StreamingTranscriber` (`[audio]`).
- **`openform.prompts`**: Domain-neutral extraction rules (`en`, `es`) and `PromptPack` customization for vertical applications (`FireForm`, `PoliceForm`, `EMSForm`).
- **`openform.schemas`**: `ProfileContext` and `FillResult` models.
