get session id within a recipe

Hi! The session ID is only assigned when a user opens the app and makes a request to the server requesting a new batch of questions. There's not currently an in-recipe way to access it, because it's only available once the stream is already executing. So if you want fine-grained control like this within the recipe script, you'd currently have to use separate instances of Prodigy with different datasets, or the same dataset and sessions / annotator names / etc. set via the command line. This thread shows a flexible solution for this:

(I've been thinking about ways to make session-aware streams work without breaking backwards compatibility. Maybe we could introduce another callback that's executed when a session ID is assigned.)

Ah, this should be from prodigy.core import Controller. Will fix that. However, using it like this wouldn't work for your use case, since the Controller is the base class, and what you're looking for is the instance of the controller used for your current Prodigy session.

1 Like