Function to set score externally
I've recently been experimenting with elfeed and having a llm add tags to articles manually. I would also like to integrate this with elfeed-score, so I get the display functionality but have the llm give a score instead of using the score file. I saw there is the user defined functions in the documentation however they are ran synchronously which doesn't work with llm packages like gptel and would block the emacs process excessively even if it did. Is there a way to add a score to entries in the new-entry-hook that doesn't use the score file?
That's interesting. elfeed-score works by adding a function to elfeed-new-entry-hook. In that function, it runs all your scoring rules and updates the elfeed database (it adds a bit of metadata for the score, and can also adjust tags).
I'm unfamiliar with gptel-- what is the required execution model? In particular, why wouldn't a user-defined function work for this?
Gptel is asynchronous. It will send a request with a given prompt to a server running an AI model and run a callback function when it gets a response where as the user defined functions for this must be synchronous and directly return a score
On 12 Jul 2025, at 09:48, Michael @.***> wrote:
[https://avatars.githubusercontent.com/u/17716788?s=20&v=4]sp1ff left a comment (sp1ff/elfeed-score#35)https://github.com/sp1ff/elfeed-score/issues/35#issuecomment-3064277336
That's interesting. elfeed-score works by adding a function to elfeed-new-entry-hook. In that function, it runs all your scoring rules and updates the elfeed database (it adds a bit of metadata for the score, and can also adjust tags). I'm unfamiliar with gptel-- what is the required execution model? In particular, why wouldn't a user-defined function work for this?
— Reply to this email directly, view it on GitHubhttps://github.com/sp1ff/elfeed-score/issues/35#issuecomment-3064277336, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFMGHT3G7O6VBGLAN73JJEL3IBENXAVCNFSM6AAAAACAORX25CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTANRUGI3TOMZTGY. You are receiving this because you authored the thread.Message ID: @.***>
Alright, so you could author a user-defined function that would:
- fire off the request to the LLM
- hold on to the id of the entry (by wrapping the callback in a lambda that captures it, say)
- return immediately with a result of
nilLater, when the callback is invoked, lookup the entry & invokeelfeed-score-scoring-set-score-on-entry. Could that work?