Skip to main content

opik-genui

Authoring data for Opik views. A view is HTML, CSS and script written by a model and rendered in a sandboxed iframe by the opik-genui npm package. This package gives a Python author the prompt to write a view and the constants to check it against.

pip install opik-genui

It has no dependencies. The version of this package is the Opik release it shipped with, and it always matches the npm package of the same version.

Usage

import opik_genui

system_prompt = "\n\n".join(
    [
        opik_genui.prompt("widget"),
        opik_genui.OUTPUT_SHAPE,
        opik_genui.QUERY_CONTRACT,
        opik_genui.CLICKHOUSE_SCHEMA,
    ]
)

view = {
    "type": "html",
    "engine_version": opik_genui.ENGINE_VERSION,
    "html": html,
    "inputs": {"rows": {"kind": "query", "query_id": query_id}},
    "libraries": ["vega"],
}
assert len(html) <= opik_genui.MAX_HTML_LENGTH
Name What it is
prompt(area) The authoring prompt for an area.
AREAS The places a view can be shown.
LIBRARIES The libraries a view may declare.
ENGINE_VERSION The HTML contract version a view written with this prompt targets.
MAX_HTML_LENGTH The size cap the Opik backend enforces on save.
MAX_VIEW_STATE_LENGTH, MAX_VIEW_STATE_KEYS, VIEW_STATE_MIN_INTERVAL_MS The limits a host enforces on the UI state a view saves through opikViewState: characters of JSON, top-level keys and the shortest interval between two writes.
TOKENS The --ov- token values for light and dark.
OUTPUT_SHAPE What an author returns with a view: the html, a one-line summary, the widget size in grid columns and rows, and the libraries.
OUTPUT_SCHEMA The same shape as a JSON Schema, for a tool or structured output.
SUMMARY_MAX_LENGTH The longest summary an author may return.
repair_prompt(html, error) The prompt to fix a view that failed to render, given its html and the error.
QUERY_CONTRACT The rules for the saved ClickHouse query behind a widget input: result shape, window placeholders, previous period, row limit, names and scope.
CLICKHOUSE_SCHEMA The tables and columns a widget query may read.
CLICKHOUSE_SCHEMA_CORE The part of it every workspace can read: the traces, spans and authored_feedback_scores tables, with the scoping, join, query, dialect and performance rules.
CLICKHOUSE_SCHEMA_EXTENDED The six other tables, readable where custom charts are on, with the dataset recipes and their performance rules. It follows the core part.
__version__ The package version.

Licence

Apache-2.0.

Metadata

Release files for opik-genui 2.4.1

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

Source distribution (sdist)

Source distribution for opik-genui 2.4.1
File Size Uploaded Provenance Actions
opik_genui-2.4.1.tar.gz 25.6 kB Without provenance Details for opik_genui-2.4.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for opik-genui 2.4.1
File Interpreter ABI Platform Actions
opik_genui-2.4.1-py3-none-any.whl Python 3 none any Details for opik_genui-2.4.1-py3-none-any.whl

Total release size: 53.8 kB

Release files / opik_genui-2.4.1.tar.gz

Download URL opik_genui-2.4.1.tar.gz
Size 25.6 kB
Tags Source
SHA-256 checksum
How to use checksums
60f77dd3adfefbfb858c0bd11fffefec9b6d88f550282641bf0369608fb3fea2
BLAKE2b-256 checksum
How to use checksums
3e541389835a8836025ecaecb1a4b6d8e76749f310b32aa4025ae48c76a0c544
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / opik_genui-2.4.1-py3-none-any.whl

Download URL opik_genui-2.4.1-py3-none-any.whl
Size 28.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
30dd61cf0432d092e81e2a91a44ae300cdfe916b62c862eaba6accb3e7a8009d
BLAKE2b-256 checksum
How to use checksums
8e6112e33e544c78fe205d2e082ca8637a7f2a937440840a0550443cf22ea04f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Security for opik-genui 2.4.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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