import { DO } from '@do-inc/sdk';
// Initialize the .do client
const secret = process.env.DO_SECRET;
const digo = new DO({ secret });
// Define the source text and desired data structure
const sourceText = 'Contact John Doe at j.doe@example.com. He is the CEO of Acme Inc.';
interface ContactInfo {
name: string;
email: string;
company: string;
}
// Run the extraction agent
const extractedData = await digo
.agent('extract')
.run({
source: sourceText,
description: 'Extract the full name, email, and company from the text.'
});
console.log(extractedData);
// {
// "name": "John Doe",
// "email": "j.doe@example.com",
// "company": "Acme Inc."
// }