ADK.Event (ADK v0.0.1-alpha.1)

Copy Markdown View Source

Represents an event in the ADK.

Summary

Functions

Returns true if this is a compaction event.

Create an error event.

Returns true if this event is a final response (not partial, no transfer, no tool calls).

Reconstruct an event from a map (string or atom keys).

Extract function call parts from the event's content.

Extract function response parts from the event's content.

Returns true if the event contains at least one function call.

Returns true if the event contains at least one function response.

Create a new event with auto-generated ID and timestamp.

Check if an event is visible on a given branch.

Extract text from the event's content parts, falling back to error.

Returns true if the event has text content (not just tool calls).

Convert an event to a plain map, serializing timestamps and actions.

Types

t()

@type t() :: %ADK.Event{
  actions: ADK.EventActions.t() | nil,
  author: String.t() | nil,
  branch: String.t() | nil,
  content: map() | nil,
  custom_metadata: map(),
  data: any(),
  error: String.t() | nil,
  id: String.t() | nil,
  input_transcription: map() | nil,
  invocation_id: String.t() | nil,
  output_transcription: map() | nil,
  partial: boolean() | nil,
  timestamp: DateTime.t() | nil,
  type: atom() | nil
}

Functions

compaction?(event)

@spec compaction?(t()) :: boolean()

Returns true if this is a compaction event.

error(reason, opts)

@spec error(term(), map() | keyword()) :: t()

Create an error event.

final_response?(event)

@spec final_response?(t()) :: boolean()

Returns true if this event is a final response (not partial, no transfer, no tool calls).

from_map(map)

@spec from_map(map()) :: t()

Reconstruct an event from a map (string or atom keys).

function_calls(event)

@spec function_calls(t()) :: [map()]

Extract function call parts from the event's content.

function_responses(event)

@spec function_responses(t()) :: [map()]

Extract function response parts from the event's content.

has_function_calls?(event)

@spec has_function_calls?(t()) :: boolean()

Returns true if the event contains at least one function call.

has_function_responses?(event)

@spec has_function_responses?(t()) :: boolean()

Returns true if the event contains at least one function response.

new(opts)

@spec new(map() | keyword()) :: t()

Create a new event with auto-generated ID and timestamp.

on_branch?(event, branch)

@spec on_branch?(t(), String.t() | nil) :: boolean()

Check if an event is visible on a given branch.

text(event)

@spec text(t()) :: String.t() | nil

Extract text from the event's content parts, falling back to error.

text?(event)

@spec text?(t()) :: boolean()

Returns true if the event has text content (not just tool calls).

to_map(event)

@spec to_map(t()) :: map()

Convert an event to a plain map, serializing timestamps and actions.