dragon.ai.inference.reader_utils.ReadWorker

class ReadWorker[source]

Bases: object

Handles reading from the response queue and returning the response to the front end. Also terminates reading as soon as the expected number of inputs have been received.

__init__(q, end_ev)[source]

Methods

__init__(q, end_ev)

read(num_prompts)

Return responses to the prompter until all prompts are read.

__init__(q, end_ev)[source]
read(num_prompts)[source]

Return responses to the prompter until all prompts are read.

The worker sits inside a loop and continuously reads from a response queue. It exits when the expected number of prompts has been read and the end event is set.

Parameters:

num_prompts (int ) – Number of expected input prompts to read.