orkg-llm-logger
Part of LLM Logger.
Log LLM calls from Python (OpenAI, Gemini, OpenRouter, or any client) to JSON or
JSONL. Records use the same GenerationRecord format as the TypeScript package
@orkg/llm-logger, defined in
schema/generation-record.schema.json.
No runtime dependencies.
pip install orkg-llm-logger
from llm_logger import llm_logger, LLMLoggerConfig
LLMLoggerConfig.configure(file_path="llm_logs.jsonl", project="my-agent")
# Decorate a function that calls a model
@llm_logger(name="extract")
def ask(prompt: str):
return client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": prompt}],
)
# Or wrap an SDK method directly
create = llm_logger.wrap(client.chat.completions.create, name="chat")
# Or capture manually inside an existing block
with llm_logger.context(name="batch") as ctx:
resp = client.chat.completions.create(...)
ctx.capture(resp, prompt="...")
Sync and async functions are both supported. Provider, model, prompt, output
and token usage are extracted from OpenAI-, Gemini- and OpenRouter-shaped
responses. Errors are logged with status: "error" and re-raised.
Output format follows the file extension: .jsonl appends one record per line,
anything else keeps a JSON array (written atomically).
See examples/ — quickstart.py runs without API keys.
Development
python -m venv .venv && . .venv/bin/activate
pip install -e '.[dev]'
pytest
License
MIT
Metadata
Release files for orkg-llm-logger 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| orkg_llm_logger-0.1.0.tar.gz | 10.2 kB | Without provenance | Details for orkg_llm_logger-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| orkg_llm_logger-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for orkg_llm_logger-0.1.0-py3-none-any.whl |
Total release size: 19.6 kB
Release files / orkg_llm_logger-0.1.0.tar.gz
| Download URL | orkg_llm_logger-0.1.0.tar.gz |
|---|---|
| Size | 10.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9faf27254c6cc638b620f3522df9a6ce16a3b0c5bfe97cc7d8dc13ed10d758f4
|
|
BLAKE2b-256 checksum How to use checksums |
2e139029724ab78c5f10505439c90b7c4abe866e01c8738850e67b9f737dfdae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.2
|
Release files / orkg_llm_logger-0.1.0-py3-none-any.whl
| Download URL | orkg_llm_logger-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d998d358db4757ac2b30d6ac98b8a1d8fb906ebb723aa2e135d6b4003cb6622d
|
|
BLAKE2b-256 checksum How to use checksums |
cb3a00fa17f06df963a7289013fa49eae0634cd90976f2825857d3f376d08c6c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.2
|
Security for orkg-llm-logger 0.1.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.