GenAI.Graph.NodeBehaviour behaviour (GenAI Core v0.2.0)

Behaviour Graph Node Elements must adhere to.

Link to this section Summary

Functions

Define the struct of a node with default fields included.

Define the type of a node with default fields included.

Link to this section Callbacks

Link to this callback

description(graph_node)

@callback description(graph_node :: term()) :: {:ok, String.t()} | {:error, any()}
Link to this callback

description(graph_node, default)

@callback description(graph_node :: term(), default :: any()) ::
  {:ok, String.t()} | {:error, any()}
Link to this callback

handle(graph_node)

@callback handle(graph_node :: term()) ::
  {:ok, GenAI.Types.Graph.node_handle()} | {:error, any()}
Link to this callback

handle(graph_node, default)

@callback handle(graph_node :: term(), default :: any()) ::
  {:ok, GenAI.Types.Graph.node_handle()} | {:error, any()}
@callback id(graph_node :: term()) :: {:ok, GenAI.Types.Graph.node_id()} | {:error, any()}
Link to this callback

name(graph_node)

@callback name(graph_node :: term()) :: {:ok, String.t()} | {:error, any()}
Link to this callback

name(graph_node, default)

@callback name(graph_node :: term(), default :: any()) ::
  {:ok, String.t()} | {:error, any()}
@callback new() :: struct()
@callback new(options :: term()) :: struct()

Link to this section Functions

Link to this macro

defnodestruct(values)

(macro)

Define the struct of a node with default fields included.

example

Example

  defnodestruct [
      value: nil,
  ]
Link to this macro

defnodetype(types)

(macro)

Define the type of a node with default fields included.

example

Example

defnodetype [
   internal: boolean,
]