Setting Up the Application
To start your book search application, create a new Phoenix project with mix phx.new:
| mix phx.new book_search |
Now, run the following command to change to the root directory of your project and list its contents:
| cd book_search && ls |
The output of this command will look like this:
| assets _build config deps lib mix.exs mix.lock priv README.md test |
Next, you’ll need to install pgvector. Start by adding pgvector as a dependency in your mix.exs:
| {:pgvector, "~> 0.2.0"} |
Then run mix deps.get. Next, create a new file lib/postgrex_types.ex and add the following code:
| Postgrex.Types.define( |
| BookSearch.PostgrexTypes, |
| [Pgvector.Extensions.Vector] ++ Ecto.Adapters.Postgres.extensions(), |
| [] |
| ) |
Next, add the following ...
Get Machine Learning in Elixir now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.