Skip to content

Commit df9a11b

Browse files
authored
Merge pull request #1 from agentic-dev-io/copilot/refactor-creative-coding-structure
Refactor structure for creative coding using bpy 5.x and Unreal 5.7
2 parents fef15b6 + a631f8e commit df9a11b

8 files changed

Lines changed: 85 additions & 4 deletions

File tree

data-recipe/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,22 @@ Output format (question JSONL, one per line):
9191
{"config_index": 123, "question": "Problem statement ...", "style": "codeforces", "stage1_analysis": {...}, "stage2_output": {...}}
9292
```
9393

94+
#### Creative-Coding Feature Generation
95+
96+
Creative-coding feature sets live in `question_generation/features_trees_data/creative`:
97+
- `blender_bpy_5.jsonl`
98+
- `unreal_engine_5_7.jsonl`
99+
- `comfyui_n8n.jsonl`
100+
- `duckdb_surrealdb.jsonl`
101+
102+
Force the creative template with `--template-style creative` and point `--features-file` to a creative set:
103+
```bash
104+
python scripts/generate_questions.py --features-file features_trees_data/creative/blender_bpy_5.jsonl --start 0 --end 100 --output ../output/questions_blender.jsonl --batch-size 64 --template-style creative
105+
python scripts/generate_questions.py --features-file features_trees_data/creative/unreal_engine_5_7.jsonl --start 0 --end 100 --output ../output/questions_unreal.jsonl --batch-size 64 --template-style creative
106+
python scripts/generate_questions.py --features-file features_trees_data/creative/comfyui_n8n.jsonl --start 0 --end 100 --output ../output/questions_comfyui.jsonl --batch-size 64 --template-style creative
107+
python scripts/generate_questions.py --features-file features_trees_data/creative/duckdb_surrealdb.jsonl --start 0 --end 100 --output ../output/questions_duckdb.jsonl --batch-size 64 --template-style creative
108+
```
109+
94110
### 2) Answer Generation
95111

96112
Start the SGLang server + run batch/concurrent examples:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"features":{"blender bpy 5.x":{"scene and context":["bpy.context","bpy.data.scenes","view layers","depsgraph","active object","workspace","scene unit settings","context override","render layers","scene frame range"],"data blocks and collections":["object datablocks","mesh datablocks","material datablocks","image datablocks","collection instances","bpy.data.collections","library linking","library overrides","asset browser","custom ID properties"],"mesh modeling":["mesh.from_pydata","bmesh.new","bmesh.ops.extrude_face_region","bmesh.ops.subdivide_edges","bmesh.ops.bridge_loops","bmesh.ops.spin","edge crease","vertex groups","bevel modifier","loop cut"],"geometry nodes and modifiers":["Geometry Nodes","node groups","fields","attribute domain","modifier stack","array modifier","subdivision surface","boolean modifier","solidify modifier","curve modifier"],"materials and shading":["Shader Nodes","Principled BSDF","Material Output","Texture Coordinate","Image Texture","ColorRamp","Normal Map","UV Map node","Emission shader","Shader Editor"],"animation and rigging":["keyframes","F-curves","NLA tracks","drivers","armature bones","constraints","IK constraints","action strips","pose mode","shape keys"],"rendering and compositing":["Cycles","EEVEE Next","render settings","samples","denoise","Compositor nodes","view layers","AOV passes","film settings","output properties"],"io and assets":["glTF 2.0 export","USD export","FBX export","Alembic export","OBJ export","asset library","append/link","linked libraries","library overrides","file browser"],"addon scripting":["operators","panels","menus","handlers","timers","UI layout","property groups","addon registration","keymaps","bpy.app"]}},"mandatory_features":[],"idx":0,"leaf_count":90}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"features":{"generative workflows":{"comfyui":{"core nodes":["CheckpointLoader","CLIPTextEncode","VAEEncode","KSampler","VAEDecode","EmptyLatentImage","LoadImage","SaveImage"],"conditioning":["ControlNet","LoRA","IP-Adapter","T2I Adapter","positive prompt","negative prompt","conditioning combine","prompt schedule"],"image pipeline":["img2img","inpaint","latent upscale","latent composite","mask processing","sampler scheduling","CFG scale","seed control"],"workflow assets":["workflow JSON","custom nodes","node groups","seed management","batch processing","model paths","queue execution","API websocket"],"model formats":["safetensors","diffusers","SDXL checkpoints","VAE models","LoRAs","ControlNet models","CLIP vision","UNet"]},"n8n":{"triggers":["Webhook","Cron","Schedule","Interval","Manual Trigger","Poll","Queue","Error Trigger"],"workflow nodes":["HTTP Request","Code","Set","Split In Batches","Merge","IF","Switch","Wait"],"integrations":["Slack","Discord","GitHub","S3","Postgres","OpenAI","Google Sheets","Notion"],"data handling":["JSON transform","binary data","credentials","environment variables","expressions","data pinning","item lists","file storage"],"execution":["queue mode","retry policies","error workflows","versioning","webhook responses","concurrency","workflow sharing","execution log"]}}},"mandatory_features":[],"idx":0,"leaf_count":80}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"features":{"data engines":{"duckdb":{"ingestion":["read_parquet","read_csv","read_json","httpfs","delta","iceberg","parquet_scan","csv_auto"],"sql analytics":["window functions","CTEs","pivot","approx_count_distinct","list/struct types","asof joins","unpivot","grouping sets"],"performance":["vectorized execution","memory limit","spilling to disk","profiling","pragma settings","parallel execution","optimizer","EXPLAIN"],"integrations":["Python API","sqlite_scanner","postgres_scanner","duckdb extensions","Arrow","Polars","Pandas","R"],"storage":["persistent database files","temporary tables","parquet export","COPY TO","metadata views","ATTACH","CREATE TABLE AS","VACUUM"]},"surrealdb":{"data model":["documents","graph relations","record links","schemafull","schemaless","table definitions","edge tables","record ids"],"surrealql":["SELECT","INSERT","UPDATE","RELATE","LIVE SELECT","LET","functions","FOR","GROUP BY"],"auth and security":["root/namespace/database auth","scopes","token expiration","permissions","roles","session variables","ACCESS","AUTHENTICATE"],"realtime":["live queries","change feeds","websocket protocol","live notifications","events","LIVE SELECT","live updates","watch"],"storage and deployment":["memory","RocksDB","SurrealDB Cloud","backup/restore","replication","distributed mode","surrealdb start","surrealdb import"],"api clients":["HTTP API","WebSocket API","Python SDK","JavaScript SDK","Rust SDK","CLI","gRPC","GraphQL"]}}},"mandatory_features":[],"idx":0,"leaf_count":89}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"features":{"unreal engine 5.7":{"python editor scripting":["unreal.EditorAssetLibrary","unreal.AssetToolsHelpers","unreal.EditorUtilitySubsystem","unreal.LevelEditorSubsystem","unreal.EditorLevelLibrary","unreal.MoviePipelineQueueSubsystem","unreal.ControlRigBlueprint","unreal.BlueprintFactory","unreal.EditorFilterLibrary","unreal.ScopedEditorTransaction"],"c++ gameplay framework":["UCLASS","USTRUCT","UENUM","UPROPERTY","UFUNCTION","AActor","APawn","ACharacter","UActorComponent","UWorld","UGameInstance","UBlueprintFunctionLibrary"],"asset pipeline":["Asset Registry","PrimaryAssetId","Data Assets","Static Mesh import","Skeletal Mesh import","Material Instances","Nanite settings","LOD settings","Texture streaming","Derived Data Cache"],"world building":["World Partition","Level Instances","Landscape","Data Layers","Hierarchical Instanced Static Mesh","Procedural Content Generation (PCG)","One File Per Actor","Level Streaming Volumes","Runtime Virtual Textures","Foliage"],"rendering and fx":["Lumen","Nanite","Niagara","Virtual Shadow Maps","Post Process Volume","Temporal Super Resolution","Path Tracer","Deferred rendering","Material Editor","Substrate"],"sequencing and cinematic":["Level Sequence","Movie Render Queue","Cinematic Camera Actor","Control Rig","Sequencer tracks","Take Recorder","Camera cuts","Shot tracks"],"build system and plugins":["ModuleRules","Build.cs","Target.cs","Unreal Build Tool",".uplugin descriptors",".uproject settings","plugin loading phases","editor-only modules"],"runtime systems":["Enhanced Input","Gameplay Ability System","Replication","AI Behavior Tree","NavMesh","Chaos physics","Physics substepping","Mass Entity"]}},"mandatory_features":[],"idx":0,"leaf_count":76}

data-recipe/question_generation/question_gen_template/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88
from .codeforces_question_gen import STAGE2_PROMPT_TEMPLATE as CODEFORCES_TEMPLATE
99
from .leetcode_question_gen import STAGE2_PROMPT_TEMPLATE as LEETCODE_TEMPLATE
1010
from .atcoder_question_gen import STAGE2_PROMPT_TEMPLATE as ATCODER_TEMPLATE
11+
from .creative_coding_question_gen import STAGE2_PROMPT_TEMPLATE as CREATIVE_CODING_TEMPLATE
1112

1213
__all__ = [
1314
'STAGE1_PROMPT_TEMPLATE',
1415
'CODEFORCES_TEMPLATE',
1516
'LEETCODE_TEMPLATE',
16-
'ATCODER_TEMPLATE'
17-
]
17+
'ATCODER_TEMPLATE',
18+
'CREATIVE_CODING_TEMPLATE'
19+
]
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
"""
2+
Stage 2 Prompt Template for Creative Coding Question Generation
3+
"""
4+
5+
REQUIRED_TOOL_CONTEXTS = [
6+
"Blender",
7+
"Unreal",
8+
"ComfyUI",
9+
"n8n",
10+
"DuckDB",
11+
"SurrealDB",
12+
]
13+
14+
STAGE2_PROMPT_TEMPLATE = f"""You are an expert creative coding challenge designer.
15+
16+
You have been provided with:
17+
- selected_features_tree: a tree structure in which each leaf contains a 'feature' name and its 'potential_use'.
18+
- integration_strategy: a strategy describing how these features should be integrated into a single, high-quality creative coding task.
19+
20+
Your task is to generate a complete creative coding problem statement that integrates **all** selected features.
21+
22+
Requirements:
23+
- Write in a concise, neutral, and precise style for creative coding tasks.
24+
- Define a single, well-scoped creative output to produce (visual, audio, procedural, data-driven, or automation), described in plain language.
25+
- If selected_features_tree includes any of the following tools or contexts (case-insensitive): {", ".join(REQUIRED_TOOL_CONTEXTS)}, you MUST explicitly mention each present tool/context in the task description and make it essential to the task.
26+
- Do **not** use any algorithm names, data structure names, implementation hints, or solution strategies. Avoid words like "DFS", "BFS", "dynamic programming", "recursion", "greedy", or similar anywhere.
27+
- Provide clear Input and Output sections with plain-language descriptions.
28+
- Always include at least two distinct examples using "Example 1:" and "Example 2:" with "Input:" and "Output:" lines.
29+
- Include a Constraints section listing parameter bounds or limits, each on its own line.
30+
- Do not include any commentary, hints, or explanations beyond the required sections.
31+
- Output a **single JSON object** with the field "question" only.
32+
33+
**Output Format (strict):**
34+
{{
35+
"question": "<Title>\n\n<Problem description.>\n\nInput:\n<...>\n\nOutput:\n<...>\n\nExample 1:\nInput: <...>\nOutput: <...>\n\nExample 2:\nInput: <...>\nOutput: <...>\n\nConstraints:\n<...>"
36+
}}
37+
38+
---
39+
40+
Inputs:
41+
- selected_features_tree (JSON):
42+
{{selected_features_info}}
43+
44+
- integration_strategy (string):
45+
{{integration_strategy}}
46+
47+
Instructions:
48+
- Output ONLY the required JSON object, no extra text.
49+
- Ensure every selected feature is essential and reflected in the task.
50+
- Use plain English only; no algorithm names or implementation hints.
51+
"""

data-recipe/question_generation/scripts/generate_questions.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,20 @@
2222
if str(_TEMPLATE_DIR) not in sys.path:
2323
sys.path.insert(0, str(_TEMPLATE_DIR))
2424

25-
from question_gen_template import ATCODER_TEMPLATE, CODEFORCES_TEMPLATE, LEETCODE_TEMPLATE
25+
from question_gen_template import (
26+
ATCODER_TEMPLATE,
27+
CODEFORCES_TEMPLATE,
28+
CREATIVE_CODING_TEMPLATE,
29+
LEETCODE_TEMPLATE,
30+
)
2631
from question_gen_template.select_feature import STAGE1_PROMPT_TEMPLATE
2732

2833
# Question generation templates with their names
2934
QUESTION_TEMPLATES = {
3035
"codeforces": CODEFORCES_TEMPLATE,
3136
"leetcode": LEETCODE_TEMPLATE,
3237
"atcoder": ATCODER_TEMPLATE,
38+
"creative": CREATIVE_CODING_TEMPLATE,
3339
}
3440

3541

@@ -246,7 +252,9 @@ def __init__(
246252
template_weights: Optional[List[float]] = None,
247253
) -> None:
248254
self.batch_client = batch_client
249-
self.template_weights = template_weights or [0.7, 0.15, 0.15]
255+
self.template_weights = template_weights or [0.6, 0.15, 0.15, 0.1]
256+
if len(self.template_weights) != len(QUESTION_TEMPLATES):
257+
self.template_weights = [1.0 / len(QUESTION_TEMPLATES)] * len(QUESTION_TEMPLATES)
250258

251259
# --- JSON cleaning helpers (ported from the original Azure version) ---
252260
def clean_json_response(self, response_text: str) -> Optional[str]:

0 commit comments

Comments
 (0)