LLMs hallucinate, but if you use shroom, it will at least be a well-typed
hallucination!
shroom lets an LLM understand the types you defined in Haskell and generate
good values for them. A monadic program written
with context and
prompt returns a typed
Haskell value, or a descriptive error. The model learns a type from what a
human reader sees already: its Haddocks and its type, constructor and field
names. Properties written as pure Haskell functions, example values and
documentation for the model alone guide it further. A response that fails to
parse or breaks a property is retried. The package includes
the prompt monad and its effect interface
(Control.Monad.Prompt.Effect), deriving via
Generically,
tool calls (Control.Monad.Prompt.Tool), and a mock backend that reads
responses from files (Control.Monad.Prompt.FileMock). The classes
describing types live in
shroom-class, which this
package re-exports.
A tool call is like an effect that the model triggers. The program's type
decides which tools the model may use, and the model decides when and how.
shroom ships no backend for a real model.
shroom-baikai supplies
one for Claude and for OpenAI-compatible hosts such as a local Ollama.