nerdexam
SAP

C_AIG_2412 · Question #67

You want to assign urgency and sentiment categories to a large number of customer emails. You want to get a valid json string output for creating custom applications. You decide to develop a prompt…

The correct answer is B. Evaluate the performance of a language model using few-shot learning. Option B is correct because the code implements few-shot learning - it randomly samples k=3 examples from a development set, formats them, injects them into the prompt via {{?technique_examples}}, and then sends a real customer email to the model to evaluate whether it…

Prompt Engineering

Question

You want to assign urgency and sentiment categories to a large number of customer emails. You want to get a valid json string output for creating custom applications. You decide to develop a prompt for the same using generative Al hub. What is the main purpose of the following code in this context? prompt_test = """Your task is to extract and categorize messages. Here are some examples:

{{?technique_examples}} Use the examples when extract and categorize the following message:

{{?input}} Extract and return a json with the following keys and values:

  • "urgency" as one of {{?urgency}}
  • "sentiment" as one of {{?sentiment}}

"categories" list of the best matching support category tags from:

{{?categories}} Your complete message should be a valid json string that can be read directly and only contains the keys mentioned int import random random.seed(42) k = 3 examples random. sample (dev_set, k) example_template = """<example> {example_input} examples '\n---\n'.join([example_template.format(example_input=example ["message"], example_output=json.dumps (example[ f_test = partial (send_request, prompt=prompt_test, technique_examples examples, **option_lists) response = f_test(input=mail["message"])

Options

  • AGenerate random examples for language model training
  • BEvaluate the performance of a language model using few-shot learning
  • CTrain a language model from scratch
  • DPreprocess a dataset for machine learning

How the community answered

(31 responses)
  • A
    6% (2)
  • B
    84% (26)
  • C
    6% (2)
  • D
    3% (1)

Explanation

Option B is correct because the code implements few-shot learning - it randomly samples k=3 examples from a development set, formats them, injects them into the prompt via {{?technique_examples}}, and then sends a real customer email to the model to evaluate whether it correctly outputs a valid JSON with urgency, sentiment, and category classifications. The f_test partial function and the response = f_test(input=mail["message"]) call confirm this is a testing/evaluation pipeline, not a training loop.

  • A is wrong - the examples are sampled from an existing dev set, not generated; and they are used as prompt context, not as training data.
  • C is wrong - no model weights are updated anywhere; generative AI hub prompting is purely inference-time, not training from scratch.
  • D is wrong - preprocessing would involve cleaning, tokenizing, or transforming a dataset for a training pipeline; here the data flows directly into a prompt template at inference time.

Memory tip: When you see random.sample(dev_set, k) feeding into a prompt template alongside a live inference call, think "k-shot = few-shot evaluation" - you're giving the model a handful of labeled examples to mimic, then judging its output.

Topics

#few-shot learning#prompt template#JSON output#email classification

Community Discussion

No community discussion yet for this question.

Full C_AIG_2412 Practice