rj1
log | files | refs
commit 30cb1b20dade1687da9eefb0ad76cd572eb3d88a
parent a8f07b8c9ed76cc893eff549f031fd54064eb14e
author: rj1 <[email protected]>
date:   Sat, 18 May 2024 11:34:29 -0600

nvim: started using groq with gp.nvim

Diffstat:
M.config/nvim/lua/rj1/ai.lua | 44+++++++++++++++++++++++++++-----------------
1 file changed, 27 insertions(+), 17 deletions(-)

diff --git a/.config/nvim/lua/rj1/ai.lua b/.config/nvim/lua/rj1/ai.lua @@ -19,7 +19,6 @@ end ]] end, { noremap = true }) ]] --- openai local function fetch_openai_key() local handle = io.popen("pass dev/openai.com/openai_key") if handle ~= nil then @@ -29,30 +28,41 @@ local function fetch_openai_key() end end +local function fetch_groq_key() + local handle = io.popen("pass dev/groq.com/nvim_key") + if handle ~= nil then + local key = string.gsub(handle:read("*a"), "\n", "") + handle:close() + return key + end +end + require("gp").setup({ + providers = { + openai = { + endpoint = "https://api.groq.com/openai/v1/chat/completions", + secret = fetch_groq_key(), + }, + }, agents = { - { name ="ChatGPT4" }, - { name ="ChatGPT3-5" }, { name = "dev", + provider = "openai", chat = true, command = false, - -- model = { model = "gpt-3.5-turbo-16k", temperature = 1.1, top_p = 1 }, - model = { model = "gpt-3.5-turbo-1106", temperature = 1.1, top_p = 1 }, + model = { model = "llama3-70b-8192", temperature = 1.1, top_p = 1 }, system_prompt = "You are an AI assistant for a professional programmer.\n\n" - .. "The user provided the additional info about how they would like you to respond:\n\n" - .. "- If you're unsure don't guess and say you don't know instead.\n" - .. "- Ask question if you need clarification to provide a better answer.\n" - .. "- Think deeply and carefully from first principles, going through the problem step by step.\n" - .. "- Zoom out first to see the big picture and then zoom in to details.\n" - .. "- Use the Socratic method to improve your thinking and coding skills.\n" - .. "- Don't exclude any code from your output if the answer requires coding.\n" - .. "- Take a deep breath; You've got this!\n", + .. "The user provided the additional info about how they would like you to respond:\n\n" + .. "- If you're unsure don't guess and say you don't know instead.\n" + .. "- Ask question if you need clarification to provide a better answer.\n" + .. "- Think deeply and carefully from first principles, going through the problem step by step.\n" + .. "- Zoom out first to see the big picture and then zoom in to details.\n" + .. "- Use the Socratic method to improve your thinking and coding skills.\n" + .. "- Don't exclude any code from your output if the answer requires coding.\n" + .. "- Take a deep breath; You've got this!\n", }, }, - openai_api_key = fetch_openai_key(), - openai_api_endpoint = "https://api.openai.com/v1/chat/completions", - chat_dir = vim.fn.stdpath("data"):gsub("/$", "") .. "/chatgpt/chats", + chat_dir = vim.fn.stdpath("data"):gsub("/$", "") .. "/ai/chats", chat_user_prefix = "## prompt", - chat_assistant_prefix = "## response", + chat_assistant_prefix = "## response ", })