Better support for generic interfaces

Matt Aitken

Matt Aitken

CEO, Trigger.dev

We've improved our Integrations to support generic interfaces and better ergonomics.

Previously, integrations could not support tasks with generic type parameters or fluent interfaces. For example, previously our OpenAI integration looked like this:


await io.openai.createChatCompletion("chat-completion", {
model: "gpt-3.5-turbo",
messages: [
{
role: "user",
content: "Create a good programming joke about background jobs",
},
],
});

Which is now replaced with the following that much more closely matches the OpenAI SDK:


await io.openai.chat.completions.create("chat-completion", {
model: "gpt-3.5-turbo",
messages: [
{
role: "user",
content: "Create a good programming joke about background jobs",
},
],
});

Tasks can also now have generic type parameters as well, which is useful for integrations like Supabase or Airtable that have user-defined schemas:


const table = io.airtable
.base(payload.baseId)
.table<LaunchGoalsAndOkRs>(payload.tableName);
const records = await table.getRecords("muliple records", {
fields: ["Status"],
});

Ready to start building?

Build and deploy your first task in 3 minutes.

Get started now