fintom8
LiteLLM connector for Gemini / Vertex AI / OpenAI / Azure. Chat, stream, and document extract. Students install with pip and call a few methods — keys stay in .env.
Install from Git (recommended for private use)
GitHub Packages Python upload is currently unreliable (SSL issues). Install directly from this repo instead:
# HTTPS (use a PAT with repo read access if the repo is private)
pip install "git+https://github.com/NikolaienkoIgor/f8_templates.git#subdirectory=fintom8"
# Pin a tag / commit
pip install "git+https://github.com/NikolaienkoIgor/f8_templates.git@fintom8-v0.1.3#subdirectory=fintom8"
# SSH (no token in the URL if your SSH key is set up)
pip install "git+ssh://git@github.com/NikolaienkoIgor/f8_templates.git#subdirectory=fintom8"
Private HTTPS with an explicit token:
pip install "git+https://<GITHUB_USERNAME>:<GITHUB_PAT>@github.com/NikolaienkoIgor/f8_templates.git#subdirectory=fintom8"
Other install options
# Public PyPI (when published)
pip install fintom8
# Local editable install from this checkout
pip install -e ./fintom8
# or: pip install -e "./fintom8[dev]"
from fintom8 import LLM
llm = LLM() # reads .env / environment
print(llm.chat("Summarize this invoice").text)
Configuration
Resolution order: constructor kwargs / LLMConfig > environment > defaults.
Copy .env.example to .env in your project (never commit it).
| Param | Env | Default | When needed |
|---|---|---|---|
model |
LLM_MODEL |
gemini/gemini-3.5-flash |
always |
temperature |
LLM_TEMPERATURE |
1.0 (Gemini/Vertex), else 0.0 |
optional |
num_retries |
— | 3 |
optional |
api_key |
GEMINI_API_KEY / OPENAI_API_KEY / AZURE_API_KEY (from model prefix) |
unset | Gemini / OpenAI / Azure (azure/ → required) |
api_base |
AZURE_API_BASE / OPENAI_API_BASE |
unset | Azure (azure/ → required) |
api_version |
AZURE_API_VERSION |
unset | Azure (azure/ → required) |
vertex_project |
VERTEXAI_PROJECT |
unset | Vertex |
vertex_location |
VERTEXAI_LOCATION |
eu |
Vertex |
For azure/<deployment>, missing api_key, api_base, or api_version raises Fintom8Error (set via constructor or AZURE_* env vars).
from fintom8 import LLM, LLMConfig
llm = LLM() # env defaults
llm = LLM(model="gpt-4o", api_key="sk-...", temperature=0)
llm = LLM(LLMConfig(
model="azure/my-deploy",
api_key="...",
api_base="https://....openai.azure.com",
api_version="2024-10-21",
))
Switch provider
LLM_MODEL |
Env |
|---|---|
gemini/gemini-3.5-flash |
GEMINI_API_KEY |
vertex_ai/gemini-3.5-flash |
VERTEXAI_PROJECT + VERTEXAI_LOCATION + ADC (gcloud auth application-default login) |
gpt-4o |
OPENAI_API_KEY |
azure/<deployment> |
AZURE_API_KEY + AZURE_API_BASE + AZURE_API_VERSION |
Contributors
- Igor Nikolaienko
- Harsh Bansal
Usage
from fintom8 import LLM
llm = LLM()
resp = llm.chat("Hello")
print(resp.text, resp.usage)
# Structured output — file only; detect format → LiteLLM SO → cleanse dates
invoice_rf = {
"type": "json_schema",
"json_schema": {
"name": "Invoice",
"strict": True,
"schema": {
"type": "object",
"properties": {
"total": {"type": "number"},
"vendor": {"type": "string"},
"invoiceDate": {"type": ["date", "null"]},
},
"required": ["total", "vendor", "invoiceDate"],
"additionalProperties": False,
},
},
}
data = llm.structured(
"invoice.pdf", # also: .png/.jpg, .txt/.csv/.xml/.xlsx, or bytes
invoice_rf,
dateFormat="DD.MM.YYYY",
)
# {"total": 42.5, "vendor": "Acme", "invoiceDate": "08.08.2026"}
# process() is an alias of structured()
data = llm.process(
"invoice.pdf",
response_format=invoice_rf,
dateFormat="DD.MM.YYYY",
instructions="Extract invoice vendor and total.",
)
for chunk in llm.stream([{"role": "user", "content": "Write a haiku"}]):
print(chunk, end="", flush=True)
resp = llm.extract("invoice.pdf", response_format=invoice_rf)
Async twins: achat, astream, aextract, astructured, aprocess.
Optional helpers: detect_format, fields_to_schema, compile_fields, prepare_response_format, apply_cleanse, json_schema_response_format, structured_output, enforce_strict, inline_refs.
Failures raise Fintom8Error.
If you see an authentication error (for example missing GEMINI_API_KEY, OPENAI_API_KEY, or Vertex setup), that means package import and retries are working; configure credentials for the selected LLM_MODEL.
See examples/chat.py and examples/extract.py.
Publish (maintainers)
-
Install dev extras and run tests:
cd fintom8 pip install -e ".[dev]" pytest python -c "from fintom8 import LLM"
-
Build:
python -m build
-
Upload to TestPyPI first, then PyPI:
python -m twine upload --repository testpypi dist/* python -m twine upload dist/*
-
Tag for CI Trusted Publishing (OIDC). Create the PyPI project once and add a GitHub environment
pypiwith Trusted Publisher pointing at.github/workflows/publish-fintom8.yml. Then:git tag fintom8-v0.1.3 git push origin fintom8-v0.1.3
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fintom8-0.1.3.tar.gz.
File metadata
- Download URL: fintom8-0.1.3.tar.gz
- Upload date:
- Size: 206.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f86f117a1f12fb1080523341e854c0260150c42b740bfcfeef44371ac668cacf
|
|
| MD5 |
c57831e6d7e07befd23098366cd79ab2
|
|
| BLAKE2b-256 |
a01f404af78020d3c927383628e3261825ccea9a699faa2f28e1b5788b65f2eb
|
File details
Details for the file fintom8-0.1.3-py3-none-any.whl.
File metadata
- Download URL: fintom8-0.1.3-py3-none-any.whl
- Upload date:
- Size: 18.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da1a3a84261570ffe437978219d747fc0d7fefe6bba7f79cb77d7b0bc41df0e6
|
|
| MD5 |
120757f7fdea9e82892c39161212c71c
|
|
| BLAKE2b-256 |
b27e25e61d1357a6cae523c632e9a04409dda57dcb44a08d13e805f3829963d7
|