QVAC Logo

invokePlugin( )

Invoke a non-streaming plugin handler.

function invokePlugin<TResponse = unknown, TParams = unknown>(
  options: InvokePluginOptions<TParams>
): Promise<TResponse>;

Parameters

NameTypeRequired?Description
optionsInvokePluginOptionsThe invocation options

InvokePluginOptions

FieldTypeRequired?Description
modelIdstringThe model ID of the loaded plugin model
handlerstringThe handler name to invoke (as defined in the plugin)
paramsTParamsParameters to pass to the handler (validated against the handler's requestSchema)

Returns

Promise<TResponse> — The handler's response (validated against the handler's responseSchema).

Throws

ErrorWhen
INVALID_RESPONSE_TYPEResponse type does not match expected "pluginInvoke"

Example

const result = await invokePlugin<{ answer: string }>({
  modelId: "my-custom-model",
  handler: "summarize",
  params: { text: "Long document..." },
});
console.log(result.answer);

On this page