API reference
testing
Import
Section titled “Import”import * as api from "@fungi.computer/mule/testing";Exports
Section titled “Exports”| Kind | Export | Description |
|---|---|---|
| type alias | FauxModelDefinition | Credential-free model definition for the scripted provider. |
| type alias | RegisterFauxProviderOptions | Scripted provider configuration, independent of provider SDK declarations. |
| type alias | FauxProviderState | Counters retained by the scripted provider. |
| type alias | FauxResponseFactory | Function that observes a model request and supplies a scripted reply. |
| type alias | FauxResponseStep | A scripted reply or a factory that observes the normalized request. |
| type alias | FauxModel | Deterministic model and stream with Pi’s observable response state. |
| function | fauxModel() | Create a credential-free model for tests and runnable examples. |
FauxModelDefinitiontype alias
Section titled “FauxModelDefinition”type FauxModelDefinition = object;Credential-free model definition for the scripted provider.
Properties
Section titled “Properties”id: string;optional name?: string;reasoning?
Section titled “reasoning?”optional reasoning?: boolean;input?
Section titled “input?”optional input?: ("text" | "image")[];inputLimits?
Section titled “inputLimits?”optional inputLimits?: Model<Api>["inputLimits"];optional cost?: object;input: number;output
Section titled “output”output: number;cacheRead
Section titled “cacheRead”cacheRead: number;cacheWrite
Section titled “cacheWrite”cacheWrite: number;contextWindow?
Section titled “contextWindow?”optional contextWindow?: number;maxTokens?
Section titled “maxTokens?”optional maxTokens?: number;RegisterFauxProviderOptionstype alias
Section titled “RegisterFauxProviderOptions”type RegisterFauxProviderOptions = object;Scripted provider configuration, independent of provider SDK declarations.
Properties
Section titled “Properties”optional api?: string;provider?
Section titled “provider?”optional provider?: string;models?
Section titled “models?”optional models?: FauxModelDefinition[];deferred?
Section titled “deferred?”optional deferred?: object;pendingFetches?
Section titled “pendingFetches?”optional pendingFetches?: number;pollAfterMs?
Section titled “pollAfterMs?”optional pollAfterMs?: number;tokensPerSecond?
Section titled “tokensPerSecond?”optional tokensPerSecond?: number;tokenSize?
Section titled “tokenSize?”optional tokenSize?: object;optional min?: number;optional max?: number;FauxProviderStatetype alias
Section titled “FauxProviderState”type FauxProviderState = object;Counters retained by the scripted provider.
Properties
Section titled “Properties”callCount
Section titled “callCount”callCount: number;deferredFetchCount
Section titled “deferredFetchCount”deferredFetchCount: number;cancelledDeferred
Section titled “cancelledDeferred”cancelledDeferred: NonNullable < AssistantMessage["deferred"] > [];FauxResponseFactorytype alias
Section titled “FauxResponseFactory”type FauxResponseFactory = ( context, options, state, model,) => AssistantMessage | Promise<AssistantMessage>;Function that observes a model request and supplies a scripted reply.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
context |
Context |
options |
Parameters<MuleStreamFunction>[2] |
state |
FauxProviderState |
model |
Model<Api> |
Returns
Section titled “Returns”| AssistantMessage |
Promise<AssistantMessage>
FauxResponseSteptype alias
Section titled “FauxResponseStep”type FauxResponseStep = AssistantMessage | FauxResponseFactory;A scripted reply or a factory that observes the normalized request.
FauxModeltype alias
Section titled “FauxModel”type FauxModel = Readonly<{ model: Model<Api>; stream: (...args) => AssistantMessageEventStream; retryable: (message) => boolean; setResponses: (replies) => void; state: FauxProviderState; getPendingResponseCount: () => number;}>;Deterministic model and stream with Pi’s observable response state.
fauxModel()function
Section titled “fauxModel()”function fauxModel(replies, options?): FauxModel;Create a credential-free model for tests and runnable examples.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
replies |
readonly FauxResponseStep[] |
options |
RegisterFauxProviderOptions |