To get started with Velatir in Node.js, you need to install the SDK using the following command:
npm install @velatir/sdk
The SDK is designed to be easy to use and integrate into your existing Node.js applications. Once you have created an API key within your project, all you need to do is initializing the SDK within your code:
import * as velatir from '@velatir/sdk';
// Initialize the SDK with your API key
velatir.init({ apiKey: "your-api-key" });
class EmailService {
// Decorate methods you want to monitor
@velatir.watch()
async sendEmail(to: string, subject: string, body: string): Promise<void> {
// Your email sending logic here
}
}
// Call the method as usual (or from LLM tool)
const emailService = new EmailService();
await emailService.sendEmail("[email protected]", "Welcome!", "Hello from Velatir!");