Skip to content

POC: implementing Code Generation using Abstraction layer

Gosia Ksionek requested to merge mk-abstraction-layer-cs into master

What does this MR do and why?

POC of implementing Code Generation using Abstraction layer.

Authored by @georgekoltsov and myself.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

user = User.first
project = Project.last # please use project that have some actual code there
content = project.repository.blob_at('main', '[WebGoat.NET](http://WebGoat.NET).sln').data # first argument is a branch name, second: the path to the file you want to test that with. It needs to have more that 15 lines

ai_completion = Gitlab::Llm::CompletionsFactory.completion('suggest_code'.to_sym, {})

Feature.enable(:suggest_code, project)

params = {
  message: {
    content: content,
    cursor_position: [15, 1],
    related_contents: []
  }
}

ai_completion.execute(user, project, params)

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports