Skip to main content

semql-prompt

LLM-facing prompt rendering for a semql Catalog.

semql's compiler is pure — it turns a SemanticQuery into SQL and never renders a prompt. This package is the rendering layer on top:

  • Four-role prompt fragments — build_planner_prompt_fragment, build_router_prompt_fragment, build_presenter_prompt_fragment, build_drilldown_prompt_fragment, build_query_generator_prompt_fragment.
  • Cacheable segments — CatalogPrompt (viewer-invariant static + per-viewer overlay) for prompt-cache breakpoints, plus prompt_hash.
  • Tool-description projection — to_openai_tools / to_langchain_tools / to_openai_function for function-calling clients, and to_bedrock_converse_tools for the Bedrock Converse API (object-rooted inputSchema).
  • Prompt-token budgeting — PromptBudget, apply_budget, estimate_tokens.

Install

pip install semql-prompt

Quick start

The catalog-level conveniences take the catalog as their first argument:

from semql import Catalog
from semql_prompt import planner_prompt, planner_prompt_segments, prompt_hash, to_openai_tools

text = planner_prompt(catalog, viewer=viewer)
segs = planner_prompt_segments(catalog)
key  = prompt_hash(catalog)
tools = to_openai_tools(catalog, viewer=viewer)

For the lower-level per-role fragment builders, see API reference.

License

BSD-3-Clause.

Metadata

Release files for semql-prompt 0.8.0

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

Source distribution (sdist)

Source distribution for semql-prompt 0.8.0
File Size Uploaded Provenance
semql_prompt-0.8.0.tar.gz 29.1 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for semql-prompt 0.8.0
File Interpreter ABI Platform
semql_prompt-0.8.0-py3-none-any.whl Python 3 none any Details

Total release size: 61.6 kB

Release files / semql_prompt-0.8.0.tar.gz

Download URL semql_prompt-0.8.0.tar.gz
Size 29.1 kB
Tags Source
SHA-256 checksum
How to use checksums
dd1883a991e15d29e47f931b972e722b360ebc8bb675d3566fabd33d9012c6bc
BLAKE2b-256 checksum
How to use checksums
7dc32d1d95aa5ff235534d8ce30201c717c2019c76503c7eff908a0ce404bfc2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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 2, 2026.

Transparency log

Release files / semql_prompt-0.8.0-py3-none-any.whl

Download URL semql_prompt-0.8.0-py3-none-any.whl
Size 32.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9aac4de17427f377de04cadacd7f60449968047065bfa74a1a413f5057741bec
BLAKE2b-256 checksum
How to use checksums
e2968923dfc4a5d3e7b538fdf244be85e83e004a87349d45382922d648e8bd80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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 2, 2026.

Transparency log

Security for semql-prompt 0.8.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.

Full provenance

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

Select from 2 files

Attestation for semql_prompt-0.8.0.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 2, 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