zed-zeta-bindings
Python bindings for Zed's Zeta prompt formatting and model output parsing code.
Installation
pip install zed-zeta-bindings
Local builds
Local builds need a Zed checkout because this package depends on Zed's crates/zeta_prompt and crates/edit_prediction_metrics crates. The build helpers generate a gitignored .zed-path/Cargo.toml manifest that points Cargo at the discovered checkout.
Set ZED_PATH to the checkout root when you want to be explicit:
ZED_PATH=/path/to/zed uv run zeta bindings build --native
When ZED_PATH is unset, the helpers try common local layouts including ../zed, ~/zed/zed, ~/zed, and ~/develop/zed.
Usage
import zeta_bindings as zeta
prompt_format = "V0318SeedMultiRegions" # Zeta2.1 prompt format
prompt_input = zeta.ZetaPromptInput.from_dict(request_body)
prompt = zeta.format_prompt(prompt_input, prompt_format)
stop_tokens = zeta.stop_tokens(prompt_format) or None
raw_output = await engine.predict({"prompt": prompt, "stop": stop_tokens})
parsed_output = zeta.parse_output(raw_output, prompt_format, prompt_input)
response = {
"output": parsed_output.new_editable_region,
"editable_range": {
"start": parsed_output.range_in_excerpt[0],
"end": parsed_output.range_in_excerpt[1],
},
}
For more detailed type information, see crates/zeta_prompt in the Zed repository: https://github.com/zed-industries/zed/tree/main/crates/zeta_prompt.
License
zed-zeta-bindings is licensed under GPL-3.0-or-later.
API
Functions that accept a format_str parameter are parameterized on the prompt format. Refer to the following table for the prompt format to use:
| Zeta Version | Prompt Format String |
|---|---|
| Zeta2 | V0211SeedCoder |
| Zeta2.1 | V0318SeedMultiRegions |
ZetaPromptInput.from_dict(data)
Builds the typed prompt input from a request dictionary. The required fields are:
cursor_pathcursor_excerptcursor_offset_in_excerptexcerpt_ranges
Optional fields include excerpt_start_row, events, related_files, active_buffer_diagnostics, and syntax_ranges.
format_prompt(prompt_input, format_str)
Formats a ZetaPromptInput into the prompt string sent to the model.
Returns None if the input does not fit within the selected format's token budget.
stop_tokens(format_str)
Returns the stop tokens for the selected prompt format.
parse_output(model_output, format_str, prompt_input)
Parses a raw model completion into a ParsedOutput.
ParsedOutput contains:
new_editable_region: the replacement text for the editable region.range_in_excerpt: the[start, end]byte range of the editable region incursor_excerpt.cursor_offset_in_new_editable_region: the cursor offset in the replacement text, when present.
Metadata
Release files for zed-zeta-bindings 1.10.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| zed_zeta_bindings-1.10.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.8 | abi3 | Linux glibc 2.17+ x86-64 | Details for zed_zeta_bindings-1.10.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
Release files / zed_zeta_bindings-1.10.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | zed_zeta_bindings-1.10.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 861.4 kB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
1eecf75cabd051871c0e9a73a684086f9cbd11cf127c209213d81ebfaa9126a7
|
|
BLAKE2b-256 checksum How to use checksums |
89a73ef517d82593cad3c8b9679e80ef56ed71c9bfcf953bb36bc7eb2299a1d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.2
|
Security for zed-zeta-bindings 1.10.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.
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.