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 fragmentsbuild_planner_prompt_fragment, build_router_prompt_fragment, build_presenter_prompt_fragment, build_drilldown_prompt_fragment, build_query_generator_prompt_fragment.
  • Cacheable segmentsCatalogPrompt (viewer-invariant static + per-viewer overlay) for prompt-cache breakpoints, plus prompt_hash.
  • Tool-description projectionto_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 budgetingPromptBudget, 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.

Release files for semql-prompt 0.7.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.7.0
File Size Uploaded
semql_prompt-0.7.0.tar.gz 29.1 kB Details

Built distribution (wheel)

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

Total release size: 61.6 kB

Release files / semql_prompt-0.7.0.tar.gz

Download URL semql_prompt-0.7.0.tar.gz
Size 29.1 kB
Tags Source
SHA-256 checksum
How to use checksums
730932c49aa48af42cceb45269e8abc82d9532b0a2fbe6e0462ab5d0ac2fb0d4
BLAKE2b-256 checksum
How to use checksums
2ed4b577c10ab842ba6fdba82c5547b7ac42ec81159c2f454c74d94b0584706e
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 Jul 21, 2026.

Transparency log

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

Download URL semql_prompt-0.7.0-py3-none-any.whl
Size 32.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
376304e4a57f3727c3bf3259a0b8b52996ea3f209b270b29473b7ff627e48aca
BLAKE2b-256 checksum
How to use checksums
6aa03c3a38c3589a2434a3be9765d4730236b8415da698df8c42727273c3337a
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 Jul 21, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.7.0 This release

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

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