discourse-ai/db/migrate/20240410170000_add_embeddings_tablesfor_bge_m3.rb
Rafael dos Santos Silva eb93b21769
FEATURE: Add BGE-M3 embeddings support (#569)
BAAI/bge-m3 is an interesting model, that is multilingual and with a
context size of 8192. Even with a 16x larger context, it's only 4x slower
to compute it's embeddings on the worst case scenario.

Also includes a minor refactor of the rake task, including setting model
and concurrency levels when running the backfill task.
2024-04-10 17:24:01 -03:00

39 lines
1.2 KiB
Ruby

# frozen_string_literal: true
class AddEmbeddingsTablesforBgeM3 < ActiveRecord::Migration[7.0]
def change
create_table :ai_topic_embeddings_8_1, id: false do |t|
t.integer :topic_id, null: false
t.integer :model_version, null: false
t.integer :strategy_version, null: false
t.text :digest, null: false
t.column :embeddings, "vector(1024)", null: false
t.timestamps
t.index :topic_id, unique: true
end
create_table :ai_post_embeddings_8_1, id: false do |t|
t.integer :post_id, null: false
t.integer :model_version, null: false
t.integer :strategy_version, null: false
t.text :digest, null: false
t.column :embeddings, "vector(1024)", null: false
t.timestamps
t.index :post_id, unique: true
end
create_table :ai_document_fragment_embeddings_8_1, id: false do |t|
t.integer :rag_document_fragment_id, null: false
t.integer :model_version, null: false
t.integer :strategy_version, null: false
t.text :digest, null: false
t.column :embeddings, "vector(1024)", null: false
t.timestamps
t.index :rag_document_fragment_id,
unique: true,
name: "rag_document_fragment_id_embeddings_8_1"
end
end
end