Skip to content

Commit

Permalink
Service: add handlers from code (temp release)
Browse files Browse the repository at this point in the history
  • Loading branch information
dluc committed Feb 20, 2024
1 parent be72b9d commit 5df8166
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions service/Service/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,22 @@ public static void Main(string[] args)
// appBuilder.Services.AddHandlerAsHostedService<...CLASS...>("...STEP NAME...");
// appBuilder.Services.AddHandlerAsHostedService("...assembly file name...", "...type full name...", "...STEP NAME...");

#if KernelMemoryDev
// Register all pipeline handlers defined in the configuration to run as hosted services
foreach (KeyValuePair<string, HandlerConfig> handlerConfig in config.Service.Handlers)
{
appBuilder.Services.AddHandlerAsHostedService(config: handlerConfig.Value, stepName: handlerConfig.Key);
}
#else
appBuilder.Services.AddHandlerAsHostedService<Microsoft.KernelMemory.Handlers.TextExtractionHandler>("extract");
appBuilder.Services.AddHandlerAsHostedService<Microsoft.KernelMemory.Handlers.TextPartitioningHandler>("partition");
appBuilder.Services.AddHandlerAsHostedService<Microsoft.KernelMemory.Handlers.GenerateEmbeddingsHandler>("gen_embeddings");
appBuilder.Services.AddHandlerAsHostedService<Microsoft.KernelMemory.Handlers.SaveRecordsHandler>("save_records");
appBuilder.Services.AddHandlerAsHostedService<Microsoft.KernelMemory.Handlers.SummarizationHandler>("summarize");
appBuilder.Services.AddHandlerAsHostedService<Microsoft.KernelMemory.Handlers.DeleteGeneratedFilesHandler>("delete_generated_files");
appBuilder.Services.AddHandlerAsHostedService<Microsoft.KernelMemory.Handlers.DeleteDocumentHandler>("private_delete_document");
appBuilder.Services.AddHandlerAsHostedService<Microsoft.KernelMemory.Handlers.DeleteIndexHandler>("private_delete_index");
#endif
}

// Some OpenAPI Explorer/Swagger dependencies
Expand Down

0 comments on commit 5df8166

Please sign in to comment.