Skip to content

Commit

Permalink
ihp-openai: Don't use deprecated prompt anymore, as we mostly use the…
Browse files Browse the repository at this point in the history
… chat API
  • Loading branch information
mpscholten committed Mar 13, 2024
1 parent c526aeb commit da05bbe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ihp-openai/IHP/OpenAI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import Control.Applicative ((<|>))

data CompletionRequest = CompletionRequest
{ messages :: ![Message]
, prompt :: !Text
, prompt :: !Text -- ^ Deprecated, use 'messages' instead
, maxTokens :: !Int
, temperature :: !Double
, presencePenalty :: !Double
Expand All @@ -39,7 +39,7 @@ instance ToJSON CompletionRequest where
toJSON CompletionRequest { model, prompt, messages, maxTokens, temperature, presencePenalty, frequencePenalty, stream } =
object
[ "model" .= model
, "messages" .= (messages <> [userMessage prompt])
, "messages" .= (messages <> (if not (Text.null prompt) then [userMessage prompt] else []))
, "max_tokens" .= maxTokens
, "stream" .= stream
, "temperature" .= temperature
Expand Down

0 comments on commit da05bbe

Please sign in to comment.