ADK.Model behaviour (adk_ex v1.1.0)

Copy Markdown View Source

Behaviour for LLM model providers.

Implementations wrap a specific LLM API (Gemini, Claude, etc.) and return streams of LlmResponse structs. When stream: false, the enumerable yields a single response. When stream: true, it yields partial chunks followed by a final response with turn_complete: true.

Summary

Callbacks

Generates content from the model.

Returns the model's identifier string.

Functions

Calls generate_content/3 on any model struct via its implementing module.

Calls name/1 on any model struct via its implementing module.

Callbacks

generate_content(model, request, stream)

@callback generate_content(
  model :: struct(),
  request :: ADK.Model.LlmRequest.t(),
  stream :: boolean()
) ::
  Enumerable.t()

Generates content from the model.

Returns an Enumerable.t() that yields LlmResponse.t() structs.

name(model)

@callback name(model :: struct()) :: String.t()

Returns the model's identifier string.

Functions

generate_content(model, request, stream)

@spec generate_content(struct(), ADK.Model.LlmRequest.t(), boolean()) ::
  Enumerable.t()

Calls generate_content/3 on any model struct via its implementing module.

name(model)

@spec name(struct()) :: String.t()

Calls name/1 on any model struct via its implementing module.