ReqLLM.ToolCallIdCompat (ReqLLM v1.14.0)

View Source

Tool call ID compatibility helpers for cross-provider conversations.

This module normalizes tool call identifiers for providers with stricter requirements while preserving passthrough behavior for OpenAI-compatible APIs.

Summary

Types

mode()

@type mode() :: :passthrough | :sanitize | :strict | :drop

policy()

@type policy() :: %{
  optional(:mode) => mode(),
  optional(:invalid_chars_regex) => Regex.t(),
  optional(:max_length) => pos_integer(),
  optional(:enforce_turn_boundary) => boolean(),
  optional(:drop_function_call_ids) => boolean()
}

Functions

apply_body(provider_mod, operation, model, body, opts)

@spec apply_body(module(), atom(), LLMDB.Model.t() | map(), map(), keyword() | map()) ::
  map()

apply_body_with_policy(body, policy, opts \\ [])

@spec apply_body_with_policy(map(), policy() | keyword(), keyword() | map()) :: map()

apply_context(provider_mod, operation, model, context, opts)

@spec apply_context(
  module(),
  atom(),
  LLMDB.Model.t() | map(),
  ReqLLM.Context.t(),
  keyword() | map()
) ::
  ReqLLM.Context.t()

apply_context_with_policy(context, policy, opts \\ [])

@spec apply_context_with_policy(
  ReqLLM.Context.t(),
  policy() | keyword(),
  keyword() | map()
) ::
  ReqLLM.Context.t()