mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-03-06 17:30:20 +00:00
20 lines
653 B
Ruby
20 lines
653 B
Ruby
# frozen_string_literal: true
|
|
|
|
class CreateBgeTopicEmbeddingsTable < ActiveRecord::Migration[7.0]
|
|
def change
|
|
truncation = DiscourseAi::Embeddings::Strategies::Truncation.new
|
|
vector_rep = DiscourseAi::Embeddings::VectorRepresentations::BgeLargeEn.new(truncation)
|
|
|
|
create_table vector_rep.table_name.to_sym, 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(#{vector_rep.dimensions})", null: false
|
|
t.timestamps
|
|
|
|
t.index :topic_id, unique: true
|
|
end
|
|
end
|
|
end
|