Skip to main content

MockAIProvider

@webda/mock


Class: MockAIProvider

Defined in: ai/provider.ts:15

Deterministic fake provider for unit tests.

Implements​

Constructors​

Constructor​

new MockAIProvider(opts?): MockAIProvider

Defined in: ai/provider.ts:22

Parameters​

opts?​

construction options.

canned?​

string[]

canned responses returned in order (last repeats if exhausted). When omitted, complete() echoes the prompt back.

Returns​

MockAIProvider

Methods​

complete()​

complete(prompt): Promise<string>

Defined in: ai/provider.ts:30

Return the next canned answer, or the prompt itself when none were given.

Parameters​

prompt​

string

the input text.

Returns​

Promise<string>

the next canned answer, or the prompt echoed back.

Implementation of​

AIProvider.complete