55
66# SWEN3.Paperless.RabbitMq
77
8- RabbitMQ messaging library for .NET with SSE support.
8+ RabbitMQ messaging library for .NET with SSE support and AI-powered document summarization .
99
1010## Configuration
1111
@@ -30,7 +30,7 @@ RabbitMQ messaging library for .NET with SSE support.
3030builder .Services .AddPaperlessRabbitMq (builder .Configuration );
3131
3232// With SSE support
33- builder . Services . AddPaperlessRabbitMq (configuration , includeOcrResultStream : true );
33+ services . AddPaperlessRabbitMq (config , includeOcrResultStream : true , includeGenAiResultStream : true );
3434```
3535
3636### Publishing
@@ -76,11 +76,37 @@ eventSource.addEventListener('ocr-completed', (event) => {
7676});
7777```
7878
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+
79103## Message Types
80104
81105``` csharp
82106public record OcrCommand (Guid JobId , string FileName , string FilePath );
83107public 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 );
84110```
85111
86112## Installation
0 commit comments