ollama-haskell-0.2.0.0: Haskell client for ollama.
Copyright(c) 2025 Tushar Adhatrao
LicenseMIT
MaintainerTushar Adhatrao <[email protected]>
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Data.Ollama.Push

Description

This module provides functions to push (upload) a model to the Ollama server. It includes both an IO-based function (push) and a monadic version (pushM) for use in MonadIO contexts. The push operation is performed via a POST request to the "api/pull" endpoint, with support for streaming progress updates and insecure connections.

The PushOps type configures the push request, and PushResp represents the response containing the status and progress details. Streaming mode, when enabled, provides real-time progress updates by printing to the console.

Example:

>>> push "gemma3" Nothing (Just True) Nothing
Pushing...
Completed
Synopsis

Push Model API

push Source #

Arguments

:: Text

Model name

-> Maybe Bool

Optional insecure connection flag

-> Maybe Bool

Optional streaming flag

-> Maybe OllamaConfig

Optional OllamaConfig (defaults to defaultOllamaConfig if Nothing)

-> IO () 

Pushes a model to the Ollama server with specified options.

Sends a POST request to the "api/pull" endpoint to upload the specified model. Supports streaming progress updates (if stream is 'Just True') and insecure connections (if insecure is 'Just True'). Prints "Pushing..." during streaming and Completed when finished. Returns () on completion.

pushM :: MonadIO m => Text -> Maybe Bool -> Maybe Bool -> Maybe OllamaConfig -> m () Source #

MonadIO version of push for use in monadic contexts.

Lifts the push function into a MonadIO context, allowing it to be used in monadic computations.

Example:

>>> import Control.Monad.IO.Class
>>> runReaderT (pushM "gemma3" Nothing (Just True) Nothing) someContext
Pushing...
Completed