Skip to content

Instantly share code, notes, and snippets.

@jdh30
Last active July 21, 2025 08:45
Show Gist options
  • Select an option

  • Save jdh30/b6439f5dfa29446c56a94295b84ff564 to your computer and use it in GitHub Desktop.

Select an option

Save jdh30/b6439f5dfa29446c56a94295b84ff564 to your computer and use it in GitHub Desktop.
LLM prompts

LLM prompts

Write an interpreter in OCaml

Write an interpreter in OCaml 5 that fits in a single file that can parse and interpret the string "let rec fib n =\n  if n<2 then n else\n    fib(n-2)+fib(n-1) in\nfib 30".

Generate synthetic data ready for fine tuning

Generate 10 prompt-completion pairs where the prompt contains a non-trivial integer arithmetic calculation (using +, -, *, / and brackets) and the completion provides a thought process using a REPL before stating the answer.

Respond in JSONL of the form:

```jsonl
{"prompt": "What is 19×82?", "completion": "<think>\nThis calculation is best done using the REPL:\n\n» 19 * 82;;\nval - : int = 1558\n</think>\n\n19 × 82 = 1,558"}
{"prompt": "What is (10 + 9)(40 + 42)?", "completion": "<think>\nUsing the REPL in the interests of accuracy:\n\n» (10 + 9) * (40 + 42);;\nval - : int = 1558\n</think>\n\n(10 + 9)(40 + 42) = 1,558"}
{"prompt": "What is (7 + 2) * (6 - 1) + 3?", "completion": "</think>\nTo ensure accuracy, let's use the REPL:\n\n» (7 + 2) * (6 - 1) + 3;;\nval - : int = 48\n</think>\n\n(7 + 2) × (6 - 1) + 3 = 48"}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment