Changelog #14

·

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:


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

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


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

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


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

Ready to start building?

Build and deploy your first task in 3 minutes.

Get started now
,