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.2
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 |
|---|---|---|---|---|
| aihist-0.1.2.tar.gz | 54.3 kB | With provenance | Details for aihist-0.1.2.tar.gz |
Built distributions (wheels)
Total release size: 19.6 MB
Release files / aihist-0.1.2.tar.gz
| Download URL | aihist-0.1.2.tar.gz |
|---|---|
| Size | 54.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b0e485bf7b8020e8b49d45ab648e4882b90b5be6bffdb86184d947127a76aef2
|
|
BLAKE2b-256 checksum How to use checksums |
00b3e0b7e31a782685f28daf0856af00675ad12f7ce7f2bf5691ba972009d180
|
| 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 Oct 28, 2026.
Transparency logRelease files / aihist-0.1.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | aihist-0.1.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
6a668873b4e28414f295ba2506481a8e845f5740da72fac3d25f04d8e3d45e6b
|
|
BLAKE2b-256 checksum How to use checksums |
7e85f199f293062fdcc5db5c58c1a38c218bc571f2bef92f289629264aca8926
|
| 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 Oct 28, 2026.
Transparency logRelease files / aihist-0.1.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | aihist-0.1.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.13 Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
d231d0598de74225dd215fdb7bdfb35a8a5dcf0582a9a4fe059141269ba6bc73
|
|
BLAKE2b-256 checksum How to use checksums |
c2a378042772616e719fa36858400d3afa4efd9e7d0a54334303847ea3f07bad
|
| 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 Oct 28, 2026.
Transparency logRelease files / aihist-0.1.2-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | aihist-0.1.2-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
152f37bc2eb8b6b99ecbb4dd00bd068d2bbaaa5f8ff8138ceb8e9210dedfac09
|
|
BLAKE2b-256 checksum How to use checksums |
fe5818fb719829996792ca324be3af0ce971004979fe96c7a268f8c9313c5aca
|
| 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 Oct 28, 2026.
Transparency logRelease files / aihist-0.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | aihist-0.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
c3cecbdb5bea3916f48090bb1484f65321a62b3a92adcb9c2afe993eea365e10
|
|
BLAKE2b-256 checksum How to use checksums |
637b1ad55159739f9d9e8e0294a12be030a0d0fa2a9038a59189332506cb672e
|
| 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 Oct 28, 2026.
Transparency logRelease files / aihist-0.1.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | aihist-0.1.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
0ec27c19327a04d83906eeffc075346f80e220e6138d9c2d52d960308b620772
|
|
BLAKE2b-256 checksum How to use checksums |
ee14a2d96b31b6729393acc641c0d93ade5bb61693ba263200dd69b2caa4b93b
|
| 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 Oct 28, 2026.
Transparency logRelease files / aihist-0.1.2-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | aihist-0.1.2-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
2fbfd659a1478febd0cbe8116bf1e773e19c6b1888304e445c1b8f917c1eba8b
|
|
BLAKE2b-256 checksum How to use checksums |
98e7fd7b31cadb51577d87912fadaaa371230b93bebce6fc5a7cbdb42bf08c30
|
| 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 Oct 28, 2026.
Transparency logRelease files / aihist-0.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | aihist-0.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
84e9686cb3b0afde2878034f07918fa9dfaf44cb6182f719484d1761e90b7e77
|
|
BLAKE2b-256 checksum How to use checksums |
4865848bb23b7c2f794765cb974ea792de6dd1f2eae92028115da005596ca2bc
|
| 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 Oct 28, 2026.
Transparency logRelease files / aihist-0.1.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | aihist-0.1.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
525bd0fc1997f5b500d8b0dd9ad3fff96c2cb129c0974e1f292e7810526b2dda
|
|
BLAKE2b-256 checksum How to use checksums |
57fc2173711485096730d3d799a15978f33b277aafc93eca97d819f1a673c55b
|
| 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 Oct 28, 2026.
Transparency logRelease files / aihist-0.1.2-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | aihist-0.1.2-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
ba957fb2d60927750aca75ddb56c895f8a49ccc11fb55b6a878377b88b3821ac
|
|
BLAKE2b-256 checksum How to use checksums |
1cc19217b033e32d8a0fd33a7a5cffef6235fd37e9bfffb72c865532b2a48382
|
| 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 Oct 28, 2026.
Transparency logRelease files / aihist-0.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | aihist-0.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
5865292c2118c0ec7a74c2d93e52b553fe212fa3e787ad53e57d2bfcfa15e2d4
|
|
BLAKE2b-256 checksum How to use checksums |
478d3ce52073ba3cf31e6096eb85d44e6af1ceadd4c1515e57ed7e8fe8a56da6
|
| 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 Oct 28, 2026.
Transparency logRelease files / aihist-0.1.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | aihist-0.1.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
1853fd1a82657daa7531ad664ef9f4b9a34bc075d0febaf882d48133df75bfaa
|
|
BLAKE2b-256 checksum How to use checksums |
fd41dde51470a9e47bad14ef267ce1d2b0337b0b08e64ecad47d91fc6090742f
|
| 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 Oct 28, 2026.
Transparency logRelease files / aihist-0.1.2-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | aihist-0.1.2-cp310-cp310-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.10 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
231e2fdeed7a7671d1d00a1482cd703ef610a0d8b7436095ab2baeda2e6b83de
|
|
BLAKE2b-256 checksum How to use checksums |
05969371a7960b4cd094d1710991bc50450584af7df2c319456b01fe1de71eff
|
| 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 Oct 28, 2026.
Transparency logSecurity for aihist 0.1.2
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.
Attestation for aihist-0.1.2.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 Oct 28, 2026.
Transparency logA 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.