Skip to main content

llm-bot

Async Python library and LLM-backed bot service.

The current implementation exposes image captioning, embeddings, stateless chat and grounded HRAG answering, sentiment analysis, title generation, summary, named entity recognition, entity relationship extraction, structured graph retrieval planning, translation, linking, clustering, and classification endpoints backed by OpenAI-compatible APIs and a decisions API.

Requirements

  • uv
  • Python 3.13 or newer

Python library

Install a published release into a Python 3.13+ project with uv add "taranis-llm-bot[inference]". The PyPI distribution is taranis-llm-bot; Python imports use llm_bot. The base install supports prepared HRAG tasks with an injected transport. Install taranis-llm-bot[inference] for the bundled HTTP clients; [server] adds the HTTP service. Before publishing, install a locally built wheel with uv add /absolute/path/to/taranis_llm_bot-VERSION-py3-none-any.whl.

Set LLM_BASE_URL, LLM_API_KEY, and optionally LLM_MODEL and LLM_API_MODE in the environment or .env before importing the library. Call the async task functions directly; no bot HTTP server is needed:

import asyncio

from llm_bot.schemas import SummarizeRequest
from llm_bot.tasks.summarize import summarize


async def main():
    result = await summarize(SummarizeRequest(text="Text to summarize", language="en", max_words=80))
    print(result.summary)
    # result.model_dump() returns a dictionary.


asyncio.run(main())

In an existing async application, use await summarize(...) directly. Other tasks follow the same pattern: request models in llm_bot.schemas, async functions in llm_bot.tasks (for example, ner.extract_entities and translate.translate_text). For image captions, pass an Image2TextRequest to await describe_image(request). Import describe_image and its batch counterpart prepare_image2text from llm_bot.tasks.image2text. Generative tasks accept an optional client=LLMClient(...) to override the connection; import it from llm_bot.client. Inputs and outputs are Pydantic models, and errors propagate to the caller. Linking also needs the LOOKUP_* configuration. Cybersecurity classification uses the independent DECISIONS_* connection when DECISIONS_URL is set; you can inject a DecisionsClient from llm_bot.decisions_client or an LLMClient to explicitly select either transport. Fine-grained classification uses ClassifyRequest and llm_bot.tasks.classify.classify_text, always with a DecisionsClient and the DECISIONS_* connection. Sentiment analysis also requires this connection and accepts an optional DecisionsClient override.

For repeated decisions tasks, pass a caller-owned niquests.AsyncSession as DecisionsClient(session=session) to reuse HTTP connections. Keep the session open around the calls with async with AsyncSession() as session; the client does not close it. See the session example. Without an injected session, each call opens and closes its own session.

For the HTTP service, install the server extra with uv add "taranis-llm-bot[server]". Then import create_app from llm_bot.app and expose app = create_app() in your ASGI entry point.

Setup

uv sync --locked --extra dev --extra server
./scripts/check.sh
cp .env.example .env

Configure the following values in .env:

  • LLM_BASE_URL
  • LLM_API_KEY
  • LLM_MODEL (optional if your OpenAI-compatible backend provides a default model)
  • LLM_API_MODE: responses (default) or chat_completions

See Configuration for optional settings.

POST /image2text accepts JPEG, PNG, and WebP uploads up to 5 MiB and captions them with a vision-capable LLM_MODEL. The Taranis Image2Text bot can use this Python library with its configured vision endpoint or send images to AIT Media Intelligence (Media Miner). See the bot settings and HTTP upload example.

To route /cybersec-classification to a decision model, also set DECISIONS_URL to the full endpoint URL, DECISIONS_MODEL, and DECISIONS_API_KEY if required. DECISIONS_API_MODE=systemone (default) supports OpenRouter's https://openrouter.ai/api/alpha/decisions and llama.cpp/vLLM /v1/systemone; use openai for /v1/decisions. The public classification response stays unchanged.

POST /classify requires the same decisions configuration. Send {"text":"Article text"} to receive probabilities for disinformation, security incident, vulnerability, threat intelligence, security policy, security news, general news, and other. These describe the main topic; disinformation is a topic label, not a truth verdict. See the classification API for category definitions. The live evaluation records 24 examples and how to rerun them.

POST /sentiment also requires decisions configuration. Its response keeps the sentiment.label and sentiment.score fields, with the score taken from the winning label's probability. Set include_emotions: true for compatible Plutchik emotions, assessed independently in the same decisions request. Existing sentiment reasoning fields are accepted but ignored. There is no generative fallback. The default labels are positive, negative, and neutral. Set include_mixed: true to add mixed for text that clearly expresses both positive and negative sentiment. A mixed result can include emotions from both sides. Factual reporting of a breach or recovery alone does not imply an emotional tone.

Run

uv sync --locked --extra server
uv run granian --interface asgi app:app --port 5500

API

See the API reference for endpoint examples. Interactive Swagger docs are available at GET /docs; the OpenAPI document is at GET /openapi.yaml.

Guides

Development checks

uv sync --locked --extra dev --extra server
uv run pre-commit install
./scripts/check.sh

The script installs development dependencies, checks lint and formatting (including Python examples in Markdown), and runs the full test suite. The installed pre-commit hook, pull request CI, and release validation all run this same script. Run uv run pre-commit run --all-files to check manually.

Metadata

Release files for taranis-llm-bot 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for taranis-llm-bot 0.2.0
File Size Uploaded Provenance Actions
taranis_llm_bot-0.2.0.tar.gz 189.6 kB Without provenance Details for taranis_llm_bot-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for taranis-llm-bot 0.2.0
File Interpreter ABI Platform Actions
taranis_llm_bot-0.2.0-py3-none-any.whl Python 3 none any Details for taranis_llm_bot-0.2.0-py3-none-any.whl

Total release size: 264.4 kB

Release files / taranis_llm_bot-0.2.0.tar.gz

Download URL taranis_llm_bot-0.2.0.tar.gz
Size 189.6 kB
Tags Source
SHA-256 checksum
How to use checksums
33f73a653a924203425f45a45aa2c8c53ebf904f184ff7ffc5a9306a53f2b17b
BLAKE2b-256 checksum
How to use checksums
05080d7de774d51c7fdc45fbcff62b1acfc5e74415f7679418722bc98b51ac7e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / taranis_llm_bot-0.2.0-py3-none-any.whl

Download URL taranis_llm_bot-0.2.0-py3-none-any.whl
Size 74.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3dceeb353e69107c79fa6aaf0fbc086a141b2b2d056bba4380368985e3f30fae
BLAKE2b-256 checksum
How to use checksums
38cf208b305d743d1968ce3d10158d572a2d6777c6f3dfa2d5191d88c47dd3a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for taranis-llm-bot 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page