Current section

Files

Jump to
crawlberg lib crawlberg extraction_meta.ex
Raw

lib/crawlberg/extraction_meta.ex

# This file is auto-generated by alef — DO NOT EDIT.
# alef:hash:23d662f17ccee663375ea978facec5b4b691adf30860c73224d58efb602c12d2
# To regenerate: alef generate
# To verify freshness: alef verify --exit-code
defmodule Crawlberg.ExtractionMeta do
@moduledoc "Metadata about an LLM extraction pass."
@typedoc "Metadata about an LLM extraction pass."
@type t :: %__MODULE__{
cost: float() | nil,
prompt_tokens: non_neg_integer() | nil,
completion_tokens: non_neg_integer() | nil,
model: String.t() | nil,
chunks_processed: non_neg_integer()
}
defstruct cost: nil,
prompt_tokens: nil,
completion_tokens: nil,
model: nil,
chunks_processed: 0
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