Guide
Ask a business question
Discover an accessible source and ask Permute a business question. The SDK waits for the durable analysis automatically.
Workflow
- 1List accessible sources
- 2Start an answer job
- 3Poll the job
- 4Use the completed answer
Complete example
import { PermuteClient } from '@permute/sdk';
const orgClient = new PermuteClient({
apiKey: process.env.PERMUTE_API_KEY!,
});
const client = orgClient.withWorkspace(process.env.PERMUTE_WORKSPACE_ID!);
const sources = await client.sources.list();
const sourceId = sources.items[0].id;
const answer = await client.answer({
question: 'What changed in revenue this quarter?',
sourceIds: [sourceId],
});
console.log(answer);