add local llama.cpp

This commit is contained in:
2025-02-23 22:03:10 -08:00
parent c9631baf48
commit 283b2540ee
2 changed files with 23 additions and 14 deletions

View File

@@ -31,13 +31,23 @@ return {
end,
llama_cpp = function()
return require("codecompanion.adapters").extend("openai_compatible", {
name = "llama-cpp",
name = "llama.cpp",
formatted_name = "llama.cpp",
opts = {
stream = true,
stream = false,
},
schema = {
model = {
default = "qwen2.5-coder-14b-instruct",
choices = {
["qwen2.5-coder-14b-instruct"] = { opts = { can_reason = true } },
["/models/lmstudio-community/DeepSeek-R1-Distill-Qwen-7B-GGUF/DeepSeek-R1-Distill-Qwen-7B-Q4_K_M.gguf"] = {
opts = { can_reason = true },
},
["/models/lmstudio-community/Qwen2.5-7B-Instruct-1M-GGUF/Qwen2.5-7B-Instruct-1M-Q4_K_M.gguf"] = {
opts = { can_reason = true },
},
},
},
temperature = {
order = 2,
@@ -45,7 +55,6 @@ return {
type = "number",
optional = true,
default = 0.2,
desc = "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or top_p but not both.",
validate = function(n)
return n >= 0 and n <= 2, "Must be between 0 and 2"
end,
@@ -60,11 +69,11 @@ return {
},
strategies = {
chat = {
adapter = "llama_cpp",
adapter = "copilot",
roles = {
-- llm = " Assistant",
llm = function(adapter)
return "CodeCompanion (" .. adapter.formatted_name .. ")"
print(vim.inspect(adapter))
return " Assistant (" .. adapter.formatted_name .. " - " .. adapter.parameters.model .. ")"
end,
user = " User",
},