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.Common.Config

Description

Overview

This module defines the core configuration record used throughout the Ollama Haskell client.

Use defaultOllamaConfig as a starting point and customize it with helper functions like withOnModelStart, withOnModelFinish, or withOnModelError.

Includes settings for base URL, timeout, retry logic, and custom HTTP managers.

Synopsis

Configuration Type

data OllamaConfig Source #

Configuration for the Ollama client. Used across all requests to customize behavior such as timeouts, retries, custom HTTP manager, and lifecycle hooks. -- -- @since 0.2.0.0

Constructors

OllamaConfig 

Fields

Instances

Instances details
Generic OllamaConfig Source # 
Instance details

Defined in Data.Ollama.Common.Config

Associated Types

type Rep OllamaConfig 
Instance details

Defined in Data.Ollama.Common.Config

type Rep OllamaConfig = D1 ('MetaData "OllamaConfig" "Data.Ollama.Common.Config" "ollama-haskell-0.2.0.0-FoTQnIMi8UeBjcOZ65CLdd" 'False) (C1 ('MetaCons "OllamaConfig" 'PrefixI 'True) (((S1 ('MetaSel ('Just "hostUrl") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "timeout") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)) :*: (S1 ('MetaSel ('Just "onModelStart") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (IO ()))) :*: S1 ('MetaSel ('Just "onModelError") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (IO ()))))) :*: ((S1 ('MetaSel ('Just "onModelFinish") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (IO ()))) :*: S1 ('MetaSel ('Just "retryCount") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Int))) :*: (S1 ('MetaSel ('Just "retryDelay") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Int)) :*: S1 ('MetaSel ('Just "commonManager") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Manager))))))
type Rep OllamaConfig Source # 
Instance details

Defined in Data.Ollama.Common.Config

type Rep OllamaConfig = D1 ('MetaData "OllamaConfig" "Data.Ollama.Common.Config" "ollama-haskell-0.2.0.0-FoTQnIMi8UeBjcOZ65CLdd" 'False) (C1 ('MetaCons "OllamaConfig" 'PrefixI 'True) (((S1 ('MetaSel ('Just "hostUrl") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "timeout") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)) :*: (S1 ('MetaSel ('Just "onModelStart") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (IO ()))) :*: S1 ('MetaSel ('Just "onModelError") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (IO ()))))) :*: ((S1 ('MetaSel ('Just "onModelFinish") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (IO ()))) :*: S1 ('MetaSel ('Just "retryCount") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Int))) :*: (S1 ('MetaSel ('Just "retryDelay") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Int)) :*: S1 ('MetaSel ('Just "commonManager") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Manager))))))

Default Config

defaultOllamaConfig :: OllamaConfig Source #

A default configuration pointing to localhost:11434 with 90s timeout and no hooks or retry logic.

Hook Helpers

withOnModelStart :: IO () -> OllamaConfig -> OllamaConfig Source #

Add a callback to be executed when a model starts.

withOnModelFinish :: IO () -> OllamaConfig -> OllamaConfig Source #

Add a callback to be executed when a model finishes successfully.

withOnModelError :: IO () -> OllamaConfig -> OllamaConfig Source #

Add a callback to be executed when a model errors.