Skip to content
Discussion options

You must be logged in to vote

Codex sometimes truncates structured outputs because the model optimizes for semantic correctness, not syntactic completeness.

To fix this:

  1. Use strict scaffolding prompts
    Convert this Python code to C++.
    Output must include:

    • Full headers
    • Namespace
    • Complete class/function definitions
    • No TODOs, no ellipses
    • Fully compilable code
  2. Set max_tokens high enough Large translations require 600–1200 output tokens.

  3. Use multi-step prompting
    First: “Generate C++ header only.”
    Second: “Generate C++ implementation only.”

  4. Enable temperature = 0 for deterministic structure.

This guarantees 95–100% compilable output.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by O1Legend
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants