TamaEx.Neural (TamaEx v0.1.18)

View Source

Client for interacting with Neural API endpoints.

Summary

Functions

Creates a new operation for a class.

Gets a space by slug from the provision endpoint.

Lists nodes for a class.

Functions

create_class_operation(client, class, attrs)

Creates a new operation for a class.

Parameters

  • client - The HTTP client
  • class - The Class struct containing the class_id
  • attrs - Map containing operation parameters (chain_ids, node_type)

Examples

iex> TamaEx.Neural.create_class_operation(client, %TamaEx.Neural.Class{id: "class_123"}, %{"chain_ids" => ["chain1"]})
{:ok, %TamaEx.Neural.Class.Operation{}}

iex> TamaEx.Neural.create_class_operation(client, %TamaEx.Neural.Class{id: "class_123"}, %{})
{:error, %Ecto.Changeset{}}

get_class(client, space, name)

get_space(client, slug)

Gets a space by slug from the provision endpoint.

Parameters

  • :provision - The endpoint type (currently only :provision is supported)
  • slug - The slug identifier for the space

Examples

iex> TamaEx.Neural.get_space(client, "my-space")
{:ok, %TamaEx.Neural.Space{}}

iex> TamaEx.Neural.get_space(client, "nonexistent")
{:error, :not_found}

list_nodes(client, class, options \\ [])

Lists nodes for a class.

Parameters

  • client - The HTTP client
  • class - The Class struct containing the class_id
  • options - Keyword list of options (optional)
    • :query - Query parameters to pass to the API

Examples

iex> TamaEx.Neural.list_nodes(client, %TamaEx.Neural.Class{id: "class_123"})
{:ok, [%TamaEx.Neural.Node{}]}

iex> TamaEx.Neural.list_nodes(client, %TamaEx.Neural.Class{id: "class_123"}, query: [limit: 10])
{:ok, [%TamaEx.Neural.Node{}]}

list_spaces(client, options \\ [])

Lists spaces.

Parameters

  • client - The HTTP client
  • options - Keyword list of options (optional)
    • :query - Query parameters to pass to the API

Examples

iex> TamaEx.Neural.list_spaces(client)
{:ok, [%TamaEx.Neural.Space{}]}

iex> TamaEx.Neural.list_spaces(client, query: %{type: "root"})
{:ok, [%TamaEx.Neural.Space{}]}