Skip to main content

aihist

aihist turns dialog notebooks into input for a language model, and saved replies back into messages. A dialog is a Jupyter notebook in aidialog's format: notes, code, raw cells, and prompts whose replies are saved in the prompt cell's output. Solveit uses aihist through its gateway, rustygate, and Python programs use it directly.

aihist is a Rust crate with Python bindings. The crate needs no Python. The aihist Python package works with aidialog's Dialog, Message and Msg objects.

Install

pip install aihist

Model input

build gives a prompt's model input as Responses input items: the cells above the prompt cell, each as a model reads it, then the prompt. Each earlier prompt is followed by its saved reply, read back into text, tool calls and tool results. A host can add example notebooks, CRAFT dialogs, $ values and warnings. The input fits 80% of the model's input window. Pinned cells always stay, and other cells are dropped oldest first.

from aidialog.dialog import Dialog
from aihist import build

dlg = Dialog(name='demo')
dlg.mk_message('Distances are in metres.', msg_type='note')
p = dlg.mk_message('How far is 3 km?', msg_type='prompt')
items = build(dlg, p.id, dict(input_modalities=['text', 'image'], max_input_tokens=200_000))

The third argument says what the model reads, as fastllm's get_model_info or a model catalog entry gives it. fastllm's response_input turns the items into fastllm messages.

build estimates tokens by character class, calibrated against OpenAI's o200k tokenizer, and adds a margin for other providers' tokenizers. count_tokens gives the estimate for any text: count_tokens('def fetch_daily(lat, lon): pass') is 9.

Saved replies

A saved reply is Markdown, with each tool call and its result in a fenced json {.tool} block, and the turn's token use in a json {.usage} block. fmt2hist reads a reply into chat messages, parse_tools splits it at its tool blocks, and strip_tools removes them. set_result replaces one call's stored result and leaves the rest of the reply unchanged. Reply builds a reply as a model's stream arrives, and shows the text to display at each step.

Reply.add appends completed tool blocks after their pending rows. write_reply formats a completed turn's canonical assistant and tool messages through the same Rust writer. Saved history normally shortens tool results to 5,000 characters and string arguments to 25,000. Full or marked text bypasses this shortening, but not the practical 1MiB text ceiling, which also applies to set_result.

fmt_tools rewrites each tool and usage block in a reply as a folded ::: details div for display, using tool_md and usage_md.

Dialogs and chats

dlg2chat turns a dialog into chat messages, with each reply's tool calls as real parts, and chat2dlg turns chat messages back into a dialog. reply2dlg turns one reply into a dialog of notes and code that calls the tools, which dlg2reply turns back into the reply. hist_xml, to_media and to_parts give one message as a model reads it.

dlg2md writes a dialog as one Markdown document: notes as they are, code in python fences with its outputs in ::: output divs, and each prompt and its reply in ::: prompt and ::: reply divs. msg2md writes one message.

Metadata

Release files for aihist 0.1.3

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

Source distribution (sdist)

Source distribution for aihist 0.1.3
File Size Uploaded Provenance Actions
aihist-0.1.3.tar.gz 54.3 kB With provenance Details for aihist-0.1.3.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for aihist 0.1.3
File Actions
aihist-0.1.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64 Details for aihist-0.1.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
aihist-0.1.3-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ ARM64 Details for aihist-0.1.3-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
aihist-0.1.3-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details for aihist-0.1.3-cp313-cp313-macosx_11_0_arm64.whl
aihist-0.1.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details for aihist-0.1.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
aihist-0.1.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ ARM64 Details for aihist-0.1.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
aihist-0.1.3-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details for aihist-0.1.3-cp312-cp312-macosx_11_0_arm64.whl
aihist-0.1.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details for aihist-0.1.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
aihist-0.1.3-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ ARM64 Details for aihist-0.1.3-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
aihist-0.1.3-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details for aihist-0.1.3-cp311-cp311-macosx_11_0_arm64.whl
aihist-0.1.3-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details for aihist-0.1.3-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
aihist-0.1.3-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ ARM64 Details for aihist-0.1.3-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
aihist-0.1.3-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details for aihist-0.1.3-cp310-cp310-macosx_11_0_arm64.whl

Total release size: 19.7 MB

Release files / aihist-0.1.3.tar.gz

