You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+23-11Lines changed: 23 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,25 +10,37 @@ This repository contains an implementation of a Wolfram evaluation function that
10
10
11
11
You can choose between running the Wolfram evaluation function itself, ore using Shimmy to run the function.
12
12
13
+
This repository's JSON comms (reading the request, dispatching `eval`/`preview`, writing the response) come from the shared [`toolkit-wolfram`](https://github.com/lambda-feedback/toolkit-wolfram) paclet (`LambdaFeedback/EvaluationFunctionToolkit`) rather than being implemented in this repo — `evaluate.m`/`preview.m` here just provide `EvaluationFunction`/`PreviewFunction`, and the toolkit's `Bootstrap.wl` wires everything together (it's what the Docker image's Shimmy setup runs). To run locally, fetch the pinned toolkit version (see `.toolkit-wolfram-version`) with:
14
+
15
+
```bash
16
+
scripts/setup-toolkit.sh
17
+
```
18
+
19
+
This clones it into `./toolkit-wolfram` (gitignored; re-run any time to reset it). Then point `LF_TOOLKIT_PATH` at it:
20
+
21
+
```bash
22
+
export LF_TOOLKIT_PATH=./toolkit-wolfram
23
+
```
24
+
13
25
**Local**
14
26
15
27
Use the following command to run the evaluation function directly:
This will run the evaluation function using the input data from `request.json` and write the output to `response.json`.
22
34
An example `request.json` is:
23
35
24
36
```
25
37
{
26
-
"method": "eval",
38
+
"command": "eval",
27
39
"params": {
28
40
"answer":"Sin[p x + q]",
29
41
"response":"Sin[a x + b]",
30
42
"params":{
31
-
"comparisonType":"structure",
43
+
"type":"structure",
32
44
"named_variables":"{x}",
33
45
"correct_response_feedback":"Your answer is correct!",
34
46
"incorrect_response_feedback":"Your answer is incorrect!"
@@ -44,8 +56,7 @@ Which gives the response:
44
56
"command": "eval",
45
57
"result": {
46
58
"is_correct": true,
47
-
"feedback": "Your answer is correct!",
48
-
"error": null
59
+
"feedback": "Your answer is correct!"
49
60
}
50
61
}
51
62
```
@@ -63,19 +74,20 @@ Which gives the response:
63
74
build.yml # builds the public evaluation function image
64
75
deploy.yml # deploys the evaluation function to Lambda Feedback
65
76
66
-
evaluation_function.wl # evaluation function source code
77
+
evaluate.m # EvaluationFunction source code
78
+
preview.m # PreviewFunction source code
67
79
68
-
config.json # evaluation function deployment configuration file
80
+
config.json # evaluation function deployment configuration file
69
81
```
70
82
71
83
### Development Workflow
72
84
73
-
In its most basic form, the development workflow consists of writing the evaluation function in the `evaluation_function.wl` file and testing it locally. As long as the evaluation function adheres to the Evaluation Function API, a development workflow which incorporates using Shimmy is not necessary.
85
+
In its most basic form, the development workflow consists of writing the evaluation function in `evaluate.m`/`preview.m` and testing it locally. As long as the evaluation function adheres to the Evaluation Function API, a development workflow which incorporates using Shimmy is not necessary.
74
86
75
-
Testing the evaluation function can be done by running the script using the Wolfram Engine / WolframScript like so:
87
+
Testing the evaluation function can be done by running the script using the Wolfram Engine / WolframScript like so (see [Run the Script](#run-the-script) above for the one-time `scripts/setup-toolkit.sh`/`LF_TOOLKIT_PATH` setup this depends on):
0 commit comments