How to set the mock chat reply in tests (mock.chatResponse)
Pass mock: { chatResponse: 'Cooked rice should go in the fridge within two hours.' } to createKernelClient. In mock mode, client.chat returns that text as responseText. Passing mock turns on mock mode by itself.
Last updated
Steps
Set the reply
const client = createKernelClient({ mock: { chatResponse: 'Paris is the capital of France.' }, });Call chat in your test
const { responseText, verdict } = await client.chat({ message: 'Capital of France?' }); // responseText === 'Paris is the capital of France.'
Default
Without chatResponse, the mock reply is This is a mock model response.
The verdict
The mock verdict scores the reply text, not your message. It is a local test value and is never signed.