5
5
6
6
# SWEN3.Paperless.RabbitMq
7
7
8
- RabbitMQ messaging library for .NET with SSE support.
8
+ RabbitMQ messaging library for .NET with SSE support and AI-powered document summarization .
9
9
10
10
## Configuration
11
11
@@ -30,7 +30,7 @@ RabbitMQ messaging library for .NET with SSE support.
30
30
builder .Services .AddPaperlessRabbitMq (builder .Configuration );
31
31
32
32
// With SSE support
33
- builder . Services . AddPaperlessRabbitMq (configuration , includeOcrResultStream : true );
33
+ services . AddPaperlessRabbitMq (config , includeOcrResultStream : true , includeGenAiResultStream : true );
34
34
```
35
35
36
36
### Publishing
@@ -76,11 +76,37 @@ eventSource.addEventListener('ocr-completed', (event) => {
76
76
});
77
77
```
78
78
79
+ ### GenAI Support (v1.0.4+)
80
+
81
+ ``` csharp
82
+ // Enable GenAI features
83
+ builder .Services .AddPaperlessRabbitMq (configuration ,
84
+ includeOcrResultStream : true ,
85
+ includeGenAiResultStream : true );
86
+
87
+ // Configure Gemini
88
+ builder .Services .Configure <GeminiOptions >(configuration .GetSection (" Gemini" ));
89
+ builder .Services .AddHttpClient <ITextSummarizer , GeminiService >();
90
+ builder .Services .AddHostedService <GenAIWorker >();
91
+
92
+ // Publish GenAI command
93
+ var genAiCommand = new GenAICommand (request .JobId , result .Text ! );
94
+ await _publisher .PublishGenAICommandAsync (genAiCommand );
95
+ {
96
+ " Gemini" : {
97
+ " ApiKey" : " your-api-key" ,
98
+ " Model" : " gemini-2.0-flash"
99
+ }
100
+ }
101
+ ```
102
+
79
103
## Message Types
80
104
81
105
``` csharp
82
106
public record OcrCommand (Guid JobId , string FileName , string FilePath );
83
107
public record OcrEvent (Guid JobId , string Status , string ? Text , DateTimeOffset ProcessedAt );
108
+ public record GenAICommand (Guid DocumentId , string Text );
109
+ public record GenAIEvent (Guid DocumentId , string ? Summary , DateTimeOffset ProcessedAt , string ? ErrorMessage = null );
84
110
```
85
111
86
112
## Installation
0 commit comments