Documentation
¶
Overview ¶
keyword_block is an example GoModel plugin built as a shared object. It blocks, answers, or flags a request when the last user message contains a configured keyword, and does the same for the assistant's reply.
Build (from the GoModel checkout, with the gomodel binary that will load it):
go run ./cmd/gomodel plugin build ./docs/example_plugins/keywordblock -o plugins/keyword_block.so go run ./cmd/gomodel plugin inspect plugins/keyword_block.so
Load (config.yaml, or PLUGINS_SEARCH_PATHS=./plugins):
plugins:
search_paths: ["./plugins"]
load:
- file: keyword_block.so
sha256: "" # optional pin; `shasum -a 256 plugins/keyword_block.so`
The plugin type then appears as "keyword_block" wherever plugin instances are configured (the dashboard, plugins.instances, workflows).
Exact-toolchain constraint: Go's plugin package refuses a shared object unless it was built with the same Go version, the same build flags (-trimpath, -race, -tags), and identical sources of every package shared with the host (the standard library and pluginapi). `gomodel plugin build` copies the flags of the gomodel binary that runs it, so build plugins with the binary that loads them and rebuild after every GoModel or Go upgrade. Loading needs a cgo-enabled binary on Linux, macOS, or FreeBSD (`make build-plugins`, or the gomodel:<version>-plugins image); the default static binary reports a clear error instead.