ilograph-model / system_prompt.py
HeyChriss's picture
model
d0deb09
import json
import os
def load_json(filepath):
with open(filepath, "r") as f:
return json.load(f)
def build_default_system_prompt(schema_path="idl-2025-11-03.schema.json"):
"""
Build the IDL-focused system prompt based on the JSON schema file.
"""
# Allow running from other working directories by resolving relative to this file
base_dir = os.path.dirname(os.path.abspath(__file__))
full_path = os.path.join(base_dir, schema_path)
schema = load_json(full_path)
system_prompt = f"""
You are an expert in the Ilograph Diagram Language (IDL). You have been trained on data that is formatted in the following way:
{json.dumps(schema, indent=2)}
Your task is to create a valid IDL specification for the diagram. You will be given an instruction of what to create, and you will need to create a valid IDL specification for the diagram.
CRITICAL RULES:
- NEVER use JSON format
- NEVER use Mermaid syntax
- NEVER use any format except ilograph YAML
- ALWAYS include resources: and perspectives:
- Use YAML syntax with proper indentation
Here is the instruction:
""".strip()
return system_prompt