Skip to content

Commit

Permalink
Merge pull request #15 from ShiboSoftwareDev/main
Browse files Browse the repository at this point in the history
display code in code blocks
  • Loading branch information
ShiboSoftwareDev authored Jan 25, 2025
2 parents ebe817e + bcf5bbb commit 6eb9d0d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions benchmarks-evalite/benchmark.eval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ evalite("Electronics Engineer", {
const aiResponse = await runAI(input.prompt)
const codeMatch = aiResponse.match(/```tsx\s*([\s\S]*?)\s*```/)
const code = codeMatch ? codeMatch[1].trim() : ""
const codeBlockMatch = aiResponse.match(/```tsx[\s\S]*?```/)
const codeBlock = codeBlockMatch ? codeBlockMatch[0] : ""
const evaluation = safeEvaluateCode(code, {
outputType: "board",
preSuppliedImports: {},
Expand All @@ -75,7 +77,7 @@ evalite("Electronics Engineer", {
} = { results: [], code: "" }

if (evaluation.success) {
output.code = code
output.code = codeBlock
for (const question of input.questions) {
output.results.push({
result: await askAboutOutput(code, question.text),
Expand All @@ -84,7 +86,7 @@ evalite("Electronics Engineer", {
}
return output
}
return `${evaluation.error}\nCode: ${code}`
return `${evaluation.error}. Code:\n${codeBlock}`
},
experimental_customColumns: async (result) => {
if (typeof result.output === "string")
Expand Down

0 comments on commit 6eb9d0d

Please sign in to comment.