Skip to content

Decouple Code Suggestions engine classes to better follow the clean architecture approach

Problem to solve

Our existing ModelEngineCompletions and ModelEngineGenerations classes implement the full workflow that includes pre-processing, model call, and post-processing. This approach makes it difficult to test individual components and is not flexible if we need to switch off pre-processing, for instance - example.

Existing architecture:

Proposal

The initial plan was to follow the clean architecture approach - https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html. Please, consider changing the existing architecture to:

The new architecture allows us to build as many use-cases (CodeCompletions, CodeGenerations) as we need with different configurations - with pre-/post-processing, with post-processing only, etc. We also avoid connecting our components into the chain which complicates testing.

Edited by Alexander Chueshev