AI.CompletionAPI behaviour (fnord v0.9.40)

View Source

Summary

Functions

Provider-specific error classifier is delegated to AI.Endpoint.OpenAI.

Returns the current completion API module. Overridden per process tree via the :completion_api config key for unit testing. See Fnord.TestCase.

Types

model()

@type model() :: AI.Model.t()

msg_response()

@type msg_response() :: {:ok, :msg, binary(), usage()}

msgs()

@type msgs() :: [map()]

response()

@type response() ::
  msg_response()
  | tool_response()
  | {:error, map()}
  | {:error, binary()}
  | {:error, :api_unavailable, any()}
  | {:error, :context_length_exceeded, non_neg_integer()}

response_format()

@type response_format() :: nil | map()

tool_response()

@type tool_response() :: {:ok, :tool, [map()]}

tools()

@type tools() :: nil | [AI.Tools.tool_spec()]

usage()

@type usage() :: non_neg_integer()

verbosity()

@type verbosity() :: nil | String.t()

web_search?()

@type web_search?() :: boolean()

Callbacks

get(model, msgs, tools, response_format, web_search?, verbosity)

@callback get(model(), msgs(), tools(), response_format(), web_search?(), verbosity()) ::
  response()

Functions

endpoint_error_classify(status, body, headers, transport_reason)

Provider-specific error classifier is delegated to AI.Endpoint.OpenAI.

impl()

@spec impl() :: module()

Returns the current completion API module. Overridden per process tree via the :completion_api config key for unit testing. See Fnord.TestCase.