Write an LLM Prompt to Extract Transaction Details From Customer Email Threads

Quick Overview

A prompt-writing task that asks for an LLM prompt extracting a customer's name, transaction amount, card last four digits and transaction date from support emails and threads, output as one comma-separated line with dates in YYYY-MM-DD. It tests precise field definitions, thread handling and strict output formatting.

Write an LLM Prompt to Extract Transaction Details From Customer Email Threads

Company: BNY Mellon

Role: Software Engineer

Category: Machine Learning

Difficulty: easy

Interview Round: Online Assessment

One question in the assessment asks you to write a prompt for a language model instead of code. Each test case is a customer email, and your prompt must make the model extract four fields: the customer's name, the transaction amount, the last four digits of the credit card, and the transaction date. The model must output them as a single comma-separated line, with the date normalized to `YYYY-MM-DD`. The editor contains the placeholder `{testcase input}`, which is replaced by each test's email, and it must stay in your prompt. Some inputs are whole email threads: the information is spread across the customer's original message and later replies, so the model has to combine it, and it has to tell the customer's name apart from the support agent's name. Write the prompt and explain your design choices. ```hint Read a thread as a person would Think about which message in a thread each field is most likely to come from, and what in the text tells the customer and the agent apart. ``` ```hint The grader reads one line Picture a test comparing your output with an expected line. What extra words, characters or formats would make an otherwise correct extraction fail? ``` ### Clarifying Questions - In what order must the four fields appear, and should the amount keep a currency symbol, thousands separators or a fixed number of decimals? - What should the line contain when a field is missing from the email? - How should an ambiguous numeric date such as `03/04` be read, and which year applies when the email omits it? - If a later reply corrects an earlier value, such as the amount, which value wins? - Is the output compared exactly as a string, or parsed field by field? ### What a Strong Answer Covers - A precise definition of each field, including which name counts as the customer's - Rules for combining the original email and replies, including corrections - A strict output format: one line, a fixed field order, no extra text, date normalization, and an amount format that cannot break the comma-separated line - Handling of missing or ambiguous values stated in the prompt itself - The `{testcase input}` placeholder kept exactly once and clearly delimited, with a short worked example in the prompt - A plan for checking the prompt against the provided test cases and fixing failures ### Follow-up Questions - A test fails because the model wrote the agent's name. How would you change the prompt, and how would you make sure the change does not break other cases? - How would you make the output easy to validate automatically, and what would you do when the model's answer fails validation? - An email contains a full card number. How should the prompt and the surrounding code treat it? - When would you stop relying on the prompt alone and add code that post-processes the model's output?

Overview: A prompt-writing task that asks for an LLM prompt extracting a customer's name, transaction amount, card last four digits and transaction date from support emails and threads, output as one comma-separated line with dates in YYYY-MM-DD. It tests precise field definitions, thread handling and strict output formatting.

Read the full BNY Mellon Software Engineer interview experience this question came from

BNY Mellon logo
BNY Mellon
Oct 29, 2026
easySoftware EngineerOnline AssessmentMachine Learning
0
0

One question in the assessment asks you to write a prompt for a language model instead of code. Each test case is a customer email, and your prompt must make the model extract four fields: the customer's name, the transaction amount, the last four digits of the credit card, and the transaction date. The model must output them as a single comma-separated line, with the date normalized to YYYY-MM-DD.

The editor contains the placeholder {testcase input}, which is replaced by each test's email, and it must stay in your prompt. Some inputs are whole email threads: the information is spread across the customer's original message and later replies, so the model has to combine it, and it has to tell the customer's name apart from the support agent's name.

Write the prompt and explain your design choices.

Clarifying Questions Guidance

  • In what order must the four fields appear, and should the amount keep a currency symbol, thousands separators or a fixed number of decimals?
  • What should the line contain when a field is missing from the email?
  • How should an ambiguous numeric date such as 03/04 be read, and which year applies when the email omits it?
  • If a later reply corrects an earlier value, such as the amount, which value wins?
  • Is the output compared exactly as a string, or parsed field by field?

What a Strong Answer Covers Guidance

  • A precise definition of each field, including which name counts as the customer's
  • Rules for combining the original email and replies, including corrections
  • A strict output format: one line, a fixed field order, no extra text, date normalization, and an amount format that cannot break the comma-separated line
  • Handling of missing or ambiguous values stated in the prompt itself
  • The {testcase input} placeholder kept exactly once and clearly delimited, with a short worked example in the prompt
  • A plan for checking the prompt against the provided test cases and fixing failures

Follow-up Questions Guidance

  • A test fails because the model wrote the agent's name. How would you change the prompt, and how would you make sure the change does not break other cases?
  • How would you make the output easy to validate automatically, and what would you do when the model's answer fails validation?
  • An email contains a full card number. How should the prompt and the surrounding code treat it?
  • When would you stop relying on the prompt alone and add code that post-processes the model's output?