| Copyright | (c) 2025 Tushar Adhatrao |
|---|---|
| License | MIT |
| Maintainer | Tushar Adhatrao <tusharadhatrao@gmail.com> |
| Stability | experimental |
| Safe Haskell | None |
| Language | Haskell2010 |
Data.Ollama.Pull
Contents
Description
This module provides functions to pull (download) models from the Ollama server. It includes both
high-level (pull, pullM) and low-level (pullOps, pullOpsM) APIs for pulling models, with
support for streaming progress updates and insecure connections. The PullOps type configures the
pull request, and PullResp represents the response containing the status and progress details.
The pull operation is performed via a POST request to the "api/pull" endpoint. Streaming mode, when enabled, provides real-time progress updates by printing the remaining bytes to the console.
Example:
>>>pull "gemma3"Remaining bytes: 123456789 ... Completed Right (PullResp {status = "success", ...})
Synopsis
- pull :: Text -> IO (Either OllamaError PullResp)
- pullOps :: Text -> Maybe Bool -> Maybe Bool -> Maybe OllamaConfig -> IO (Either OllamaError PullResp)
- pullM :: MonadIO m => Text -> m (Either OllamaError PullResp)
- pullOpsM :: MonadIO m => Text -> Maybe Bool -> Maybe Bool -> Maybe OllamaConfig -> m (Either OllamaError PullResp)
Pull Model API
Arguments
| :: Text | Model name |
| -> IO (Either OllamaError PullResp) |
Simplified API for pulling a model.
A higher-level function that pulls a model using default settings for insecure connections, streaming, and Ollama configuration. Suitable for basic use cases.
Arguments
| :: Text | Model name |
| -> Maybe Bool | Optional insecure connection flag |
| -> Maybe Bool | Optional streaming flag |
| -> Maybe OllamaConfig | Optional |
| -> IO (Either OllamaError PullResp) |
Pulls a model with full configuration.
Sends a POST request to the "api/pull" endpoint to download the specified model. Supports
streaming progress updates (if stream is 'Just True') and insecure connections (if insecure
is 'Just True'). Prints remaining bytes during streaming and Completed when finished.
Returns Right with a PullResp on success or Left with an OllamaError on failure.
pullOpsM :: MonadIO m => Text -> Maybe Bool -> Maybe Bool -> Maybe OllamaConfig -> m (Either OllamaError PullResp) Source #
MonadIO version of pullOps for use in monadic contexts.
Lifts the pullOps function into a MonadIO context, allowing it to be used in monadic computations
with full configuration options.
Example:
>>>import Control.Monad.IO.Class>>>runReaderT (pullOpsM "gemma3" Nothing (Just True) Nothing) someContextRemaining bytes: 123456789 ... Completed Right (PullResp {status = "success", ...})