Ash FrameworkAF
Ash Framework7mo ago
22 replies
hyperion_zw

type `vector` can not be handled by the types module Postgrex.DefaultTypes

It seems when I try to save embeddings into db, it shows this error.
Here are my settings:
1. lib/postgrex_types.ex
Postgrex.Types.define(
  Masque.PostgrexTypes,
  [AshPostgres.Extensions.Vector] ++ Ecto.Adapters.Postgres.extensions(),
  []
)

2. lib/masque/repo.ex
  use AshPostgres.Repo,
    types: Masque.PostgrexTypes,
    otp_app: :masque

  @impl true
  def installed_extensions do
    # Add extensions here, and the migration generator will install them.
    ["ash-functions", "uuid-ossp", "citext", "pg_trgm", "vector"]
  end


3. deps in mix.ex
{:pgvector, "~> 0.3.0"}


4. docker-compose setup for pgvector
services:
  postgres:
    image: pgvector/pgvector:pg16
    restart: always
    container_name: postgres
    environment:
      - POSTGRES_DB=masque
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
    ports:
      - "5432:5432"
    volumes:
      - masque_postgres_data:/var/lib/postgresql/data

Is there anyone else has encoutered this problem?
Solution
just the relevant parts for now
Was this page helpful?