gristlabs_grist-core/test
Alex Hall 52469c5a7e (core) Improve parsing formula from completion
Summary:
The previous code for extracting a Python formula from the LLM completion involved some shaky string manipulation which this improves on.
Overall the 'test results' from `runCompletion` went from 37/47 to 45/47 for `gpt-3.5-turbo-0613`.

The biggest problem that motivated these changes was that it assumed that code was always inside a markdown code block
(i.e. triple backticks) and so if there was no block there was no code. But the completion often consists of *only* code
with no accompanying explanation or markdown. By parsing the completion in Python instead of JS,
we can easily check if the entire completion is valid Python syntax and accept it if it is.

I also noticed one failure resulting from the completion containing the full function (instead of just the body)
and necessary imports before that function instead of inside. The new parsing moves import inside.

Test Plan: Added a Python unit test

Reviewers: paulfitz

Reviewed By: paulfitz

Subscribers: paulfitz

Differential Revision: https://phab.getgrist.com/D3922
2023-06-16 13:38:20 +02:00
..
client (core) Minimazing widgets 2023-03-02 11:22:49 +01:00
common (core) Add optional telemetry to grist-core 2023-06-07 12:00:51 -04:00
deployment Adding new lines at the end 2022-09-30 17:00:38 +02:00
fixtures (core) For exporting XLSX, do it memory-efficiently in a worker thread. 2023-06-01 12:06:48 -04:00
formula-dataset (core) Improve parsing formula from completion 2023-06-16 13:38:20 +02:00
gen-server (core) Persist forks in home db 2023-02-20 22:46:36 -05:00
nbrowser (core) Fix scrolling and column title bugs 2023-06-15 14:51:10 -04:00
server (core) Polish telemetry code 2023-06-09 13:03:10 -04:00
timings run grist-core test batches in parallel (#444) 2023-03-03 09:53:33 -05:00
.eslintrc.js Fixing all eslint's reported error 2023-01-03 17:22:58 +01:00
chai-as-promised.js (core) Faster builds all around. 2022-07-04 10:42:40 -04:00
init-mocha-webdriver.js Correct spelling mistakes 2022-02-19 09:46:49 +00:00
mocha.opts run grist-core test batches in parallel (#444) 2023-03-03 09:53:33 -05:00
report-why-tests-hang.js (core) Move report-why-tests-hang helper to core 2021-04-26 23:52:16 -04:00
setupPaths.js add test/upgradeDocument utility 2023-01-17 16:14:15 -05:00
split-tests.js run grist-core test batches in parallel (#444) 2023-03-03 09:53:33 -05:00
test_under_docker.sh Adding dedicated folder for external tests 2022-09-30 16:45:35 +02:00
testUtils.ts (core) add missing tsconfig file that affects IDEs 2022-05-27 13:48:58 -04:00
tsconfig.json (core) Faster builds all around. 2022-07-04 10:42:40 -04:00
upgradeDocument add test/upgradeDocument utility 2023-01-17 16:14:15 -05:00
upgradeDocumentImpl.ts add test/upgradeDocument utility 2023-01-17 16:14:15 -05:00
utils.js (core) Moving client and common tests to core 2022-08-23 19:20:10 +02:00
xunit-file.js (core) Parallelize jenkins by running on multiple machines. 2022-07-01 16:18:36 -04:00