| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
Data.Ollama.Chat
Contents
Synopsis
- chat :: ChatOps -> IO (Either String ChatResponse)
- data Message = Message {}
- data Role
- defaultChatOps :: ChatOps
- data ChatOps = ChatOps {}
- data ChatResponse = ChatResponse {}
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 responseRepresents a message within a chat, including its role and content.
Constructors
| Message | |
Instances
| FromJSON Message Source # | |
Defined in Data.Ollama.Chat | |
| ToJSON Message Source # | |
| Generic Message Source # | |
| Show Message Source # | |
| Eq Message Source # | |
| type Rep Message Source # | |
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]))))) | |
Enumerated roles that can participate in a chat.
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 opsConstructors
| ChatOps | |
Fields
| |
data ChatResponse Source #
Constructors
| ChatResponse | |
Fields
| |
Instances
| FromJSON ChatResponse Source # | |
Defined in Data.Ollama.Chat | |
| Show ChatResponse Source # | |
Defined in Data.Ollama.Chat Methods showsPrec :: Int -> ChatResponse -> ShowS # show :: ChatResponse -> String # showList :: [ChatResponse] -> ShowS # | |
| Eq ChatResponse Source # | |
Defined in Data.Ollama.Chat | |