How Should Foundry Chat Playground Explain Code at Lowest Cost?
In Microsoft Foundry, you use the Chat playground with the GPT-35 Turbo model. You have a prompt that contains the following code. function F(n) { var f = [0, 1]; for (var i = 2; i < n; i++) f[i] = f[i-1] + f[i-2]; return f; } You need the model to create an explanation of the code. The solution must minimize costs. What should you do?
Community Insight
The question tests cost-aware prompt design in the Foundry Chat playground; the trap is assuming a larger model or a higher temperature is needed to get a code explanation.
This AI-103 scenario tests how to ask the Foundry Chat playground to explain JavaScript code while minimizing token spend. The correct approach is a brief in-prompt comment that directs GPT-35 Turbo without upgrading the model or changing sampling settings.
A common mistake is choosing GPT-4-32k for a simple code explanation, which increases cost without improving the minimal requirement, while temperature changes do not supply the missing instruction.
Community Discussion (1 comments)
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
Expert Analysis
Why the Answer Is Correct
Option A adds a short, direct instruction in the form of a code comment:// what does function F do?. In the Foundry Chat playground, GPT-35 Turbo can read that comment alongside the JavaScript and produce an explanation of the Fibonacci-style loop without any model change. Because the requirement explicitly says to minimize costs, a few extra input tokens are much cheaper than moving to a larger model or expanding the prompt. The comment also matches the code context naturally, so the model is unlikely to need extra examples or system instructions. This makes A the simplest cost-aware prompt modification.Why the Other Options Are Wrong
Setting temperature to 1 (B) changes sampling randomness; it does not tell the model what to explain, and it can make output less predictable without satisfying the task. Changing to GPT-4-32k (C) increases cost and context capacity that are unnecessary for explaining a trivial function. Addingfunction F(explanation) (D) is not a valid or clear instruction—it looks like malformed JavaScript and may confuse the model rather than ask for an explanation. None of B, C, or D addresses the missing instruction as cheaply as A.Community Comment Notes
Srikantha’s comment supports A, stating that appending "// what does function F do?" directly instructs the model and keeps input tokens low. That aligns with the cost-minimization constraint and the behavior of GPT-35 Turbo in the Chat playground. The comment also correctly identifies the code as a Fibonacci sequence, reinforcing that the model only needs a nudge to explain it. No contrary evidence appears in the provided discussion.Exam Strategy
When a prompt-engineering question says “minimize costs,” compare the added token cost against the benefit of a model upgrade. A short, explicit instruction in the existing model is usually the cheapest correct path unless the task genuinely needs larger context or stronger reasoning.
Frequently Asked Questions
Why does adding a comment to the Foundry Chat playground prompt reduce cost?
It adds only a few input tokens and gives GPT-35 Turbo a direct instruction, so you avoid a larger model or a longer engineered prompt.
Does GPT-4-32k improve a simple code explanation enough to justify its cost?
No. GPT-4-32k costs more and its larger context is unnecessary for explaining a short Fibonacci function; GPT-35 Turbo is sufficient here.
Related Analysis
Practice All AI-103 Questions
Access 88 questions with complete answers and detailed explanations.
View Full AI-103 Practice Test →