chore(llm): cut-back support (#159)
Signed-off-by: Aaron Pham <contact@aarnphm.xyz>
This commit is contained in:
parent
6475407d0d
commit
c6d5073945
19
README.md
19
README.md
@ -99,7 +99,7 @@ _See [config.lua#L9](./lua/avante/config.lua) for the full config_
|
|||||||
|
|
||||||
```lua
|
```lua
|
||||||
{
|
{
|
||||||
---@alias Provider "openai" | "claude" | "azure" | "deepseek" | "groq" | "copilot" | [string]
|
---@alias Provider "openai" | "claude" | "azure" | "copilot" | [string]
|
||||||
provider = "claude",
|
provider = "claude",
|
||||||
claude = {
|
claude = {
|
||||||
endpoint = "https://api.anthropic.com",
|
endpoint = "https://api.anthropic.com",
|
||||||
@ -155,6 +155,11 @@ _See [config.lua#L9](./lua/avante/config.lua) for the full config_
|
|||||||
|
|
||||||
Given its early stage, `avante.nvim` currently supports the following basic functionalities:
|
Given its early stage, `avante.nvim` currently supports the following basic functionalities:
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
>
|
||||||
|
> Avante will only support OpenAI (and its variants including copilot and azure), and Claude out-of-the-box due to its high code quality generation.
|
||||||
|
> For all OpenAI-compatible providers, see [wiki](https://github.com/yetone/avante.nvim/wiki) for more details.
|
||||||
|
|
||||||
> [!IMPORTANT]
|
> [!IMPORTANT]
|
||||||
>
|
>
|
||||||
> For most consistency between neovim session, it is recommended to set the environment variables in your shell file.
|
> For most consistency between neovim session, it is recommended to set the environment variables in your shell file.
|
||||||
@ -177,18 +182,6 @@ Given its early stage, `avante.nvim` currently supports the following basic func
|
|||||||
> ```sh
|
> ```sh
|
||||||
> export AZURE_OPENAI_API_KEY=your-api-key
|
> export AZURE_OPENAI_API_KEY=your-api-key
|
||||||
> ```
|
> ```
|
||||||
>
|
|
||||||
> For DeepSeek
|
|
||||||
>
|
|
||||||
> ```sh
|
|
||||||
> export DEEPSEEK_API_KEY=you-api-key
|
|
||||||
> ```
|
|
||||||
>
|
|
||||||
> For Groq
|
|
||||||
>
|
|
||||||
> ```sh
|
|
||||||
> export GROQ_API_KEY=you-api-key
|
|
||||||
> ```
|
|
||||||
|
|
||||||
1. Open a code file in Neovim.
|
1. Open a code file in Neovim.
|
||||||
2. Use the `:AvanteAsk` command to query the AI about the code.
|
2. Use the `:AvanteAsk` command to query the AI about the code.
|
||||||
|
@ -7,9 +7,9 @@ local M = {}
|
|||||||
---@class avante.Config
|
---@class avante.Config
|
||||||
M.defaults = {
|
M.defaults = {
|
||||||
debug = false,
|
debug = false,
|
||||||
---Currently, default supported providers include "claude", "openai", "azure", "deepseek", "groq", "gemini"
|
---Currently, default supported providers include "claude", "openai", "azure", "gemini"
|
||||||
---For custom provider, see README.md
|
---For custom provider, see README.md
|
||||||
---@alias Provider "openai" | "claude" | "azure" | "deepseek" | "groq" | "copilot" | "gemini" | string
|
---@alias Provider "openai" | "claude" | "azure" | "copilot" | "gemini" | string
|
||||||
provider = "claude",
|
provider = "claude",
|
||||||
---@type AvanteSupportedProvider
|
---@type AvanteSupportedProvider
|
||||||
openai = {
|
openai = {
|
||||||
@ -27,7 +27,7 @@ M.defaults = {
|
|||||||
allow_insecure = false, -- Allow insecure server connections
|
allow_insecure = false, -- Allow insecure server connections
|
||||||
timeout = 30000, -- Timeout in milliseconds
|
timeout = 30000, -- Timeout in milliseconds
|
||||||
temperature = 0,
|
temperature = 0,
|
||||||
max_tokens = 8192,
|
max_tokens = 4096,
|
||||||
},
|
},
|
||||||
---@type AvanteAzureProvider
|
---@type AvanteAzureProvider
|
||||||
azure = {
|
azure = {
|
||||||
@ -46,22 +46,6 @@ M.defaults = {
|
|||||||
temperature = 0,
|
temperature = 0,
|
||||||
max_tokens = 4096,
|
max_tokens = 4096,
|
||||||
},
|
},
|
||||||
---@type AvanteSupportedProvider
|
|
||||||
deepseek = {
|
|
||||||
endpoint = "https://api.deepseek.com",
|
|
||||||
model = "deepseek-coder",
|
|
||||||
temperature = 0,
|
|
||||||
max_tokens = 4096,
|
|
||||||
["local"] = false,
|
|
||||||
},
|
|
||||||
---@type AvanteSupportedProvider
|
|
||||||
groq = {
|
|
||||||
endpoint = "https://api.groq.com",
|
|
||||||
model = "llama-3.1-70b-versatile",
|
|
||||||
temperature = 0,
|
|
||||||
max_tokens = 4096,
|
|
||||||
["local"] = false,
|
|
||||||
},
|
|
||||||
---@type AvanteGeminiProvider
|
---@type AvanteGeminiProvider
|
||||||
gemini = {
|
gemini = {
|
||||||
endpoint = "https://generativelanguage.googleapis.com/v1beta/models",
|
endpoint = "https://generativelanguage.googleapis.com/v1beta/models",
|
||||||
|
@ -1,41 +0,0 @@
|
|||||||
local Utils = require("avante.utils")
|
|
||||||
local Config = require("avante.config")
|
|
||||||
local P = require("avante.providers")
|
|
||||||
local O = require("avante.providers").openai
|
|
||||||
|
|
||||||
---@class AvanteProviderFunctor
|
|
||||||
local M = {}
|
|
||||||
|
|
||||||
M.api_key_name = "DEEPSEEK_API_KEY"
|
|
||||||
|
|
||||||
M.has = function()
|
|
||||||
return os.getenv(M.api_key_name) and true or false
|
|
||||||
end
|
|
||||||
|
|
||||||
M.parse_message = O.parse_message
|
|
||||||
M.parse_response = O.parse_response
|
|
||||||
|
|
||||||
M.parse_curl_args = function(provider, code_opts)
|
|
||||||
local base, body_opts = P.parse_config(provider)
|
|
||||||
|
|
||||||
local headers = {
|
|
||||||
["Content-Type"] = "application/json",
|
|
||||||
}
|
|
||||||
if not P.env.is_local("deepseek") then
|
|
||||||
headers["Authorization"] = "Bearer " .. os.getenv(base.api_key_name or M.api_key_name)
|
|
||||||
end
|
|
||||||
|
|
||||||
return {
|
|
||||||
url = Utils.trim(base.endpoint, { suffix = "/" }) .. "/chat/completions",
|
|
||||||
proxy = base.proxy,
|
|
||||||
insecure = base.allow_insecure,
|
|
||||||
headers = headers,
|
|
||||||
body = vim.tbl_deep_extend("force", {
|
|
||||||
model = base.model,
|
|
||||||
messages = M.parse_message(code_opts),
|
|
||||||
stream = true,
|
|
||||||
}, body_opts),
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
@ -1,41 +0,0 @@
|
|||||||
local Utils = require("avante.utils")
|
|
||||||
local Config = require("avante.config")
|
|
||||||
local P = require("avante.providers")
|
|
||||||
local O = require("avante.providers").openai
|
|
||||||
|
|
||||||
---@class AvanteProviderFunctor
|
|
||||||
local M = {}
|
|
||||||
|
|
||||||
M.api_key_name = "GROQ_API_KEY"
|
|
||||||
|
|
||||||
M.has = function()
|
|
||||||
return os.getenv(M.api_key_name) and true or false
|
|
||||||
end
|
|
||||||
|
|
||||||
M.parse_message = O.parse_message
|
|
||||||
M.parse_response = O.parse_response
|
|
||||||
|
|
||||||
M.parse_curl_args = function(provider, code_opts)
|
|
||||||
local base, body_opts = P.parse_config(provider)
|
|
||||||
|
|
||||||
local headers = {
|
|
||||||
["Content-Type"] = "application/json",
|
|
||||||
}
|
|
||||||
if not P.env.is_local("groq") then
|
|
||||||
headers["Authorization"] = "Bearer " .. os.getenv(base.api_key_name or M.api_key_name)
|
|
||||||
end
|
|
||||||
|
|
||||||
return {
|
|
||||||
url = Utils.trim(base.endpoint, { suffix = "/" }) .. "/openai/v1/chat/completions",
|
|
||||||
proxy = base.proxy,
|
|
||||||
insecure = base.allow_insecure,
|
|
||||||
headers = headers,
|
|
||||||
body = vim.tbl_deep_extend("force", {
|
|
||||||
model = base.model,
|
|
||||||
messages = M.parse_message(code_opts),
|
|
||||||
stream = true,
|
|
||||||
}, body_opts),
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
@ -88,9 +88,7 @@ local Dressing = require("avante.ui.dressing")
|
|||||||
---@field copilot AvanteProviderFunctor
|
---@field copilot AvanteProviderFunctor
|
||||||
---@field claude AvanteProviderFunctor
|
---@field claude AvanteProviderFunctor
|
||||||
---@field azure AvanteProviderFunctor
|
---@field azure AvanteProviderFunctor
|
||||||
---@field deepseek AvanteProviderFunctor
|
|
||||||
---@field gemini AvanteProviderFunctor
|
---@field gemini AvanteProviderFunctor
|
||||||
---@field groq AvanteProviderFunctor
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
setmetatable(M, {
|
setmetatable(M, {
|
||||||
@ -224,7 +222,7 @@ function M.refresh(provider)
|
|||||||
require("avante.config").override({ provider = provider })
|
require("avante.config").override({ provider = provider })
|
||||||
end
|
end
|
||||||
|
|
||||||
local default_providers = { "openai", "claude", "azure", "deepseek", "groq", "gemini", "copilot" }
|
local default_providers = { "openai", "claude", "azure", "gemini", "copilot" }
|
||||||
|
|
||||||
---@private
|
---@private
|
||||||
M.commands = function()
|
M.commands = function()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user