Signal · API

createSignal

createSignal(provider, options) creates a signal, the client for one provider: a name from providerRegistry, or an endpoint as an object (baseUrl, apiKey, model, capabilities). The options set the same values as the methods, plus client, the object that requests are sent through. Example: a systemPrompt option, sent as the system message; the model’s reply is scripted and no model is called.

Provider
{
  baseUrl: 'https://model.invalid/v1',
  apiKey: 'none',
  model: 'written-here',
  capabilities: {
    nativeTools: true,
    nativeJsonSchema: true,
    toolsWithStructuredOutput: true,
  },
}
Options, client omitted
{
  systemPrompt: 'You are the box office of a theatre in Vienna.',
}
Prompt
'Which nights does The Tempest play?'
Request
{
  model: 'written-here',
  messages: [
    {
      role: 'system',
      content: 'You are the box office of a theatre in Vienna.',
    },
    {
      role: 'user',
      content: 'Which nights does The Tempest play?',
    },
  ],
  stream: true,
  stream_options: { include_usage: true },
}
Output matches the expected value

Runs in this page on the installed package. The input and the expected output are defined by the example.