Ash FrameworkAF
Ash Framework7mo ago
12 replies
teeang

Ash.Vector clashing with Pgvector

Hey, I need help with the following error. Is there a setup step that I'm missing with Ash.Vector?

Unknown Error
* ** (FunctionClauseError) no function clause matching in Pgvector.new/1
  (pgvector 0.3.0) lib/pgvector.ex:11: Pgvector.new(Ash.Vector.new([0.003053617663681507, 1.4347572869155556e-4, 0.03219764307141304, -0.030739549547433853, -0.00840899720788002, -0.008372376672923565, 0.015835285186767578, -0.001286978367716074, -0.0236682016402483, 0.025776473805308342,


I've setup the Pgvector types according to their documentation. So I have a
lib/postgrex_types.ex
file
Postgrex.Types.define(
  ResidentialTenancyAct.PostgrexTypes,
  Pgvector.extensions() ++ Ecto.Adapters.Postgres.extensions(),
  []
)


And my database config which extends the default postgrex types
config :residential_tenancy_act, ResidentialTenancyAct.Repo,
  types: ResidentialTenancyAct.PostgrexTypes
Solution
Ah, I think I found it. Maybe there should be a link to the setup instructions in AshPostgres.Extensions.Vector documentation from the Ash.Vector docs.

Ash Vector: https://hexdocs.pm/ash/Ash.Vector.html
AshPostgres.Extensions.Vector: https://hexdocs.pm/ash_postgres/AshPostgres.Extensions.Vector.html
Was this page helpful?