genai-lib 2.0 → 2.0.1
raw patch · 6 files changed
+23/−18 lines, 6 filesdep ~aesondep ~basedep ~bytestring
Dependency ranges changed: aeson, base, bytestring, http-client-tls, scientific, text
Files
- CHANGELOG.md +5/−0
- README.md +2/−2
- genai-lib.cabal +11/−11
- src/example/ex-genai-ollama.hs +1/−1
- src/example/ex-genai-openai.hs +2/−2
- src/lib/GenAILib.hs +2/−2
CHANGELOG.md view
@@ -1,3 +1,8 @@+2.0.1 (2025-04-23)++ * Fixed build issues with cabal and package dep ranges+ * Removed some whitespace in example code+ 2.0 (2025-04-22) * Extensive redesign of this library
README.md view
@@ -38,7 +38,7 @@ -- response openaiJSON :: IO () openaiJSON = do- let req :: OpenAIRequest = mkRequest "gpt-3.5-turbo" $ usermsg "Why is the sky blue?"+ let req :: OpenAIRequest = mkRequest "gpt-3.5-turbo" $ usermsg "Why is the sky blue?" token <- tokenFromFile "path/to/openai/key" TL.putStrLn . jsonToText =<< openaiV1ChatJ token Nothing req @@ -46,7 +46,7 @@ -- data structure, displaying that and also just the response text openaiData :: IO () openaiData = do- let req :: OpenAIRequest = mkRequest "gpt-3.5-turbo"+ let req :: OpenAIRequest = mkRequest "gpt-3.5-turbo" ( systemmsg "Answer in the style of Bugs Bunny. Try to work the phrase \"What's up Doc?\" in somewhere." <> usermsg "Why is the sky blue?" <> numopt "temperature" 0.8
genai-lib.cabal view
@@ -1,7 +1,7 @@ cabal-version: 2.2 name: genai-lib-version: 2.0+version: 2.0.1 synopsis: A library for interacting with various generative AI LLMs description: A library for performing completions and chats with various generative AI LLMs (Large Language Models). Works today with Ollama and@@ -70,18 +70,18 @@ hs-source-dirs: src/lib build-depends:- aeson >= 2.1.2 && < 2.2- , base >= 3 && < 5- , bytestring >= 0.11.4 && < 0.12+ aeson >= 2.1.2.1 && < 2.3+ , base >= 4.18.1.0 && < 5+ , bytestring >= 0.11.5.2 && < 0.12 , containers >= 0.6.7 && < 0.7 , http-client >= 0.7.16 && < 0.8- , http-client-tls >= 0.3.6 && < 0.4- , scientific >= 0.3.7 && < 0.4+ , http-client-tls >= 0.3.6.3 && < 0.4+ , scientific >= 0.3.7.0 && < 0.4 , servant >= 0.20.1 && < 0.21 , servant-client >= 0.20 && < 0.21 , servant-client-core >= 0.20 && < 0.21 , string-conv >= 0.2.0 && < 0.3- , text >= 1.2.5 && < 3+ , text >= 2.0.2 && < 3 , time >= 1.12.2 && < 1.13 executable ex-genai-ollama@@ -90,9 +90,9 @@ hs-source-dirs: src/example build-depends:- base >= 3 && < 5+ base >= 4.18.1.0 && < 5 , genai-lib- , text >= 1.2.5 && < 3+ , text >= 2.0.2 && < 3 executable ex-genai-openai import: lang@@ -100,6 +100,6 @@ hs-source-dirs: src/example build-depends:- base >= 3 && < 5+ base >= 4.18.1.0 && < 5 , genai-lib- , text >= 1.2.5 && < 3+ , text >= 2.0.2 && < 3
src/example/ex-genai-ollama.hs view
@@ -24,7 +24,7 @@ ollamaData :: IO () ollamaData = do let mbDuration = Just "30m"- let req = mkRequest "gemma3:1b"+ let req = mkRequest "gemma3:1b" ( systemmsg "Answer in the style of Bugs Bunny. Try to work in the phrase \"What's up Doc?\" somewhere." <> usermsg "Why is the sky blue?" <> numopt "temperature" 0.1
src/example/ex-genai-openai.hs view
@@ -17,7 +17,7 @@ -- response openaiJSON :: IO () openaiJSON = do- let req :: OpenAIRequest = mkRequest "gpt-3.5-turbo" $ usermsg "Why is the sky blue?"+ let req :: OpenAIRequest = mkRequest "gpt-3.5-turbo" $ usermsg "Why is the sky blue?" token <- tokenFromFile "path/to/openai/key" TL.putStrLn . jsonToText =<< openaiV1ChatJ token Nothing req @@ -25,7 +25,7 @@ -- data structure, displaying that and also just the response text openaiData :: IO () openaiData = do- let req :: OpenAIRequest = mkRequest "gpt-3.5-turbo"+ let req :: OpenAIRequest = mkRequest "gpt-3.5-turbo" ( systemmsg "Answer in the style of Bugs Bunny. Try to work the phrase \"What's up Doc?\" in somewhere." <> usermsg "Why is the sky blue?" <> numopt "temperature" 0.8
src/lib/GenAILib.hs view
@@ -23,7 +23,7 @@ -- > -- response -- > openaiJSON :: IO () -- > openaiJSON = do- -- > let req :: OpenAIRequest = mkRequest "gpt-3.5-turbo" $ usermsg "Why is the sky blue?"+ -- > let req :: OpenAIRequest = mkRequest "gpt-3.5-turbo" $ usermsg "Why is the sky blue?" -- > token <- tokenFromFile "path/to/openai/key" -- > TL.putStrLn . jsonToText =<< openaiV1ChatJ token Nothing req -- >@@ -31,7 +31,7 @@ -- > -- data structure, displaying that and also just the response text -- > openaiData :: IO () -- > openaiData = do- -- > let req :: OpenAIRequest = mkRequest "gpt-3.5-turbo"+ -- > let req :: OpenAIRequest = mkRequest "gpt-3.5-turbo" -- > ( systemmsg "Answer in the style of Bugs Bunny. Try to work the phrase \"What's up Doc?\" in somewhere." -- > <> usermsg "Why is the sky blue?" -- > <> numopt "temperature" 0.8