Skip to content

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

  1. Review suggestions - Always review AI suggestions before accepting
  2. Provide feedback - Rejection reasons help improve future suggestions
  3. Track acceptance rates - Monitor which suggestions are useful
  4. Integrate into workflows - Build AI suggestions into your review process

Next Steps

Released under the MIT License.