Current section
Files
Jump to
Current section
Files
src/gllm@types@choice.erl
-module(gllm@types@choice).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/gllm/types/choice.gleam").
-export([choice_decoder/0]).
-export_type([choice/0]).
-type choice() :: {choice,
gleam@option:option(binary()),
binary(),
binary(),
integer(),
gllm@types@message:message()}.
-file("src/gllm/types/choice.gleam", 15).
-spec choice_decoder() -> gleam@dynamic@decode:decoder(choice()).
choice_decoder() ->
gleam@dynamic@decode:optional_field(
<<"logprobs"/utf8>>,
none,
gleam@dynamic@decode:optional(
{decoder, fun gleam@dynamic@decode:decode_string/1}
),
fun(Logprobs) ->
gleam@dynamic@decode:field(
<<"finish_reason"/utf8>>,
{decoder, fun gleam@dynamic@decode:decode_string/1},
fun(Finish_reason) ->
gleam@dynamic@decode:field(
<<"native_finish_reason"/utf8>>,
{decoder, fun gleam@dynamic@decode:decode_string/1},
fun(Native_finish_reason) ->
gleam@dynamic@decode:field(
<<"index"/utf8>>,
{decoder, fun gleam@dynamic@decode:decode_int/1},
fun(Index) ->
gleam@dynamic@decode:field(
<<"message"/utf8>>,
gllm@types@message:message_decoder(),
fun(Message) ->
gleam@dynamic@decode:success(
{choice,
Logprobs,
Finish_reason,
Native_finish_reason,
Index,
Message}
)
end
)
end
)
end
)
end
)
end
).