AI Integration
Leverage AI-powered suggestions and automation.
Overview
The AI resource provides access to AI-generated suggestions for assurance tasks and compliance activities. These suggestions are generated by de.iterate's background AI processes.
Listing AI Suggestions
typescript
const suggestions = await client.ai.list();
for (const suggestion of suggestions) {
console.log(`Suggestion: ${suggestion.id}`);
console.log(`Status: ${suggestion.status}`);
if (suggestion.suggested_tasks) {
for (const task of suggestion.suggested_tasks) {
console.log(` Task: ${task.title}`);
}
}
}Accepting Suggestions
typescript
const result = await client.ai.accept('suggestion-id');
if (result.success) {
console.log('Suggestion accepted!');
}Rejecting Suggestions
typescript
const result = await client.ai.reject('suggestion-id', 'Not applicable to our context');
if (result.success) {
console.log('Suggestion rejected');
}Individual Task Status
Update the status of specific tasks within a suggestion:
typescript
await client.ai.updateTaskStatus(
'doc-id',
'task-id',
'accepted',
'Task is relevant and will be implemented'
);AISuggestion Type
typescript
interface AISuggestion {
id: string;
status?: 'pending' | 'accepted' | 'rejected';
suggested_tasks?: Array<{
cast_id?: string;
title?: string;
description?: string;
status?: 'pending' | 'accepted' | 'rejected';
acceptedBy?: string;
acceptedAt?: string;
rejectedBy?: string;
rejectedAt?: string;
reason?: string;
}>;
createdAt?: string;
acceptedBy?: string;
acceptedAt?: string;
rejectedBy?: string;
rejectedAt?: string;
rejectionReason?: string;
}Best Practices
- Review suggestions - Always review AI suggestions before accepting
- Provide feedback - Rejection reasons help improve future suggestions
- Track acceptance rates - Monitor which suggestions are useful
- Integrate into workflows - Build AI suggestions into your review process
Next Steps
- AIResource API - Full API reference
- Assurance Tasks - Task management