ollama-haskell-0.1.0.0: Ollama Haskell library
Safe HaskellSafe-Inferred
LanguageGHC2021

Data.Ollama.Chat

Contents

Synopsis

Chat APIs

chat :: ChatOps -> IO (Either String ChatResponse) Source #

Initiates a chat session with the specified ChatOps configuration and returns either a ChatResponse or an error message.

This function sends a request to the Ollama chat API with the given options.

Example:

let ops = defaultChatOps
result <- chat ops
case result of
  Left errorMsg -> putStrLn ("Error: " ++ errorMsg)
  Right response -> print response

data Message Source #

Represents a message within a chat, including its role and content.

Constructors

Message 

Fields

Instances

Instances details
FromJSON Message Source # 
Instance details

Defined in Data.Ollama.Chat

ToJSON Message Source # 
Instance details

Defined in Data.Ollama.Chat

Generic Message Source # 
Instance details

Defined in Data.Ollama.Chat

Associated Types

type Rep Message :: Type -> Type #

Methods

from :: Message -> Rep Message x #

to :: Rep Message x -> Message #

Show Message Source # 
Instance details

Defined in Data.Ollama.Chat

Eq Message Source # 
Instance details

Defined in Data.Ollama.Chat

Methods

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

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

type Rep Message Source # 
Instance details

Defined in Data.Ollama.Chat

type Rep Message = D1 ('MetaData "Message" "Data.Ollama.Chat" "ollama-haskell-0.1.0.0-Hhs8YtljEqoGZTH1LFF25l" 'False) (C1 ('MetaCons "Message" 'PrefixI 'True) (S1 ('MetaSel ('Just "role") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Role) :*: (S1 ('MetaSel ('Just "content") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "images") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe [Text])))))

data Role Source #

Enumerated roles that can participate in a chat.

Constructors

System 
User 
Assistant 
Tool 

Instances

Instances details
FromJSON Role Source # 
Instance details

Defined in Data.Ollama.Chat

ToJSON Role Source # 
Instance details

Defined in Data.Ollama.Chat

Show Role Source # 
Instance details

Defined in Data.Ollama.Chat

Methods

showsPrec :: Int -> Role -> ShowS #

show :: Role -> String #

showList :: [Role] -> ShowS #

Eq Role Source # 
Instance details

Defined in Data.Ollama.Chat

Methods

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

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

defaultChatOps :: ChatOps Source #

A default configuration for initiating a chat with a model. This can be used as a starting point and modified as needed.

Example:

let ops = defaultChatOps { chatModelName = "customModel" }
chat ops

data ChatOps Source #

Constructors

ChatOps 

Fields

Instances

Instances details
ToJSON ChatOps Source # 
Instance details

Defined in Data.Ollama.Chat

Show ChatOps Source # 
Instance details

Defined in Data.Ollama.Chat

Eq ChatOps Source # 
Instance details

Defined in Data.Ollama.Chat

Methods

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

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

data ChatResponse Source #

Constructors

ChatResponse 

Fields