Current section

Files

Jump to
liter_llm lib liter_llm chat_completion_request.ex
Raw

lib/liter_llm/chat_completion_request.ex

# This file is auto-generated by alef — DO NOT EDIT.
# alef:hash:b34f5dac0a6af082b71cab3b75e126050fd38402a73d6d3ff06130b6fe7d8875
# To regenerate: alef generate
# To verify freshness: alef verify --exit-code
defmodule LiterLlm.ChatCompletionRequest do
@moduledoc "Chat completion request (compatible with OpenAI and similar APIs)."
@typedoc "Chat completion request (compatible with OpenAI and similar APIs)."
@type t :: %__MODULE__{
model: String.t() | nil,
messages: [String.t() | nil],
temperature: float() | nil,
top_p: float() | nil,
n: non_neg_integer() | nil,
stream: boolean() | nil,
stop: String.t() | nil | nil,
max_tokens: non_neg_integer() | nil,
presence_penalty: float() | nil,
frequency_penalty: float() | nil,
logit_bias: map() | nil,
user: String.t() | nil,
tools: [LiterLlm.ChatCompletionTool.t()] | nil,
tool_choice: String.t() | nil | nil,
parallel_tool_calls: boolean() | nil,
response_format: String.t() | nil | nil,
stream_options: LiterLlm.StreamOptions.t() | nil,
seed: integer() | nil,
reasoning_effort: String.t() | nil | nil,
modalities: [String.t() | nil] | nil,
extra_body: String.t() | nil
}
defstruct model: nil,
messages: [],
temperature: nil,
top_p: nil,
n: nil,
stream: nil,
stop: nil,
max_tokens: nil,
presence_penalty: nil,
frequency_penalty: nil,
logit_bias: nil,
user: nil,
tools: nil,
tool_choice: nil,
parallel_tool_calls: nil,
response_format: nil,
stream_options: nil,
seed: nil,
reasoning_effort: nil,
modalities: nil,
extra_body: nil
defimpl Jason.Encoder do
@doc false
def encode(value, opts) do
value
|> Map.from_struct()
|> Enum.reject(fn {_k, v} -> v == nil end)
|> Enum.into(%{})
|> Jason.Encoder.encode(opts)
end
end
end