ollama/cli is a thin wrapper around Ollama's HTTP API. The public entry
points mirror the main API areas:
ollama.cli.chat/chatollama.cli.generate/generateollama.cli.embed/embedThe examples below assume a local Ollama instance running on the default
endpoint from resources/config.edn, http://localhost:11434.
(require '[ollama.cli.chat :as chat])
(chat/chat
{:model "phi3"
:stream false
:messages [{:role "user"
:content "Explain Rayleigh scattering in one paragraph."}]})
Set :stream true to receive a lazy sequence of parsed events instead of a
single response map.
(require '[ollama.cli.generate :as generate])
(generate/generate
{:model "phi3"
:stream false
:prompt "Write a haiku about distributed systems."})
(require '[ollama.cli.embed :as embed])
(embed/embed
{:model "embeddinggemma"
:input ["first text" "second text"]})
The public API functions use clojure.spec pre/post conditions. Invalid input
will fail fast before an HTTP request is made.
Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |