2025-01-25 08:10:58 -06:00
|
|
|
local OLLAMA_TOKEN = os.getenv("OLLAMA_TOKEN")
|
2025-04-05 07:00:35 -05:00
|
|
|
local OPENAI_TOKEN = os.getenv("OPENAI_TOKEN")
|
2025-05-02 06:09:07 -05:00
|
|
|
local GEMINI_TOKEN = os.getenv("GEMINI_TOKEN")
|
2025-09-27 07:13:57 -05:00
|
|
|
local ANTHROPIC_TOKEN = os.getenv("ANTHROPIC_TOKEN")
|
2025-01-25 08:10:58 -06:00
|
|
|
return {
|
|
|
|
|
{
|
|
|
|
|
"olimorris/codecompanion.nvim",
|
|
|
|
|
dependencies = {
|
|
|
|
|
"nvim-lua/plenary.nvim",
|
|
|
|
|
"nvim-treesitter/nvim-treesitter",
|
|
|
|
|
},
|
|
|
|
|
config = true,
|
|
|
|
|
opts = {
|
|
|
|
|
strategies = {
|
2025-07-17 06:47:25 -05:00
|
|
|
chat = { adapter = "ollama", model = "mistral:latest" },
|
2025-01-25 08:10:58 -06:00
|
|
|
},
|
|
|
|
|
adapters = {
|
2025-03-28 14:47:40 -05:00
|
|
|
opts = {
|
|
|
|
|
show_defaults = false,
|
|
|
|
|
},
|
2025-05-02 06:09:07 -05:00
|
|
|
gemini = function()
|
|
|
|
|
return require("codecompanion.adapters").extend("gemini", {
|
|
|
|
|
name = "gemini",
|
|
|
|
|
schema = {
|
|
|
|
|
model = {
|
|
|
|
|
default = "gemini-2.0-flash",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
env = {
|
|
|
|
|
api_key = GEMINI_TOKEN,
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
end,
|
2025-09-27 07:13:57 -05:00
|
|
|
anthropic = function()
|
|
|
|
|
return require("codecompanion.adapters").extend(
|
|
|
|
|
"anthropic",
|
|
|
|
|
{
|
|
|
|
|
name = "anthropic",
|
|
|
|
|
schema = {
|
|
|
|
|
model = {
|
|
|
|
|
default = "claude-3-haiku-20240307",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
env = {
|
|
|
|
|
api_key = ANTHROPIC_TOKEN,
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
end,
|
2025-03-28 14:47:40 -05:00
|
|
|
openai = function()
|
|
|
|
|
return require("codecompanion.adapters").extend("openai", {
|
2025-04-02 05:53:11 -05:00
|
|
|
name = "openai",
|
2025-03-28 14:47:40 -05:00
|
|
|
schema = {
|
|
|
|
|
model = {
|
2025-08-30 07:00:35 -05:00
|
|
|
default = "gpt-4o-mini",
|
2025-03-28 14:47:40 -05:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
env = {
|
2025-04-05 07:00:35 -05:00
|
|
|
api_key = OPENAI_TOKEN,
|
2025-03-28 14:47:40 -05:00
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
end,
|
2025-01-25 08:10:58 -06:00
|
|
|
ollama = function()
|
|
|
|
|
return require("codecompanion.adapters").extend("ollama", {
|
2025-04-02 05:53:11 -05:00
|
|
|
name = "ollama",
|
2025-01-25 08:10:58 -06:00
|
|
|
schema = {
|
|
|
|
|
model = {
|
2026-01-06 15:40:54 -06:00
|
|
|
default = "llama3.1:8b",
|
2025-01-25 08:10:58 -06:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
env = {
|
2025-04-01 05:57:21 -05:00
|
|
|
url = "https://ollama.durp.info",
|
2025-01-25 08:10:58 -06:00
|
|
|
},
|
|
|
|
|
headers = {
|
|
|
|
|
["Content-Type"] = "application/json",
|
|
|
|
|
["Authorization"] = OLLAMA_TOKEN,
|
|
|
|
|
},
|
|
|
|
|
parameters = {
|
|
|
|
|
sync = true,
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
end,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|