> ## Documentation Index
> Fetch the complete documentation index at: https://docs-v1.latitude.so/llms.txt
> Use this file to discover all available pages before exploring further.

# Mocking

> Simulate assistant and tool responses in PromptL for testing and advanced development

## Overview

PromptL enables you to craft a controlled interaction history so that the model can be conditioned on arbitrary prior outputs. In advanced usage, there are two principle mechanisms of interest:

1. **Mocking Roles**\
   Pretend that the assistant has already replied with specified content.
2. **Mocking Tool Calls**\
   Emulate a tool invocation and its response so that PromptL sees it as if a real tool were executed.

***

## 1. Mocking Roles

Mocking a role means inserting an assistant response directly into the prompt. The model will behave as though this response actually occurred. This is useful when you want to:

* Seed the conversation with example assistant behavior
* Use few-shot prompting techniques
* Test how the model continues from a predetermined reply

### Syntax

Wrap the desired assistant reply between `<assistant>` tags:

```xml theme={null}
<user>
Good morning!
</user>

<assistant>
Hello, I’m your weather assistant. How can I help you today?
</assistant>
```

<Warning>
  Some models do not allow assistant messages as the last item.
</Warning>

## 2. Mocking Tool Calls

Mocking a tool call allows you to simulate both the *invocation* of an external function and its *response*—as if the model had called a real tool and received structured output. This gives you fine-grained control over how the model interprets prior tool usage and is especially useful in logic-heavy prompt flows that rely on external data.

### When to Use

* **Testing prompt branches** that depend on tool results
* **Simulating APIs** without triggering real network requests
* **Validating error-handling logic** by crafting edge-case tool responses

### Syntax

A mocked tool call consists of two components:

1. A `<tool-call />` element inside an `<assistant>` block, which mimics the model making a function call.
2. A corresponding `<tool>` block with the same `id` and `name`, which contains the tool’s response.

```xml theme={null}
<assistant>
  <tool-call id="123" name="get-weather" arguments={{ { location: "Barcelona" } }} />
</assistant>

<tool id="123" name="get_weather">
  It's 17 °C in Barcelona.
</tool>
```
