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.Create

Description

This module provides functions to create a new model in the Ollama API using either a model file content or a file path. It includes both an IO-based function (createModel) and a monadic version (createModelM) for use in MonadIO contexts. The create operation is performed via a POST request to the "api/pull" endpoint, with streaming support for progress updates.

Note: If both modelFile and path are provided, modelFile takes precedence.

Example:

>>> createModel "myModel" (Just "FROM llama3\nPARAMETER temperature 0.8") (Just True) Nothing Nothing
Creating model...
Completed
Synopsis

Create Model API

createModel Source #

Arguments

:: Text

Model name

-> Maybe Text

Optional model file content

-> Maybe Bool

Optional streaming flag

-> Maybe FilePath

Optional file path to a Modelfile

-> Maybe OllamaConfig

Optional OllamaConfig (defaults to defaultOllamaConfig if Nothing)

-> IO () 

Creates a new model using either model file content or a file path.

Sends a POST request to the "api/pull" endpoint to create a model with the specified name. The model can be defined either by modelFile (Modelfile content as text) or path (file path to a Modelfile). If both are provided, modelFile is used. Supports streaming progress updates if stream is 'Just True'. Prints progress messages to the console during creation.

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

MonadIO version of createModel for use in monadic contexts.

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