AxMeep_generate_code
Generate a Meep FDTD simulation script from a natural-language problem description. Returns runnable Python and an explanation; pass a previous error trace to patch failed runs.
Instructions
Generate a complete Meep FDTD simulation script from a natural-language problem description. Returns runnable Python and an explanation of the approach; it does NOT execute anything — run it with execute_code. The script imports meep and calls export(name, obj) for each result. If a run failed, pass previous_code and the error_trace as previous_error so the generator patches that specific failure instead of starting over. Naming the results you want in the description produces better scripts — and ask for any scalar results to be printed as well as exported, since a plain Python float comes back as an opaque pickle while printed values arrive in console_output.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| previous_code | No | The exact script from a prior failed run, if retrying, so the generator can patch it instead of starting over. | |
| previous_error | No | The error_trace reported by get_simulation_status for that failed run, if retrying. | |
| problem_description | Yes | Natural-language description of the simulation to build: geometry, materials, source, resolution, run time, and — importantly — which results to export and under what names (e.g. "export the transmission spectrum as 'transmission'"). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | The generated meep script; pass it to execute_code. | |
| error | No | ||
| error_type | No | 'generation_error' (retry once) or 'iteration_limit' (narrow the description). | |
| explanation | No |