blob: 1ec3d9e14647a77b8661b9efd8b142714b6798b7 [file] [log] [blame] [view]
Trevor Gettyad49b192024-10-09 19:13:52 +01001# Hackathon Outcome: Generalising the chat-gpt-plugin
2
3A requirement has been raised by customers of Gerrit that they would love to have the functionality shown
4by the current [chatgpt-code-review-gerrit-plugin](https://github.com/amarula/chatgpt-code-review-gerrit-plugin/),
5without the need of sending important Intellectual Property, to a public service.
6
7As such during the hackathon it was accepted that it would be good to take the current chat-gpt gerrit plugin
8and to create a more generic `ai-code-review` plugin that could be used with on-premise, private hosted or public AI services.
9
10The starting point of this was to create a fork of the current chatgpt plugin, in the gerritcodereview section
11under [plugins/ai-code-review](https://gerrit-review.googlesource.com/admin/repos/plugins/ai-code-review).
12
13All classes that are not chatGPT specific, which is most of them, including the configuration
14options where to be generally renamed.
15
16e.g. gptModel -> aiModel
17 gptToken -> aiToken
18
19A great benefit was that ollama has now extended their API with the OpenAPI specification so that they present
20an endpoint which allows compatiblity with chatGPT OpenAPI specification for requests and responses.
21
22## AIType Support
23A new concept has been added to the plugin to allow the specification of different AITypes.
24
25As such a new configuration option called `aiType` can be specified as follows:
26 - CHATGPT (default if not specified)
27 - OLLAMA
28 - GENERIC
29
30### OLLAMA
31The ollama AI service, must be run against a model which supports the "tools" and "functions" extensions so that the
32response object can be easily specified to return in the correct JSON schema by the prompt. Without this the default
33is to return markdown json, which would require much more processing on the client side.
34So make sure that the OLLAMA model you choose appears in this list:
35[ollama models (tools-filter)](https://ollama.com/search?c=tools)
36
37### GENERIC
38The generic ai service ability has been added, to more easily test against a potentially new or not yet supported
39endpoint. It does so by allowing you to specify the authorization header (key: `aiAuthHeaderName`), along with the
40different API endpoint URI (key: `aiChatEndpoint`) which can be used for the code review.
41e.g. instead of /v1/chat/completions it might be /api/chat
42
43
44*[Trevor Getty, Software Architect / Cirata](../speakers.md#trevorgetty)*