Current section
Files
Jump to
Current section
Files
lib/lang_schema/keyword/openai/nullable.ex
defmodule LangSchema.Keyword.OpenAI.Nullable do
use LangSchema.Keyword
@impl LangSchema.Keyword
def convert(json_schema, :nullable, value) do
case value do
true ->
json_schema
|> Map.update!("type", fn type -> [type, "null"] end)
false ->
json_schema
end
end
end