Download URL aihist-0.1.3.tar.gz
Size 54.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c81b9d2fea0eeeb16302a99d11c24f87ba4c64785ef24ad9cd6217943cc91e86
BLAKE2b-256 checksum
How to use checksums
a70aacf0d2b1b3f6836bb285ce3486b640adeb34143c785e8cbec7b87622580a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / aihist-0.1.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL aihist-0.1.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 1.7 MB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
02b56859cb260ac149724b03b5d779203ae937be871d3315a3fef32f87776c60
BLAKE2b-256 checksum
How to use checksums
fc620b34756e5f132661e872a0fa16d2bd8fca350d7eede68f0e982c1ebf6141
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / aihist-0.1.3-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL aihist-0.1.3-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 1.6 MB
Tags CPython 3.13 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
f9a3c47d1c4ee32289b526fa248b01debbfc558506a14621ca02c34d39eb9544
BLAKE2b-256 checksum
How to use checksums
8b561e886780b0ec966607ef62328b58e6478819a5a09da4a88462cba4e2baa8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / aihist-0.1.3-cp313-cp313-macosx_11_0_arm64.whl

Download URL aihist-0.1.3-cp313-cp313-macosx_11_0_arm64.whl
Size 1.6 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
01434fa5fac3dff13f06ca791a769e74e606fd965bfb2ca0d5f934126eb4324e
BLAKE2b-256 checksum
How to use checksums
c6ac7bc6fc5998e49af07f12069aeb978621ddfec313d0981747153d45d7f4d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / aihist-0.1.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL aihist-0.1.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 1.7 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
cf968b349e713e6fbb73825f49b7f9468cd5c4fe01438d9e4f145162873a8859
BLAKE2b-256 checksum
How to use checksums
278277414d7972d4ef8f17e4bd9a91721b710f7568c34b43afc6db6c29216ac9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / aihist-0.1.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL aihist-0.1.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 1.6 MB
Tags CPython 3.12 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
48a31b4b7d82bb633f23ba3e7bed16d4c0aad88c61da3c317a4ed71cf62fdb82
BLAKE2b-256 checksum
How to use checksums
90a0c104b8c01300dae4d0fc46660babb6d93f4b43014063e231823c450c0340
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / aihist-0.1.3-cp312-cp312-macosx_11_0_arm64.whl

Download URL aihist-0.1.3-cp312-cp312-macosx_11_0_arm64.whl
Size 1.6 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
8bfb31dad6928e6a12531bc5f7551ba541365ecbd3e830479a984542cd8f0de5
BLAKE2b-256 checksum
How to use checksums
f28aa454e2add8b691339c339b5df22b6a8f8f2ad900ac87587d675c43280669
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / aihist-0.1.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL aihist-0.1.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 1.7 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
3f18c9cbd44be626fee5dfb92a20037c9d5ce02a3053a9b9d468c1d8ce26d555
BLAKE2b-256 checksum
How to use checksums
fe1da436704050fc54d44b7ac9b38740b6e046aa0cc69c9ec74518c00b87eaad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / aihist-0.1.3-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL aihist-0.1.3-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 1.7 MB
Tags CPython 3.11 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
6799a26916456f83543f039cab630f543ade1caa9340ff909a83c258dec9aa0e
BLAKE2b-256 checksum
How to use checksums
14c9153e1c6c2b008eb5f239a52cc3145513a58f97dc22961fce5ce1dc85f730
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / aihist-0.1.3-cp311-cp311-macosx_11_0_arm64.whl

Download URL aihist-0.1.3-cp311-cp311-macosx_11_0_arm64.whl
Size 1.6 MB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
9f21ca43a00f1928091d130a020b892922fab55406168887330ff62983fb12e1
BLAKE2b-256 checksum
How to use checksums
86ff688c0462e7e8669774851c30f4b76b36f1cd236b4f3d3fee74398e22fea0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / aihist-0.1.3-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL aihist-0.1.3-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 1.7 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
92d49fcab090e188e40724181e892ff1c12361bad728ed4505b59449ec90b342
BLAKE2b-256 checksum
How to use checksums
a15907b1f201087e2585ea72fbc52083f5f48b68d41cfb080f7c0398a10d3d99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / aihist-0.1.3-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL aihist-0.1.3-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 1.7 MB
Tags CPython 3.10 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
2ecf18d383843b9f18c9b78af9d01dcb0d32d3250b9ed8e96e791fafd7b4b681
BLAKE2b-256 checksum
How to use checksums
9cedf66b45eb39a5fdaf6950244e006aa5755e65df8e45ff85f336411b5a4ea5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / aihist-0.1.3-cp310-cp310-macosx_11_0_arm64.whl

Download URL aihist-0.1.3-cp310-cp310-macosx_11_0_arm64.whl
Size 1.6 MB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
5f5ba360a9e25957024478837154f7fb706af25b131f98f16c3214fd24a6c6fa
BLAKE2b-256 checksum
How to use checksums
b1e9a3c3bcf18d146406c9733d044b534284f0832d0a10b967daa61a0b2bf837
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Security for aihist 0.1.3

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.

Full provenance

All 13 files in this release have been uploaded with provenance metadata.

Select from 13 files

Attestation for aihist-0.1.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

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