ExLLM.Types (ex_llm v0.1.0)

View Source

Shared type definitions used across ExLLM modules.

This module contains struct definitions and types that are used by multiple modules, helping to avoid circular dependencies.

Summary

Types

adapter_options()

@type adapter_options() :: keyword()

cost_result()

@type cost_result() :: %{
  provider: String.t(),
  model: String.t(),
  input_tokens: non_neg_integer(),
  output_tokens: non_neg_integer(),
  total_tokens: non_neg_integer(),
  input_cost: float(),
  output_cost: float(),
  total_cost: float(),
  currency: String.t(),
  pricing: %{input: float(), output: float()}
}

message()

@type message() :: %{
  :role => String.t(),
  :content => String.t(),
  optional(:timestamp) => DateTime.t(),
  optional(atom()) => any()
}

pricing()

@type pricing() :: %{
  input_cost_per_token: float() | nil,
  output_cost_per_token: float() | nil,
  currency: String.t()
}

stream()

@type stream() :: Enumerable.t()

token_usage()

@type token_usage() :: %{
  input_tokens: non_neg_integer(),
  output_tokens: non_neg_integer()
}