forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NL-to-ESQL] update internal documentation (elastic#205853)
## Summary Fix elastic#205606 - Re-generate the internal ES|QL documentation using the generation script (+ human review) - Add more scenario to the NL-to-ESQL evaluation suite - Some prompt engineering - improving the system instructions / functions summary - add more examples to the summary - adapt a few opinionated examples for some specific functions ## Evaluation - average based on 4 runs for each model/branch tuple - the new tests were locally added to main to run against the same suite and properly evaluate the difference | Model | before (main) | after (PR) | delta | | ------------- | ------------- | ------------- | ------------- | | GPT-4o | 90.9 | 97.74 | + 6.84 | | Claude 3.5 Sonnet v2 | 88.58 | 96.49 | +7.91 | | Gemini 1.5-pro-002 | 88.17 | 94.19 | +6.02 | Overall, the prompt engineering somewhat significantly improved the generation efficiency.
- Loading branch information
1 parent
52aeede
commit 72e5a8a
Showing
47 changed files
with
1,307 additions
and
194 deletions.
There are no files selected for viewing
462 changes: 453 additions & 9 deletions
462
x-pack/platform/plugins/shared/inference/scripts/evaluation/scenarios/esql/index.spec.ts
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...k/platform/plugins/shared/inference/server/tasks/nl_to_esql/esql_docs/esql-bit_length.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# BIT_LENGTH | ||
|
||
This function calculates the bit length of a given string. | ||
|
||
## Syntax | ||
|
||
`BIT_LENGTH(string)` | ||
|
||
### Parameters | ||
|
||
#### string | ||
|
||
This is the string whose bit length you want to calculate. If `null` is provided, the function will return `null`. | ||
|
||
**Note**: Strings are in UTF-8 format, which means a single character may occupy multiple bytes. | ||
|
||
## Examples | ||
|
||
```esql | ||
FROM airports | ||
| WHERE country == "India" | ||
| KEEP city | ||
| EVAL fn_length = LENGTH(city), fn_bit_length = BIT_LENGTH(city) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
.../platform/plugins/shared/inference/server/tasks/nl_to_esql/esql_docs/esql-byte_length.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# BYTE_LENGTH | ||
|
||
This function calculates the byte length of a given string. | ||
|
||
## Syntax | ||
|
||
`BYTE_LENGTH(string)` | ||
|
||
### Parameters | ||
|
||
#### string | ||
|
||
The text string for which the byte length is to be determined. If `null` is provided, the function will return `null`. | ||
|
||
## Examples | ||
|
||
```esql | ||
FROM airports | ||
| WHERE country == "India" | ||
| KEEP city | ||
| EVAL fn_length = LENGTH(city), fn_byte_length = BYTE_LENGTH(city) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...k/platform/plugins/shared/inference/server/tasks/nl_to_esql/esql_docs/esql-categorize.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# CATEGORIZE | ||
|
||
The `CATEGORIZE` function organizes textual data into groups of similar format. | ||
|
||
> **Note:** The `CATEGORIZE` function is currently in technical preview and may undergo changes or be removed in future releases. | ||
|
||
## Syntax | ||
|
||
`CATEGORIZE(field)` | ||
|
||
### Parameters | ||
|
||
#### field | ||
|
||
The expression that is to be categorized. | ||
|
||
## Examples | ||
|
||
The following example demonstrates how to use `CATEGORIZE` to group server log messages into categories and then aggregate their counts. | ||
|
||
```esql | ||
FROM sample_data | ||
| STATS count = COUNT() BY category=CATEGORIZE(message) | ||
``` | ||
|
||
## Limitations | ||
|
||
- `CATEGORIZE` can't be used within other expressions | ||
- `CATEGORIZE` can't be used with multiple groupings | ||
- `CATEGORIZE` can't be used or referenced within aggregate functions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,6 @@ ROW d = 5.0 | |
``` | ||
|
||
```esql | ||
ROW value = 2.0 | ||
| EVAL result = EXP(value) | ||
FROM geo | ||
| EVAL exp = EXP(x) | ||
``` |
30 changes: 30 additions & 0 deletions
30
x-pack/platform/plugins/shared/inference/server/tasks/nl_to_esql/esql_docs/esql-hash.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# HASH | ||
|
||
The HASH function computes the hash of a given input using a specified algorithm. | ||
|
||
## Syntax | ||
|
||
`HASH(algorithm, input)` | ||
|
||
### Parameters | ||
|
||
#### algorithm | ||
|
||
The hash algorithm to be used. | ||
|
||
The supported algorithms are: | ||
- "MD5" | ||
- "SHA-1" | ||
- "SHA-256" | ||
|
||
#### input | ||
|
||
The value to be hashed. | ||
|
||
## Examples | ||
|
||
```esql | ||
FROM messages | ||
| EVAL hashed_content = HASH("SHA-1", content) | ||
| KEEP message_id, hashed_content | ||
``` |
28 changes: 28 additions & 0 deletions
28
x-pack/platform/plugins/shared/inference/server/tasks/nl_to_esql/esql_docs/esql-hypot.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# HYPOT | ||
|
||
The HYPOT function is used to calculate the hypotenuse of two numbers. | ||
|
||
## Syntax | ||
|
||
`HYPOT(number1, number2)` | ||
|
||
### Parameters | ||
|
||
#### number1 | ||
|
||
This is a numeric value. If it's `null`, the function will also return `null`. | ||
|
||
#### number2 | ||
|
||
This is also a numeric value. If it's `null`, the function will also return `null`. | ||
|
||
## Examples | ||
|
||
Check the hypotenuse of two variables through the following example: | ||
|
||
```esql | ||
ROW a = 3.0, b = 4.0 | ||
| EVAL c = HYPOT(a, b) | ||
``` | ||
|
||
Note that the HYPOT function returns the hypotenuse in double data type. Besides, if any of the numbers is infinity, the hypotenuse returns `null`. |
Oops, something went wrong.