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

Description

This module provides functions to retrieve a list of models available on the Ollama server. It includes both an IO-based function (list) and a monadic version (listM) for use in MonadIO contexts. The list operation is performed via a GET request to the "api/tags" endpoint, returning a Models type containing a list of ModelInfo records with details about each model.

Example:

>>> list Nothing
Right (Models [ModelInfo ...])
Synopsis

List Models API

list Source #

Arguments

:: Maybe OllamaConfig

Optional OllamaConfig (defaults to defaultOllamaConfig if Nothing)

-> IO (Either OllamaError Models) 

Retrieves a list of available models from the Ollama server.

Sends a GET request to the "api/tags" endpoint to fetch the list of models. Returns Right with a Models containing the list of ModelInfo on success, or Left with an OllamaError on failure.

listM :: MonadIO m => Maybe OllamaConfig -> m (Either OllamaError Models) Source #

MonadIO version of list for use in monadic contexts.

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

Example:

>>> import Control.Monad.IO.Class
>>> runReaderT (listM Nothing) someContext
Right (Models [ModelInfo ...])

Model Types

newtype Models Source #

A wrapper type containing a list of available models.

Constructors

Models [ModelInfo]

List of ModelInfo records describing available models.

Instances

Instances details
FromJSON Models Source #

JSON parsing instance for Models.

Instance details

Defined in Data.Ollama.List

Show Models Source # 
Instance details

Defined in Data.Ollama.List

Eq Models Source # 
Instance details

Defined in Data.Ollama.List

Methods

(==) :: Models -> Models -> Bool #

(/=) :: Models -> Models -> Bool #

data ModelInfo Source #

Details about a specific model.

Constructors

ModelInfo 

Fields

Instances

Instances details
FromJSON ModelInfo Source #

JSON parsing instance for ModelInfo.

Instance details

Defined in Data.Ollama.List

Show ModelInfo Source # 
Instance details

Defined in Data.Ollama.List

Eq ModelInfo Source # 
Instance details

Defined in Data.Ollama.List