# Quiz — Session 5: Tools & Tool Calling

**Program:** Applied AI — Intermediate Level — Instructor: Yann Isola
**Format:** 10 MCQs (multiple choice questionnaire) — only one correct answer per question — recommended duration: 8 minutes.

---

**Q1. What is the fundamental difference between RAG (Retrieval-Augmented Generation) and tools?**

- A. RAG is faster than tools
- B. The RAG allows the model to read documents; the tools allow it to act and read living systems (databases, API, calendars)
- C. Tools replace RAG in modern systems
- D. The RAG works offline, the tools require Internet

**Q2. When a model “calls a tool”, what actually happens?**

- A. The model directly executes the tool code on the server
- B. The model connects to the relevant API with its own credentials
- C. The model issues a structured query (block `tool_use`); it's your code that executes the actual call with your permissions, validation and logging
- D. The model provider (Anthropic, OpenAI, etc.) executes the call in its cloud

**Q3. Why do we say that “tool descriptions are prompts”?**

- A. Because they must be written in English
- B. Because the model chooses which tool to use by reading the descriptions: a vague description causes bad routing
- C. Because they replace the system message
- D. Because they are billed at the same rate as prompts

**Q4. What are the three elements of a tool definition?**

- A. `name`, `description`, `input_schema` (in JSON Schema format)
- B. `url`, `api_key`, `timeout`
- C. `nom`, `code_source`, `permissions`
- D. `prompt`, `temperature`, `max_tokens`

**Q5. What does the `tool_choice: "any"` parameter do?**

- A. It leaves the model free to use a tool or respond directly
- B. It forces the model to use a specific tool, designated by its name
- C. It forces the model to use at least one of the available tools (useful for structured extraction), without imposing which one
- D. It deactivates all tools

**Q6. In the tool_use loop, what is the `tool_use_id` field of the `tool_result` block used for?**

- A. To authenticate the user to the API
- B. To match each result with the corresponding tool request — essential especially when the model requires several tools in parallel
- C. To encrypt the content of the result
- D. Indicate the version of the tool used

**Q7. Weather API is down. What is the RIGHT way to report this to the model?**

- A. Resend `"OK"` so as not to disrupt the conversation
- B. Do not return anything and cut off the conversation
- C. Return a `tool_result` with `is_error: true` and a descriptive message, so that the model can correct itself or honestly inform the user (graceful degradation)
- D. Retry silently indefinitely until the API responds

**Q8. What is the risk of returning `"OK"` to the model when the tool has failed?**

- A. Nothing, the model automatically detects faults
- B. A JSON syntax error
- C. The model, believing it has a valid result, risks inventing a plausible answer: a hallucination caused by your code
- D. The conversation is automatically interrupted by the API

**Q9. A consultation agent must only READ customer files.According to the principle of least privilege, what tools do you expose to him?**

- A. `chercher_client` only (read only, restricted scope)
- B. `chercher_client` + `modifier_client` + `supprimer_client`, “just in case”
- C. A generic tool `executer_sql` which accepts any SQL (Structured Query Language) query
- D. All the company's tools, to maximize its autonomy

**Q10. Among these tool definitions, which one respects good practices (“a tool does one thing, clear name, documented borderline cases”)?**

- A. `name: "outil1"`, `description: "Fait des trucs avec les données."`
- B. `name: "gestion"`, `description: "Gère la météo, les clients, les calculs et les e-mails."`
- C. `name: "obtenir_meteo"`, `description: "Obtient la météo actuelle pour une ville donnée. Ne pas utiliser pour des moyennes historiques. Retourne température en Celsius et conditions. Si la ville est ambiguë, préciser le pays."`
- D. `name: "obtenir_meteo"`, `description: "Météo. Clé API : sk-prod-42abc."`

---

## Correction grid

| Question | Answer | Short justification |
|---|---|---|
| Q1 | **B** | RAG = read documents; tools = act + read living systems. They are complementary, not competitive. |
| Q2 | **C** | The fundamental principle: the model never executes anything, it issues a structured request; your code executes. It's the architecture AND the security model. |
| Q3 | **B** | Routing between tools is done by reading the descriptions: they must say what, when, when not, and borderline cases. |
| Q4 | **A** | Canonical structure: name, description, input schema in JSON Schema. |
| Q5 | **C** | `auto` = free; `any` = at least one mandatory tool; named tool = specific tool imposed. |
| Q6 | **B** | The `id` is the breadcrumb that pairs `tool_use` and `tool_result`, mostly in parallel. |
| Q7 | **C** | `is_error: true` + rich message = model can catch up or degrade gracefully. |
| Q8 | **C** | A false “OK” deprives the model of information: it fills the void with a plausible invention — a hallucination caused by the code. |
| Q9 | **A** | Least privilege: read-only, minimum scope. Every unexposed tool = an impossible incident category. |
| Q10 | **C** | A tool, a clear name, when to use it/not to use it, documented feedback, borderline case (ambiguity). D contains a secret in the description: serious fault. |

**Recommended scale:** 1 point per question. ≥ 8/10: acquired. 6–7/10: review the tool_use loop (slides 17–21). ≤ 5/10: review the session, in particular the fundamental principle (Part B) before Session 6 on agents.

---

*End of quiz — Session 5.*