packages feed

llama-cpp-haskell 0.1.0.1 → 0.1.0.2

raw patch · 2 files changed

+15/−2 lines, 2 filesdep +http-types

Dependencies added: http-types

Files

Llama.hs view
@@ -7,6 +7,7 @@ import Data.Text (Text) import GHC.Generics import Network.HTTP.Conduit+import Network.HTTP.Types.Status import System.IO (hPutStrLn, stderr)  data Role = System | User | CustomRole Text deriving Show@@ -32,6 +33,8 @@   } deriving (Show, Generic) instance ToJSON LlamaApplyTemplateRequest +data Health = HealthOk | HealthNok deriving (Show)+ --data LlamaApplyTemplateResponse = LlamaApplyTemplateResponse --  { prompt :: Text --  } deriving (Show)@@ -102,3 +105,12 @@   case res of     Just text -> sendToLlama url manager text     _ -> pure Nothing++health :: URL -> IO Health+health url = do+  manager <- liftIO $ newManager tlsManagerSettings { managerResponseTimeout = responseTimeoutNone }+  let request = parseRequest_ $ url ++ "/health"+  response <- httpLbs request manager+  pure $ if responseStatus response == ok200+       then HealthOk+       else HealthNok
llama-cpp-haskell.cabal view
@@ -1,6 +1,6 @@ cabal-version:      2.2 name:               llama-cpp-haskell-version:            0.1.0.1+version:            0.1.0.2 synopsis:           Haskell bindings for the llama.cpp llama-server -- description: license:            AGPL-3.0-only@@ -19,7 +19,7 @@ Source-repository this   type:              git   location:          https://github.com/l29ah/llama-cpp-haskell.git-  tag:               0.1.0.1+  tag:               0.1.0.2  common stuff     ghc-options: -Wall@@ -33,4 +33,5 @@                     , http-conduit ^>= 2.3                     , aeson ^>= 2.2                     , text ^>= 2.1+                    , http-types ^>= 0.12     default-language: Haskell2010