I use the following script to start the toplevel:
breakchars="(){}[],^%$#@\"\";:''\\"
exec rlwrap --remember -c -b "$breakchars" -f "$HOME"/.ml_completions -S '> ' ocaml -init ~/.ocamlinit "$@"
Then how can I build the .ml_completions file so that I can auto-complete input in the toplevel?