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:
Aaron Pham 2024-08-30 13:39:36 -04:00 committed by GitHub
parent 61acd714ba
commit b196627e86
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 9 additions and 15 deletions

View File

@ -62,10 +62,10 @@ M.defaults = {
---@type AvanteSupportedProvider
cohere = {
endpoint = "https://api.cohere.com/v1",
model = "command-r-plus",
model = "command-r-plus-08-2024",
timeout = 30000, -- Timeout in milliseconds
temperature = 0,
max_tokens = 3072,
max_tokens = 4096,
["local"] = false,
},
---To add support for custom provider, follow the format below
@ -233,7 +233,7 @@ M = setmetatable(M, {
M.support_paste_image = function()
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 })
end
return supported

View File

@ -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 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!
- For single-line changes, use the same number for start and end lines.
- For multi-line changes, ensure the range covers ALL affected lines, from the very first to the very last.
- 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 first to last.
- Double-check that your line numbers align perfectly with the original code structure.
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.
- 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 = [[

View File

@ -31,10 +31,7 @@ local M = {}
M.api_key_name = "CO_API_KEY"
M.parse_message = function(opts)
local user_prompt = ""
for _, user_prompt_ in ipairs(opts.user_prompts) do
user_prompt = user_prompt .. "\n\n" .. user_prompt_
end
local user_prompt = table.concat(opts.user_prompts, "\n\n")
return {
preamble = opts.system_prompt,
@ -75,7 +72,7 @@ M.parse_curl_args = function(provider, code_opts)
.. "."
.. 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()
end

View File

@ -28,10 +28,7 @@ local M = {}
M.api_key_name = "OPENAI_API_KEY"
M.parse_message = function(opts)
local user_prompt = ""
for _, user_prompt_ in ipairs(opts.user_prompts) do
user_prompt = user_prompt .. "\n\n" .. user_prompt_
end
local user_prompt = table.concat(opts.user_prompts, "\n\n")
---@type string | OpenAIMessage[]
local user_content