Okay, so I'm going to put aside all my extreme disapproval of such a feature because all the criticism toward the LLM have already been presented (and because, if I start to add my voice, it will absolutly not became polite),
and so I will only talk about your implementation as presented in your PR:
Actualy, you implementaion use a third party service to uniforme the API call wich raise a great concern of my part. If this can easier the task, I realy not confident to depend to a third party service wich on existence and continuity is not guaranteed for use others third party services.
Think about it: What happen if OpenRouter shutdown? Whether it's for an hour, a day, or permanently? We cannot use any LLM service.
No, the better way is to implement it in the same way that the devices do: Create a Base class that will be herited by other class that individualy implement the code for a single LLM. Then, in the GUI, the user select the third party service wich they want to use it, and fill the specific settings and parameters.
calibre/gui2/viewer/llm/__init__.py -> contain the Base class inherited in others API call.
calibre/gui2/viewer/llm/openrouter.py -> contain the code for running OpenRouter
calibre/gui2/viewer/llm/chatgpt.py -> contain the code for running Chat-GPT
...
But that implie to implements the code for many LLM services. I don't very know how is the technical side of the LLM landscape, but from what I can see, it is constantly changing, which means that their API is too... which means that the code implemented in Calibre as a high risk to become obsolete and non-functional.
So, it would be possible to implement the feature in the same way as the Bookstore, which can be shared across Calibre versions, but that would not change the fact that its implementation would require a active maintenance (and a potentialy high level of) to satisfy a niche use case.
More I think about, more I think that it would not be a good idea to implement any LLM feature into Calibre, primary because of the implementation behind is the biggest concern.
I accept that I'm not a great programmer, and so my concern and critique is certainly very imperfect, but I'm very very concern that is a bad idea for the the long term health of Calibre's development and maintenance.
Last edited by un_pogaz; 08-10-2025 at 08:26 AM.
|