Skip to main content

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 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.

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

semql_prompt-0.7.0.tar.gz (29.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

semql_prompt-0.7.0-py3-none-any.whl (32.5 kB view details)

Uploaded Python 3

File details

Details for the file semql_prompt-0.7.0.tar.gz.

File metadata

  • Download URL: semql_prompt-0.7.0.tar.gz
  • Upload date:
  • Size: 29.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for semql_prompt-0.7.0.tar.gz
Algorithm Hash digest
SHA256 730932c49aa48af42cceb45269e8abc82d9532b0a2fbe6e0462ab5d0ac2fb0d4
MD5 c2fc8c421c9b6fd499578a03da7a9497
BLAKE2b-256 2ed4b577c10ab842ba6fdba82c5547b7ac42ec81159c2f454c74d94b0584706e

See more details on using hashes here.

Provenance

The following attestation bundles were made for semql_prompt-0.7.0.tar.gz:

Publisher: release.yml on semql-io/semql

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file semql_prompt-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: semql_prompt-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 32.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for semql_prompt-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 376304e4a57f3727c3bf3259a0b8b52996ea3f209b270b29473b7ff627e48aca
MD5 1484f3b01ec3c258cf1409ecd2508bc9
BLAKE2b-256 6aa03c3a38c3589a2434a3be9765d4730236b8415da698df8c42727273c3337a

See more details on using hashes here.

Provenance

The following attestation bundles were made for semql_prompt-0.7.0-py3-none-any.whl:

Publisher: release.yml on semql-io/semql

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page