How Should Foundry Chat Playground Explain Code at Lowest Cost?

AI-103 By islever Editorial Last updated

Short answer

A Add the comment // what does function F do? to the Chat playground prompt so GPT-35 Turbo explains the code with minimal extra tokens.

Question

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?
  1. Add // what does function F do? to the prompt. Correct Answer
  2. Set the temperature parameter to 1.
  3. Change the model to GPT-4-32k.
  4. Add function F(explanation) to the prompt.

Key Takeaways

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.

Common mistake: 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.

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. Adding function 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.

More AI-103 FAQ →

Discussion 1 contributions

Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.

From public community threads 1

  1. Srikantha 👍 1 Answered A
    The correct choice is A. Add // what does function F do? to the prompt. Key Reasons Direct Prompting via Code Comments: Appending // what does function F do? clearly instructs the model to explain the functionality of the JavaScript code (which generates a Fibonacci sequence) directly within the code context. Minimizes Token Costs: Adding a short comment requires very few input tokens and keeps the workload on GPT-35-Turbo, which is significantly less expensive per token than larger models like GPT-4.

Reader comments & corrections

No reader corrections yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Practice All AI-103 Questions

Access 88 questions with complete answers and detailed explanations.

View Full AI-103 Practice Test →

← Back to AI-103 Study Guide