-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In this setup the different roles of the processing are running in different processes. These processes are calling into a task manager in order to communicate with each other vai state transition (encoded in the `status` of the `Task` messages). The clients are mock implementations, and only contain example of the GRPC calls. How to try it: * Create a venv * Install the packages defined in `requirements.txt` * Run `build.sh` to generate the message and service stubs * Start the task manager first which fires up a GRPC server storing tasks * Run the client keyboard listener. This contains a mock regarding what the keyboard listener should call once the OCR complete * Run the llm worker to show an example of how the llm processing should happen. Pro tip: To increase parallelism, one can start more of these. This takes tasks with `question` and should call the LLM to fill out the `answer`. * The UI is an example of how to access processed (answered) tasks.
- Loading branch information
Showing
10 changed files
with
586 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
**/__pycache__/** | ||
**/*.log | ||
|
||
aihub/aihub_pb2.py | ||
aihub/aihub_pb2.pyi | ||
aihub/aihub_pb2_grpc.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
syntax = "proto3"; | ||
|
||
import "google/protobuf/empty.proto"; | ||
|
||
package aihub; | ||
|
||
service AIHub { | ||
// 0 -> NEW | ||
// Assumed only the field `question` is peresnt in the input task. | ||
// The returned task has `status` set to `NEW` and `id` is present. | ||
rpc AddNewTask (Task) returns (Task) {} | ||
|
||
// NEW -> GENERATING_ANSWER | ||
// Assumed `id` and `question` are present, `status` is set to | ||
// `GENERATING_ANSWER` in the returned task. | ||
rpc StartGeneratingAnswer(google.protobuf.Empty) returns (Task) {} | ||
|
||
// GENERATING_ANSWER -> ANSWER_AVAILABLE | ||
// Assumed the `id` and the `answer` is present in the input task. | ||
// The returned task has `status` set to `ANSWER_AVAILABLE`. | ||
rpc AddAnswer (Task) returns (Task) {} | ||
|
||
// ANSWER_AVAILABLE -> 0 | ||
// Assumed `status` is set to `ANSWER_AVAILABLE`. | ||
rpc RemoveProcessedQuestion(google.protobuf.Empty) returns (Task) {} | ||
} | ||
|
||
enum TaskStatus { | ||
NEW = 0; | ||
GENERATING_ANSWER = 1; | ||
ANSWER_AVAILABLE = 2; | ||
} | ||
|
||
message Task { | ||
int64 id = 1; | ||
TaskStatus status = 2; | ||
string question = 3; | ||
string answer = 4; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.