| Copyright | (c) 2025 Tushar Adhatrao |
|---|---|
| License | MIT |
| Maintainer | Tushar Adhatrao <tusharadhatrao@gmail.com> |
| Stability | experimental |
| Safe Haskell | None |
| Language | Haskell2010 |
Data.Ollama.Ps
Description
This module provides functions to retrieve a list of models currently running on the Ollama server.
It includes both an IO-based function (ps) and a monadic version (psM) for use in MonadIO
contexts. The operation is performed via a GET request to the "api/ps" endpoint, returning a
RunningModels type containing a list of RunningModel records with details about each running model.
Example:
>>>ps NothingRight (RunningModels [RunningModel ...])
Synopsis
- ps :: Maybe OllamaConfig -> IO (Either OllamaError RunningModels)
- psM :: MonadIO m => Maybe OllamaConfig -> m (Either OllamaError RunningModels)
- newtype RunningModels = RunningModels [RunningModel]
- data RunningModel = RunningModel {
- name_ :: !Text
- modelName :: !Text
- size_ :: !Int64
- modelDigest :: !Text
- modelDetails :: !ModelDetails
- expiresAt :: !UTCTime
- sizeVRam :: !Int64
List Running Models API
Arguments
| :: Maybe OllamaConfig | Optional |
| -> IO (Either OllamaError RunningModels) |
Retrieves a list of currently running models from the Ollama server.
Sends a GET request to the "api/ps" endpoint to fetch the list of running models.
Returns Right with a RunningModels containing the list of RunningModel on success,
or Left with an OllamaError on failure.
Example:
>>>ps NothingRight (RunningModels [RunningModel {name_ = "gemma3:instance1", modelName = "gemma3", ...}])
psM :: MonadIO m => Maybe OllamaConfig -> m (Either OllamaError RunningModels) Source #
Model Types
newtype RunningModels Source #
A wrapper type containing a list of running models.
Constructors
| RunningModels [RunningModel] | List of |
Instances
| FromJSON RunningModels Source # | JSON parsing instance for |
Defined in Data.Ollama.Ps Methods parseJSON :: Value -> Parser RunningModels # parseJSONList :: Value -> Parser [RunningModels] # | |
| Show RunningModels Source # | |
Defined in Data.Ollama.Ps Methods showsPrec :: Int -> RunningModels -> ShowS # show :: RunningModels -> String # showList :: [RunningModels] -> ShowS # | |
| Eq RunningModels Source # | |
Defined in Data.Ollama.Ps Methods (==) :: RunningModels -> RunningModels -> Bool # (/=) :: RunningModels -> RunningModels -> Bool # | |
data RunningModel Source #
Details about a specific running model.
Constructors
| RunningModel | |
Fields
| |
Instances
| FromJSON RunningModel Source # | JSON parsing instance for |
Defined in Data.Ollama.Ps | |
| Show RunningModel Source # | |
Defined in Data.Ollama.Ps Methods showsPrec :: Int -> RunningModel -> ShowS # show :: RunningModel -> String # showList :: [RunningModel] -> ShowS # | |
| Eq RunningModel Source # | |
Defined in Data.Ollama.Ps | |