redline
Targeted, exact document edits for AI agents - no full-document rewrites.
Install
pip install py-redline
pip install "py-redline[pydantic-ai]" # optional, for the pydantic-ai wrapper
Usage
from redline import Document, apply_edit, read
doc = Document("# Todo\n- buy milk\n")
apply_edit(doc, "buy milk", "buy oat milk")
print(read(doc))
Document holds the text. apply_edit finds old_str and swaps in new_str -
it must match exactly once, unless allow_multiple=True. Other tools: read_lines,
append, undo.
With pydantic-ai
from pydantic_ai import Agent
from redline import Document
from redline.pydantic_ai import TOOLS
doc = Document(your_text)
agent = Agent("your-model", deps_type=Document, tools=TOOLS)
agent.run_sync("fix the typo in the intro", deps=doc)
print(doc.text)
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
py_redline-0.1.1.tar.gz
(160.7 kB
view details)
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 py_redline-0.1.1.tar.gz.
File metadata
- Download URL: py_redline-0.1.1.tar.gz
- Upload date:
- Size: 160.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70eb78308d62cec5b37921e34a9ff18c228e1d3fa5cb1c376493b745f11ad866
|
|
| MD5 |
3f605dc79da75b59a7b6ebdf16ce31d4
|
|
| BLAKE2b-256 |
c102327a23a811564822a03491111654208deb91cbc89f28f00bbc6d9e3b9e60
|
File details
Details for the file py_redline-0.1.1-py3-none-any.whl.
File metadata
- Download URL: py_redline-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f36e96a6b8c32a9a614b319fa50579aafcb903a604f2db0e644de082561b237
|
|
| MD5 |
dae03f4646190c6d92d2fd023717d8f6
|
|
| BLAKE2b-256 |
8cc523255cf37b634a54b58c4cc6d3289ca69c94df924fe8542f468700f01a0e
|