Spaces:
Build error
Build error
File size: 800 Bytes
94c52e3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | from .llm_client import generate_with_hf, generate_with_openai
def synthesize_cpp(parsed: dict, mapping: dict, backend: str = "hf", prompt_context: str = "") -> str:
"""
Converts Unity C# parsed structure into Unreal Engine C++ (header + source).
"""
prompt = f"""
Translate the following Unity C# class to idiomatic Unreal Engine C++ (header and source).
Mapping rules: {mapping}
Parsed structure: {parsed}
Generate two files separated with markers:
---FILE: MyActor.h---
[contents]
---FILE: MyActor.cpp---
[contents]
Be concise, compile-ready, and use UPROPERTY/UFUNCTION macros where suitable.
{prompt_context}
"""
if backend == "hf":
return generate_with_hf(prompt)
else:
return generate_with_openai(prompt)
|