discourse-ai/db/post_migrate/20240708193243_fix_vllm_model_name.rb
Roman Rizzi 5cb91217bd
FIX: Flaky SRV-backed model seeding. (#708)
* Seeding the SRV-backed model should happen inside an initializer.
* Keep the model up to date when the hidden setting changes.
* Use the correct Mixtral model name and fix previous data migration.
* URL validation should trigger only when we attempt to update it.
2024-07-08 18:47:10 -03:00

19 lines
494 B
Ruby

# frozen_string_literal: true
class FixVllmModelName < ActiveRecord::Migration[7.1]
def up
vllm_mixtral_model_id = DB.query_single(<<~SQL).first
SELECT id FROM llm_models WHERE name = 'mistralai/Mixtral'
SQL
DB.exec(<<~SQL, target_id: vllm_mixtral_model_id) if vllm_mixtral_model_id
UPDATE llm_models
SET name = 'mistralai/Mixtral-8x7B-Instruct-v0.1'
WHERE id = :target_id
SQL
end
def down
raise ActiveRecord::IrreversibleMigration
end
end