* Rename tables, add graphile workers, update types * Add dev:worker command * Update pnpm-lock.yaml * Remove sentry config import from worker.ts * Stop generating new cells in cell router get query * Generate new cells for new scenarios, variants, and experiments * Remove most error throwing from queryLLM.task.ts * Remove promptVariantId and testScenarioId from ModelOutput * Remove duplicate index from ModelOutput * Move inputHash from cell to output * Add TODO * Add todo * Show cost and time for each cell * Always show output stats if there is output * Trigger LLM outputs when scenario variables are updated * Add newlines to ends of files * Add another newline * Cascade ModelOutput deletion * Fix linting and prettier * Return instead of throwing for non-pending cell * Remove pnpm dev:worker from pnpm:dev * Update pnpm-lock.yaml
110 lines
1.9 KiB
TypeScript
110 lines
1.9 KiB
TypeScript
import { prisma } from "~/server/db";
|
|
|
|
const experimentId = "11111111-1111-1111-1111-111111111111";
|
|
|
|
// Delete the existing experiment
|
|
await prisma.experiment.deleteMany({
|
|
where: {
|
|
id: experimentId,
|
|
},
|
|
});
|
|
|
|
const experiment = await prisma.experiment.create({
|
|
data: {
|
|
id: experimentId,
|
|
label: "Country Capitals Example",
|
|
},
|
|
});
|
|
|
|
await prisma.scenarioVariantCell.deleteMany({
|
|
where: {
|
|
promptVariant: {
|
|
experimentId,
|
|
},
|
|
},
|
|
});
|
|
|
|
await prisma.promptVariant.deleteMany({
|
|
where: {
|
|
experimentId,
|
|
},
|
|
});
|
|
|
|
await prisma.promptVariant.createMany({
|
|
data: [
|
|
{
|
|
experimentId,
|
|
label: "Prompt Variant 1",
|
|
sortIndex: 0,
|
|
constructFn: `prompt = {
|
|
model: "gpt-3.5-turbo-0613",
|
|
messages: [{ role: "user", content: "What is the capital of {{country}}?" }],
|
|
temperature: 0,
|
|
}`,
|
|
},
|
|
{
|
|
experimentId,
|
|
label: "Prompt Variant 2",
|
|
sortIndex: 1,
|
|
constructFn: `prompt = {
|
|
model: "gpt-3.5-turbo-0613",
|
|
messages: [
|
|
{
|
|
role: "user",
|
|
content:
|
|
"What is the capital of {{country}}? Return just the city name and nothing else.",
|
|
},
|
|
],
|
|
temperature: 0,
|
|
}`,
|
|
},
|
|
],
|
|
});
|
|
|
|
await prisma.templateVariable.deleteMany({
|
|
where: {
|
|
experimentId,
|
|
},
|
|
});
|
|
|
|
await prisma.templateVariable.createMany({
|
|
data: [
|
|
{
|
|
experimentId,
|
|
label: "country",
|
|
},
|
|
],
|
|
});
|
|
|
|
await prisma.testScenario.deleteMany({
|
|
where: {
|
|
experimentId,
|
|
},
|
|
});
|
|
|
|
await prisma.testScenario.createMany({
|
|
data: [
|
|
{
|
|
experimentId,
|
|
sortIndex: 0,
|
|
variableValues: {
|
|
country: "Spain",
|
|
},
|
|
},
|
|
{
|
|
experimentId,
|
|
sortIndex: 1,
|
|
variableValues: {
|
|
country: "USA",
|
|
},
|
|
},
|
|
{
|
|
experimentId,
|
|
sortIndex: 2,
|
|
variableValues: {
|
|
country: "Chile",
|
|
},
|
|
},
|
|
],
|
|
});
|