OpenHosta Documentation¶
Welcome to the OpenHosta documentation. OpenHosta is the semantic layer for Python โ it transforms human language and type annotations into executable, type-safe Python functions powered by Large Language Models.
Quick Navigation¶
๐ Getting Started¶
Set up your environment, configure a local or remote model, and run your first emulate() call.
โ๏ธ Core Functions¶
Learn about emulate, emulate_async, emulate_variants, closure, ask, and test.
๐ Streaming & Iterators¶
Stream raw tokens with ask_stream, or yield structured Python objects one-by-one with Iterator return types and emulate_variants.
๐ง Models & Setup¶
Connect any OpenAI-compatible endpoint (Ollama, vLLM, Azure OpenAI), customize prompts, enable audit mode, and track costs.
๐งฉ Types & Pydantic Validation¶
OpenHosta natively supports int, str, List, Dict, Enum, dataclass, Pydantic V2, and even Callable return types.
๐ก๏ธ Safe Context & Error Handling¶
Handle uncertainty, catch ambiguous LLM responses, and build robust production workflows.
โก Parallel Processing¶
Simplify concurrent execution of emulate_async with the gather_data batching utility to parse vast amount of items concurrently.
๐ Guarded Types¶
Deep dive into OpenHosta's type validation and conversion system with configurable tolerance.
๐ ๏ธ Debugging & Inspection¶
Learn how to use conversation(), readable(), and markdown() to inspect LLM outputs and debug your semantic code.
๐ก๏ธ Production & Auditing¶
Learn how to deploy OpenHosta at scale, enable audit logging for compliance, and track token usage in production.
Cookbook¶
| Example | Description |
|---|---|
| ๐ Text Classification | Classify text into Enum states |
| ๐๏ธ Data Extraction | Populate dataclass / Pydantic from unstructured text |
| ๐๏ธ Local OCR | Image processing with PIL.Image + Ollama |
| ๐ Streaming & Iterators | Stream tokens or yield typed objects with Iterator |
Compatibility¶
- Python: 3.10, 3.11, 3.12, 3.13, 3.14 (details)
- Models: OpenAI (GPT-4.1, GPT-5), Ollama (Qwen, Mistral), Azure, vLLM (type matrix)
Contributing¶
We welcome contributions! See our Contribution Guide and Code of Conduct.
OpenHosta is licensed under the MIT License.