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.
{
baseUrl: 'https://model.invalid/v1',
apiKey: 'none',
model: 'written-here',
capabilities: {
nativeTools: true,
nativeJsonSchema: true,
toolsWithStructuredOutput: true,
},
}{
systemPrompt: 'You are the box office of a theatre in Vienna.',
}'Which nights does The Tempest play?'
{
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 },
}Runs in this page on the installed package. The input and the expected output are defined by the example.