Powered by AppSignal & Oban Pro
Would you like to see your link here? Contact us

Class Operations

livebook/class-operations.livemd

Class Operations

Mix.install([
  {:tama_ex, github: "upmaru/tama-ex"}
])

Setup

These are common class level operations that need to be triggered.

We initialize the client then load the movie-db space.

alias TamaEx.Neural
alias TamaEx.Perception

client = TamaEx.client(base_url: "http://localhost:4000/provision")

{:ok, movie_db_space} = Neural.get_space(client, "movie-db")

Movie Details Class

Load the movie-details class

{:ok, movie_details_class} = 
  Neural.get_class(client, movie_db_space, "movie-details")

Load the sample for movie index generation chain.

{:ok, movie_index_chain} = 
  Perception.get_chain(client, movie_db_space, "sample-for-movie-index-generation") 

Run the chain.

Neural.create_class_operation(client, movie_details_class, %{
  chain_ids: [movie_index_chain.id]
})

Person Details Class

Load the person-details class.

{:ok, person_details_class} = 
  Neural.get_class(client, movie_db_space, "person-details")

Load the sample person for indexing chain.

{:ok, person_index_chain} = 
  Perception.get_chain(client, movie_db_space, "sample-for-person-index-generation") 

Run the chain

Neural.create_class_operation(client, person_details_class, %{
  chain_ids: [person_index_chain.id]
})