You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`userMessage`|`string`| Substring of last `role: "user"` message text |
25
+
|`userMessage`|`RegExp`| Pattern test on last `role: "user"` message text |
26
+
|`inputText`|`string`| Substring of embedding input text (concatenated if multiple inputs) |
27
+
|`inputText`|`RegExp`| Pattern test on embedding input text |
28
+
|`toolName`|`string`| Exact match on any tool in request's `tools[]` array (by `function.name`) |
29
+
|`toolCallId`|`string`| Exact match on `tool_call_id` of last `role: "tool"` message |
30
+
|`model`|`string`| Exact match on `req.model`|
31
+
|`model`|`RegExp`| Pattern test on `req.model`|
32
+
|`responseFormat`|`string`| Exact match on `req.response_format.type` (`"json_object"`, `"json_schema"`) |
33
+
|`sequenceIndex`|`number`| Matches only when this fixture's match count equals the given index (0-based) |
34
34
|`turnIndex`|`number`| Stateless conversation-depth matching. Counts `role: "assistant"` messages in the request; matches when that count equals the value. `turnIndex: 0` = first turn (no prior assistant messages). Use instead of `sequenceIndex` for shared/deployed instances where stateful counters break under concurrency |
35
-
|`hasToolResult`|`boolean`| Stateless tool-message presence matching. `true` matches when any `role: "tool"` message exists in the request; `false` matches when none exist. Provider-consistent across all aimock handlers (OpenAI, Claude, Gemini, Bedrock, Ollama, Cohere) |
|`predicate`|`(req: ChatCompletionRequest) => boolean`| Custom function — full access to request |
35
+
|`hasToolResult`|`boolean`| Stateless tool-message presence matching. `true` matches when any `role: "tool"` message exists in the request; `false` matches when none exist. Provider-consistent across all aimock handlers (OpenAI, Claude, Gemini, Bedrock, Ollama, Cohere) |
|`turnIndex`| Yes | Shared/deployed instances; matches on conversation depth (count of assistant messages in request)|
48
+
|`hasToolResult`| Yes | Simplest option for 2-step tool flows — boolean: are there tool results in the request?|
49
+
|`sequenceIndex`| No | Single-client unit tests with repeated identical requests (server-side counter, breaks under concurrency) |
50
+
|`toolCallId`| Yes | Matching specific tool result IDs in the conversation history|
51
51
52
52
**Prefer stateless approaches** (`turnIndex`, `hasToolResult`) for shared aimock instances (deployed via Docker, used by multiple test runners). Use `sequenceIndex` only in isolated single-client unit tests where the counter won't be corrupted by concurrent requests.
53
53
@@ -678,42 +678,42 @@ const mock = await LLMock.create({ port: 0 }); // creates + starts in one call
0 commit comments