KatInterview

Support Chatbot: Combining Doc Retrieval and Order Lookups

Machine LearningModel answer
MediumModel answerMachine Learningllm-agentsragtool-calling

Last updated

Design a shopping-support assistant that answers product questions from a document index and checks order data through safe, typed tools, covering routing, guardrails, sampling and evaluation.

Scenario

An online retailer wants a conversational support assistant built on a large language model. Customers will use it for two kinds of requests:

  1. Product questions (specs, compatibility, care instructions, return policy), answered from a searchable collection of product documents using retrieval-augmented generation.
  2. Order questions (status, tracking, history), answered by querying the company's internal relational order database.

Design the assistant end to end.

What to cover

  1. Routing. How does the assistant decide whether to search the documents, query the order database, or do both in one turn?
  2. Tool definitions. How would you describe the database-lookup capability to the model so that it calls it correctly and consistently? Sketch the argument schema and the tables behind it.
  3. Safety. How do you stop the assistant from taking actions it should not (for example deleting or altering orders), and from exposing personal data that may be present in the document collection?
  4. Sampling temperature. How does the temperature setting affect behavior in this use case, and what would you choose?
  5. Evaluation. How would you measure answer accuracy and the quality of tool usage?

Expected output

  • A walkthrough of the request path from the customer's message to the final reply.
  • A proposed interface or data model for the tools.
  • A short evaluation plan.
  • Trade-offs and failure modes you would watch for.

Hints

Hint 1

Treat document search as one more tool next to the order lookup, so the model picks among tools in a single decision, and mixed questions ("is the item I ordered last week dishwasher-safe?") can chain two calls.

Hint 2

Do not let the model write SQL or pass a user identifier. Expose narrow typed functions with enums, patterns and bounds, and let the server inject the authenticated user from the session.

Hint 3

Separate reading from writing: give the model read-only tools plus 'propose' actions that need out-of-band confirmation, and put business-rule checks in a policy layer outside the model.

Hint 4

For evaluation, score the tool choice, the arguments and the final grounded answer separately, using a labeled conversation set, then track the same signals online.