View Source Nexlm.Behaviour behaviour (Nexlm v0.1.5)

Summary

Types

@type message() :: %{role: String.t(), content: String.t() | [map()]}
@type tool_call() :: %{id: String.t(), name: String.t(), arguments: map()}
@type tool_definition() :: %{
  name: String.t(),
  description: String.t(),
  parameters: %{type: String.t(), properties: map(), required: [String.t()]}
}
@type tool_result() :: %{id: String.t(), result: any()}

Callbacks

@callback call(Nexlm.Config.t(), map()) :: {:ok, map()} | {:error, Nexlm.Error.t()}
@callback format_request(Nexlm.Config.t(), [message()]) ::
  {:ok, map()} | {:error, Nexlm.Error.t()}
@callback init(Keyword.t()) :: {:ok, Nexlm.Config.t()} | {:error, Nexlm.Error.t()}
@callback parse_response(map()) :: {:ok, message()} | {:error, Nexlm.Error.t()}
@callback validate_messages([message()]) :: :ok | {:error, Nexlm.Error.t()}