From 59d3a832adadb2cc7a22eb133c2a2342c20586bd Mon Sep 17 00:00:00 2001 From: Vince Loewe Date: Mon, 11 Mar 2024 17:52:53 +0900 Subject: [PATCH] fix: pulling datasets --- packages/backend/src/api/v1/datasets/utils.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/api/v1/datasets/utils.ts b/packages/backend/src/api/v1/datasets/utils.ts index e9326f28..9df09bb7 100644 --- a/packages/backend/src/api/v1/datasets/utils.ts +++ b/packages/backend/src/api/v1/datasets/utils.ts @@ -1,5 +1,5 @@ import sql from "@/src/utils/db" -import { compilePrompt } from "@/src/utils/playground" +import { compilePrompt, compileTextTemplate } from "@/src/utils/playground" export async function getDatasetById(datasetId: string, projectId: string) { const [dataset] = @@ -59,7 +59,10 @@ export async function getDatasetBySlug(slug: string, projectId: string) { for (const { promptMessages, variables, idealOutput, context } of rows) { const item = { - input: compilePrompt(promptMessages, variables), + input: + typeof promptMessages === "string" + ? compileTextTemplate(promptMessages, variables) + : compilePrompt(promptMessages, variables), idealOutput, context, }