LLM-facing prompt rendering for a semql Catalog: the four-role planner/router/presenter/drilldown fragments, cacheable prompt segments, tool-description projection, and prompt-token budgeting.
Project description
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-invariantstatic+ per-vieweroverlay) for prompt-cache breakpoints, plusprompt_hash. - Tool-description projection —
to_openai_tools/to_langchain_tools/to_openai_functionfor function-calling clients, andto_bedrock_converse_toolsfor the Bedrock Converse API (object-rootedinputSchema). - 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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 semql_prompt-0.6.0.tar.gz.
File metadata
- Download URL: semql_prompt-0.6.0.tar.gz
- Upload date:
- Size: 26.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a861d52f2ef470b9a833685d6b3a8f5181507249711c27343860680e54fab183
|
|
| MD5 |
520b8d138af5d602ad6de9f135fbc8b3
|
|
| BLAKE2b-256 |
7d33359a2f5e0c70d095b2c6c667924d1c6d56050908587be66d1582b2006cdf
|
Provenance
The following attestation bundles were made for semql_prompt-0.6.0.tar.gz:
Publisher:
release.yml on semql-io/semql
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
semql_prompt-0.6.0.tar.gz -
Subject digest:
a861d52f2ef470b9a833685d6b3a8f5181507249711c27343860680e54fab183 - Sigstore transparency entry: 2205871796
- Sigstore integration time:
-
Permalink:
semql-io/semql@66dda3b501bc5c8aac13172e9d98bc45427b7ced -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/semql-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@66dda3b501bc5c8aac13172e9d98bc45427b7ced -
Trigger Event:
push
-
Statement type:
File details
Details for the file semql_prompt-0.6.0-py3-none-any.whl.
File metadata
- Download URL: semql_prompt-0.6.0-py3-none-any.whl
- Upload date:
- Size: 30.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
468615f93bdcf8eaeab595c2b5b9c2e3e8f7da2847b588fbe4744a865d11431b
|
|
| MD5 |
5b71835028c93204959daca1d2bf9e43
|
|
| BLAKE2b-256 |
2d49aabd5eded32c8de10cae58580e862314870a2abab70a24a7c25f5403d4f9
|
Provenance
The following attestation bundles were made for semql_prompt-0.6.0-py3-none-any.whl:
Publisher:
release.yml on semql-io/semql
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
semql_prompt-0.6.0-py3-none-any.whl -
Subject digest:
468615f93bdcf8eaeab595c2b5b9c2e3e8f7da2847b588fbe4744a865d11431b - Sigstore transparency entry: 2205872185
- Sigstore integration time:
-
Permalink:
semql-io/semql@66dda3b501bc5c8aac13172e9d98bc45427b7ced -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/semql-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@66dda3b501bc5c8aac13172e9d98bc45427b7ced -
Trigger Event:
push
-
Statement type: