genai-lib-2.1.0: A library for interacting with various generative AI LLMs
Safe HaskellNone
LanguageHaskell2010

GenAILib.JSON

Synopsis

Documentation

flattenOptions :: Value -> Value Source #

Most LLM back-ends expect the options like temperature to be at the top-level of the object. This function will move the options Object up and merge it with the other keys, removing the options Object as well.

Used internally by this library to construct LLM request bodies

This

{ "foo" : 1 , "bar" : 5 , "options" : { "bar" : 2, "baz" : 3 } }

Becomes this

{ "foo" : 1 , "bar" : 2 , "baz" : 3 }

jsonToText :: Value -> Text Source #

Convenience function to textify a JSON Value