Basic Requests
Learn how to make basic requests.
To interact with the Secton API, instantiate the client and use the ask()
method for a single query:
import { createClient } from 'secton';
const client = createClient({ apiKey: 'your-api-key' });
const response = await client.ask('What is the capital of France?');
console.log(response);
For multi-turn conversations, utilize the chat()
method:
const response = await client.chat([
{ role: 'user', content: 'Tell me a joke.' }
]);
console.log(response);
These methods are suitable for straightforward interactions without the need for context management.
Last updated
Was this helpful?