Either an ExperimentItem or DatasetItem containing input and metadata
Promise resolving to the task's output (any type)
const universalTask: ExperimentTask = async (item) => {
// Works with both ExperimentItem and DatasetItem
const input = item.input;
const metadata = item.metadata;
const response = await openai.chat.completions.create({
model: "gpt-4",
messages: [{ role: "user", content: input }]
});
return response.choices[0].message.content;
};
Function type for experiment tasks that process input data and return output.
The task function is the core component being tested in an experiment. It receives either an ExperimentItem or DatasetItem and produces output that will be evaluated.