Skip to content

Commit

Permalink
FIX: convert provider_params hash to json before db insert
Browse files Browse the repository at this point in the history
  • Loading branch information
wozulong authored Jan 22, 2025
1 parent a5e5ae7 commit cf11f82
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion db/migrate/20250110114305_embedding_config_data_migration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,12 @@ def model_attrs(model_name)
end

def persist_config(attrs)
provider_params_json = if attrs[:provider_params].present?
attrs[:provider_params].to_json
else
nil
end

DB.exec(
<<~SQL,
INSERT INTO embedding_definitions (id, display_name, dimensions, max_sequence_length, version, pg_function, provider, tokenizer_class, url, api_key, provider_params, seeded, created_at, updated_at)
Expand All @@ -185,7 +191,7 @@ def persist_config(attrs)
tokenizer_class: attrs[:tokenizer_class],
url: attrs[:url],
api_key: attrs[:api_key],
provider_params: attrs[:provider_params],
provider_params: provider_params_json,
seeded: !!attrs[:seeded],
now: Time.zone.now,
)
Expand Down

0 comments on commit cf11f82

Please sign in to comment.