How It Works
- Your tests write rules to
tmp/mock_openai_state.jsonviaMockOpenAI.set_responses - The mock server reads this file on every request (stateless)
- It extracts the last user message from the request body
- It finds the first matching rule (exact → regex → substring)
- It applies the rule: failure mode, static response, or template
- If no rule matches, it returns the configured default response
The server stores no internal state. All behavior is driven by the shared state file, making tests fully deterministic and isolated.