Skip to content

Commit f8eeccc

Browse files
committed
Stringified JSON in error messages
1 parent 0fb786b commit f8eeccc

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

server/src/test/routes/testchat.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ export default function setRoutes(app, basepath, genomes) {
2828
console.log('test chat page')
2929
for (const genome of Object.values(genomes)) {
3030
for (const ds of Object.values((genome as any).datasets)) {
31-
console.log('ds.label:', ds)
3231
if ((ds as any)?.queries?.chat) {
3332
await test_chatbot_by_dataset(ds)
3433
console.log('Tests complete for ' + (ds as any).label)
@@ -66,9 +65,9 @@ export async function test_chatbot_by_dataset(ds: any) {
6665
'html resource request did not match for prompt: ' +
6766
test_data.question +
6867
'. LLM response: ' +
69-
test_result.html +
68+
JSON.stringify(test_result.html) +
7069
' Actual response: ' +
71-
test_data.answer
70+
JSON.stringify(test_data.answer)
7271
)
7372
}
7473
} else if (test_result.type == 'plot') {
@@ -79,9 +78,9 @@ export async function test_chatbot_by_dataset(ds: any) {
7978
'Summary output did not match for prompt: ' +
8079
test_data.question +
8180
'. LLM response: ' +
82-
test_result +
81+
JSON.stringify(test_result) +
8382
' Actual response: ' +
84-
test_data.answer
83+
JSON.stringify(test_data.answer)
8584
)
8685
} else if (test_result.plot == 'dge') {
8786
const validated_llm_DE_output = validate_DE_output(test_result, test_data.answer)
@@ -90,9 +89,9 @@ export async function test_chatbot_by_dataset(ds: any) {
9089
'DE output did not match for prompt: ' +
9190
test_data.question +
9291
'. LLM response: ' +
93-
test_result +
92+
JSON.stringify(test_result) +
9493
' Actual response: ' +
95-
test_data.answer
94+
JSON.stringify(test_data.answer)
9695
)
9796
} else if (test_result.plot == 'matrix') {
9897
const validated_llm_matrix_output = validate_matrix_output(test_result, test_data.answer)
@@ -101,9 +100,9 @@ export async function test_chatbot_by_dataset(ds: any) {
101100
'Matrix output did not match for prompt: ' +
102101
test_data.question +
103102
'. LLM response: ' +
104-
test_result +
103+
JSON.stringify(test_result) +
105104
' Actual response: ' +
106-
test_data.answer
105+
JSON.stringify(test_data.answer)
107106
)
108107
} else if (test_result.plot == 'sampleScatter') {
109108
const validated_llm_scatter_output = validate_scatter_output(test_result, test_data.answer)
@@ -112,9 +111,9 @@ export async function test_chatbot_by_dataset(ds: any) {
112111
'SampleScatter output did not match for prompt: ' +
113112
test_data.question +
114113
'. LLM response: ' +
115-
test_result +
114+
JSON.stringify(test_result) +
116115
' Actual response: ' +
117-
test_data.answer
116+
JSON.stringify(test_data.answer)
118117
)
119118
} else {
120119
console.log('Unknown chart type for prompt: ' + test_data.question)
@@ -350,7 +349,6 @@ function validate_scatter_output(output: SampleScatterType, expected: SampleScat
350349
)
351350
return false
352351
}
353-
354352
const filter_valid = validate_filter(output.simpleFilter, expected.simpleFilter)
355353
if (!filter_valid) {
356354
console.log(

0 commit comments

Comments
 (0)