Basic checks
What's broken?
When loading a RubyLLM::Agent to continue a conversation, assume_model_exists is not loaded from the class config.
How to reproduce
Let's say you have an Agent, and a Chat that already exists. If you want to "continue" that chat, you'd probably do something like this:
class MyAgent < RubyLLM::Agent
model "gpt-6.7", provider: :openai, assume_model_exists: true
end
MyAgent.find(self.chat.id)
Expected behavior
The Chat loads fine, the configuration is applied, and assume_model_exists is passed through.
What actually happened
That will raise RubyLLM::ModelNotFoundError: Unknown model: gpt-6.7 for provider: openai, even though assume_model_exists is true.
Here's what's happening:
- MyAgent.find(chat_id) in loads the Chat record via ActiveRecord, then calls apply_configuration
- apply_configuration triggers to_llm, which creates a new RubyLLM::Chat with assume_model_exists: false (since the attr_accessor defaults to nil)
- That tries to resolve model gpt-6.7 in the model registry, fails with ModelNotFoundError
Environment
- Ruby 3.4.5
- RubyLLM 1.13.1
- Rails 8.1.2
Basic checks
What's broken?
When loading a RubyLLM::Agent to continue a conversation,
assume_model_existsis not loaded from the class config.How to reproduce
Let's say you have an Agent, and a Chat that already exists. If you want to "continue" that chat, you'd probably do something like this:
Expected behavior
The Chat loads fine, the configuration is applied, and
assume_model_existsis passed through.What actually happened
That will raise
RubyLLM::ModelNotFoundError: Unknown model: gpt-6.7 for provider: openai, even thoughassume_model_existsistrue.Here's what's happening:
Environment