What's the best way to keep the model registry up-to-date? #540
|
I know about |
Replies: 5 comments
|
Did you see any errors from refreshing or saving? |
|
I ran into this issue as well. I was working in a Rails application and for me the root cause was not understanding the relationship between the JSON file, what's in memory, and the database. Running the rake task pulls what is in the JSON file into the database, but does not necessarily include new models if the JSON file is out of date. In the end I skipped the JSON file and updated the database from memory: RubyLLM::Models.refresh!
model_class = RubyLLM.config.model_registry_class.constantize
model_class.save_to_databasePerhaps that logic could be added as an additional rake task. It is a bit YOLO-ish, since you don't always know what is going to get added and it would be required to be run in each environment. An alternative might be to recommend configuring the JSON file to be stored in the seeds directory and letting it be versioned. Then a seed file could be added that essentially runs the |
|
We've done it the following way:
RubyLLM.configure do |config|
config.model_registry_file = Rails.root.join("config/ruby_llm/models.json").to_s
end
RubyLLM.models.load_from_json!(RubyLLM.config.model_registry_file)
|
|
What are the pros of using the database and the Is just having |
|
If you've run the install generator,
|
If you've run the install generator,
RubyLLM.models.refreshalready persists into RubyLLM's own model table, so an initializer call keeps every environment in sync on each deploy without a JSON file. The database registry also tracks "unlisted" models so chats keep working even if a model disappears upstream. If you're not using the Rails integration,RubyLLM.models.refreshalone (no JSON) is fine too, though you lose the unlisted-model safety net. See https://rubyllm.com/models/ for details.