2024-07-02 21:52:43 +00:00
|
|
|
local explain_prompt = [[
|
|
|
|
Explain this Code short and Precise:
|
|
|
|
$fname
|
|
|
|
```$ftype
|
|
|
|
$buf
|
|
|
|
```
|
|
|
|
---
|
|
|
|
]]
|
|
|
|
|
|
|
|
local generate_prompt = [[
|
|
|
|
<|fim_prefix|>$before<|fim_suffix|>$after<|fim_middle|>
|
|
|
|
]]
|
|
|
|
|
|
|
|
return {
|
2024-07-02 22:18:54 +00:00
|
|
|
"nomnivore/ollama.nvim",
|
2024-07-02 21:52:43 +00:00
|
|
|
config = function()
|
|
|
|
local ollama = require('ollama')
|
|
|
|
ollama.setup({
|
|
|
|
model = 'codegemma:instruct',
|
|
|
|
prompts = {
|
|
|
|
Ask_About_Code = false,
|
|
|
|
Modify_Code = false,
|
|
|
|
Raw = false,
|
|
|
|
Simplify_Code = false,
|
|
|
|
Explain_Code = {
|
|
|
|
model = 'codegemma:instruct',
|
|
|
|
prompt = explain_prompt,
|
|
|
|
input_label = '>',
|
|
|
|
action = require('ollama.actions.factory').create_action({
|
|
|
|
display = true,
|
|
|
|
window = 'vsplit',
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
Generate_Code = {
|
|
|
|
model = 'codegemma:2b-code',
|
|
|
|
prompt = generate_prompt,
|
|
|
|
input_label = '>',
|
|
|
|
action = 'display',
|
|
|
|
options = {
|
|
|
|
num_predict = 128,
|
|
|
|
temperature = 0.0,
|
|
|
|
top_p = 0.9,
|
|
|
|
stop = { '<|file_separator|>' },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
vim.keymap.set(
|
|
|
|
'n',
|
|
|
|
'<leader>op',
|
|
|
|
ollama.prompt,
|
|
|
|
{ desc = 'Ollama Prompt' }
|
|
|
|
)
|
|
|
|
end,
|
|
|
|
}
|