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.
  • 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.3.0.tar.gz (23.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.3.0-py3-none-any.whl (26.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: semql_prompt-0.3.0.tar.gz
  • Upload date:
  • Size: 23.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for semql_prompt-0.3.0.tar.gz
Algorithm Hash digest
SHA256 6214d287f7d0754051c9502aa817a450b72f586240cf12d3177f638b2cf57fe3
MD5 7023a3dd0d6094ddae59b053ea0dfd89
BLAKE2b-256 b8f0c3c374f1ee073fad742cf52101dc3247e6349e5a9be7bff2af239bd5eca5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: semql_prompt-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 26.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for semql_prompt-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 254e974fb539443c25f40224fc97396f5496aad5a42d0e9c8aabbc99d8e733f6
MD5 cf48ba2de3eceb86715bdd91e80ce1ed
BLAKE2b-256 b5f01d568ec439e544fe32ec22b1e2ec90cd51e209ee5cf2d39f3b95d6ac9577

See more details on using hashes here.

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