26 lines
913 B
Python
26 lines
913 B
Python
from __future__ import annotations
|
|
|
|
import json
|
|
from typing import Any
|
|
|
|
from semantic.models import SEMANTIC_SCENE_SCHEMA
|
|
|
|
ENRICHMENT_SYSTEM_PROMPT = f"""You enrich a mobile device Scene into a SemanticScene.
|
|
|
|
Identify the current page in a short page string, list plain-language intents the
|
|
screen appears to support, and label the purpose of relevant widgets. Use only
|
|
element_id values that appear in the input Scene's elements[].id list; never invent
|
|
or rewrite element IDs. Prefer concise, stable labels over visual descriptions.
|
|
|
|
Return structured output matching this JSON schema exactly:
|
|
{json.dumps(SEMANTIC_SCENE_SCHEMA, sort_keys=True)}
|
|
"""
|
|
|
|
|
|
def scene_user_prompt(scene_json: dict[str, Any]) -> str:
|
|
return (
|
|
"Enrich this Scene. Widget labels must reference only element IDs present "
|
|
"in this JSON:\n"
|
|
f"{json.dumps(scene_json, ensure_ascii=False, sort_keys=True)}"
|
|
)
|