chore(provider): use latest cohere models (#400)
Update prompts to correct grammar concat with table.concat to avoid overhead Signed-off-by: Aaron Pham <contact@aarnphm.xyz>
This commit is contained in:
parent
61acd714ba
commit
b196627e86
@ -62,10 +62,10 @@ M.defaults = {
|
|||||||
---@type AvanteSupportedProvider
|
---@type AvanteSupportedProvider
|
||||||
cohere = {
|
cohere = {
|
||||||
endpoint = "https://api.cohere.com/v1",
|
endpoint = "https://api.cohere.com/v1",
|
||||||
model = "command-r-plus",
|
model = "command-r-plus-08-2024",
|
||||||
timeout = 30000, -- Timeout in milliseconds
|
timeout = 30000, -- Timeout in milliseconds
|
||||||
temperature = 0,
|
temperature = 0,
|
||||||
max_tokens = 3072,
|
max_tokens = 4096,
|
||||||
["local"] = false,
|
["local"] = false,
|
||||||
},
|
},
|
||||||
---To add support for custom provider, follow the format below
|
---To add support for custom provider, follow the format below
|
||||||
@ -233,7 +233,7 @@ M = setmetatable(M, {
|
|||||||
|
|
||||||
M.support_paste_image = function()
|
M.support_paste_image = function()
|
||||||
local supported = Utils.has("img-clip.nvim") or Utils.has("img-clip")
|
local supported = Utils.has("img-clip.nvim") or Utils.has("img-clip")
|
||||||
if not supported and not M.options.silent_warning then
|
if not supported then
|
||||||
Utils.warn("img-clip.nvim is not installed. Pasting image will be disabled.", { once = true })
|
Utils.warn("img-clip.nvim is not installed. Pasting image will be disabled.", { once = true })
|
||||||
end
|
end
|
||||||
return supported
|
return supported
|
||||||
|
@ -51,8 +51,8 @@ Replace lines: {{start_line}}-{{end_line}}
|
|||||||
- The content regarding line numbers MUST strictly follow the format "Replace lines: {{start_line}}-{{end_line}}". Do not be lazy!
|
- The content regarding line numbers MUST strictly follow the format "Replace lines: {{start_line}}-{{end_line}}". Do not be lazy!
|
||||||
- The range {{start_line}}-{{end_line}} is INCLUSIVE. Both start_line and end_line are included in the replacement.
|
- The range {{start_line}}-{{end_line}} is INCLUSIVE. Both start_line and end_line are included in the replacement.
|
||||||
- Count EVERY line, including empty lines and comments lines, comments. Do not be lazy!
|
- Count EVERY line, including empty lines and comments lines, comments. Do not be lazy!
|
||||||
- For single-line changes, use the same number for start and end lines.
|
- Use the same number for start and end lines for single-line changes.
|
||||||
- For multi-line changes, ensure the range covers ALL affected lines, from the very first to the very last.
|
- For multi-line changes, ensure the range covers ALL affected lines, from first to last.
|
||||||
- Double-check that your line numbers align perfectly with the original code structure.
|
- Double-check that your line numbers align perfectly with the original code structure.
|
||||||
|
|
||||||
5. Final check:
|
5. Final check:
|
||||||
@ -63,7 +63,7 @@ Replace lines: {{start_line}}-{{end_line}}
|
|||||||
- Double-check that your line numbers align perfectly with the original code structure.
|
- Double-check that your line numbers align perfectly with the original code structure.
|
||||||
- DO NOT return the complete modified code with applied changes!
|
- DO NOT return the complete modified code with applied changes!
|
||||||
|
|
||||||
Remember: Accurate line numbers are CRITICAL. The range start_line to end_line must include ALL lines to be replaced, from the very first to the very last. Double-check every range before finalizing your response, paying special attention to the start_line to ensure it hasn't shifted down. Ensure that your line numbers perfectly match the original code structure without any overall shift.
|
Remember: Accurate line numbers are CRITICAL. The range start_line to end_line must include ALL lines to be replaced, from the very first to the very last. Double-check every range before finalizing your response, paying special attention to the start_line to ensure it hasn't shifted down. Ensure your line numbers match the original code structure without any overall shift.
|
||||||
]]
|
]]
|
||||||
|
|
||||||
local editing_mode_user_prompt_tpl = [[
|
local editing_mode_user_prompt_tpl = [[
|
||||||
|
@ -31,10 +31,7 @@ local M = {}
|
|||||||
M.api_key_name = "CO_API_KEY"
|
M.api_key_name = "CO_API_KEY"
|
||||||
|
|
||||||
M.parse_message = function(opts)
|
M.parse_message = function(opts)
|
||||||
local user_prompt = ""
|
local user_prompt = table.concat(opts.user_prompts, "\n\n")
|
||||||
for _, user_prompt_ in ipairs(opts.user_prompts) do
|
|
||||||
user_prompt = user_prompt .. "\n\n" .. user_prompt_
|
|
||||||
end
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
preamble = opts.system_prompt,
|
preamble = opts.system_prompt,
|
||||||
@ -75,7 +72,7 @@ M.parse_curl_args = function(provider, code_opts)
|
|||||||
.. "."
|
.. "."
|
||||||
.. vim.version().patch,
|
.. vim.version().patch,
|
||||||
}
|
}
|
||||||
if not P.env.is_local("openai") then
|
if not P.env.is_local("cohere") then
|
||||||
headers["Authorization"] = "Bearer " .. provider.parse_api_key()
|
headers["Authorization"] = "Bearer " .. provider.parse_api_key()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -28,10 +28,7 @@ local M = {}
|
|||||||
M.api_key_name = "OPENAI_API_KEY"
|
M.api_key_name = "OPENAI_API_KEY"
|
||||||
|
|
||||||
M.parse_message = function(opts)
|
M.parse_message = function(opts)
|
||||||
local user_prompt = ""
|
local user_prompt = table.concat(opts.user_prompts, "\n\n")
|
||||||
for _, user_prompt_ in ipairs(opts.user_prompts) do
|
|
||||||
user_prompt = user_prompt .. "\n\n" .. user_prompt_
|
|
||||||
end
|
|
||||||
|
|
||||||
---@type string | OpenAIMessage[]
|
---@type string | OpenAIMessage[]
|
||||||
local user_content
|
local user_content
|
||||||
|
Loading…
x
Reference in New Issue
Block a user