Simulate assistant and tool responses in PromptL for testing and advanced development
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:
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:
Wrap the desired assistant reply between <assistant>
tags:
Some models do not allow assistant messages as the last item.
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.
A mocked tool call consists of two components:
<tool-call />
element inside an <assistant>
block, which mimics the model making a function call.<tool>
block with the same id
and name
, which contains the tool’s response.