calm-artist-7206
08/25/2025, 3:31 PMConversationStats) that the LLM configuration changed (and from/to what config), so that it can do its stats
- this means that client code, like agent, condenser, can be completely unaware of LLM switching, and just use its self.llm. The register/switch/notify mechanism will send new calls to the reconfigured LLM.
For option 1, I have a PR here to see how it looks like:
- https://github.com/All-Hands-AI/OpenHands/pull/9800
- it's actually a very simple PR (though it might not be obvious in github UI): it decouples all configuring code from LLM init
- so that the LLMRegistry can call llm.reinit in its switch handler => reinit resets all config of the LLM instance and replaces it with the new configuration.
2. create a new LLM instance, and switch it in the LLMRegistry mapping
- the registry notifies ConversationStats that the active LLM for a particular service is now different (from/to what LLM)
- this raises a question though: client components, like agent, condenser, hold a self.llm instance, which has now become stale. How do they know that it's stale?
For option 2, it seems to me we have two ways to answer how to handle stale:
2.1 make agent / condenser / etc, all llm-using components in the system, also observers of the LLMRegistry, like ConversationStats
2.2 give them a self.llm_registry instead of a self.llm, so they always have to use registry.get_llm() instead of instances.
What do you think? Cc: @chilly-france-44439 @full-greece-2387 @quick-window-91705quick-window-91705
08/25/2025, 4:51 PMlimited-student-10747
08/25/2025, 4:53 PMquiet-night-61895
08/28/2025, 5:56 PMlimited-student-10747
08/28/2025, 5:57 PMgentle-apple-32922
08/28/2025, 7:26 PM