Skip to content

Commit 04191cb

Browse files
committed
Adding a test case for multivalued prompt.
1 parent cc7d8fa commit 04191cb

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/EsqlSpecTestCase.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,11 @@ private Object valueMapper(CsvTestUtils.Type type, Object value) {
365365
return new BigDecimal(s).round(new MathContext(7, RoundingMode.DOWN)).doubleValue();
366366
}
367367
}
368+
if (type == CsvTestUtils.Type.TEXT || type == CsvTestUtils.Type.KEYWORD || type == CsvTestUtils.Type.SEMANTIC_TEXT) {
369+
if (value instanceof String s) {
370+
value = s.replaceAll("\\\\n", "\n");
371+
}
372+
}
368373
return value.toString();
369374
}
370375

x-pack/plugin/esql/qa/testFixtures/src/main/resources/completion.csv-spec

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@ Who is Victor Hugo? | WHO IS VICTOR HUGO?
1414
;
1515

1616

17+
completion using a ROW source operator and prompt is a multi-valued field
18+
required_capability: completion
19+
20+
ROW prompt=["Answer the following question:", "Who is Victor Hugo?"]
21+
| COMPLETION prompt WITH test_completion AS completion_output
22+
;
23+
24+
prompt:keyword | completion_output:keyword
25+
[Answer the following question:, Who is Victor Hugo?] | ANSWER THE FOLLOWING QUESTION:\nWHO IS VICTOR HUGO?
26+
;
27+
28+
1729
completion after a search
1830
required_capability: completion
1931
required_capability: match_operator_colon

0 commit comments

Comments
 (0)