From cd13eeb7d9093b74b14da7382d49addbf9846f04 Mon Sep 17 00:00:00 2001 From: yetone Date: Thu, 27 Mar 2025 16:53:55 +0800 Subject: [PATCH] fix: revert max_completion_tokens to max_tokens (#1741) --- .github/workflows/lua.yaml | 2 +- README.md | 2 +- cursor-planning-mode.md | 2 +- lua/avante/config.lua | 4 ++-- lua/avante/providers/azure.lua | 2 +- lua/avante/providers/openai.lua | 2 -- lua/avante/types.lua | 1 - 7 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/lua.yaml b/.github/workflows/lua.yaml index 2320e7d..89fdd02 100644 --- a/.github/workflows/lua.yaml +++ b/.github/workflows/lua.yaml @@ -82,7 +82,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - nvim_version: [ stable ] + nvim_version: [ "v0.10.4" ] luals_version: [ 3.13.6 ] steps: - name: Checkout Code diff --git a/README.md b/README.md index b2e888d..3c4f5a7 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ For building binary if you wish to build from source, then `cargo` is required. model = "gpt-4o", -- your desired model (or use gpt-4o, etc.) timeout = 30000, -- Timeout in milliseconds, increase this for reasoning models temperature = 0, - max_completion_tokens = 8192, -- Increase this to include reasoning tokens (for reasoning models) + max_tokens = 8192, -- Increase this to include reasoning tokens (for reasoning models) --reasoning_effort = "medium", -- low|medium|high, only used for reasoning models }, }, diff --git a/cursor-planning-mode.md b/cursor-planning-mode.md index a78d3d9..4a7d99f 100644 --- a/cursor-planning-mode.md +++ b/cursor-planning-mode.md @@ -35,7 +35,7 @@ Then enable it in avante.nvim: api_key_name = 'GROQ_API_KEY', endpoint = 'https://api.groq.com/openai/v1/', model = 'llama-3.3-70b-versatile', - max_completion_tokens = 32768, -- remember to increase this value, otherwise it will stop generating halfway + max_tokens = 32768, -- remember to increase this value, otherwise it will stop generating halfway }, }, --- ... existing configurations diff --git a/lua/avante/config.lua b/lua/avante/config.lua index a9c2bc3..aef2f36 100644 --- a/lua/avante/config.lua +++ b/lua/avante/config.lua @@ -196,7 +196,7 @@ M._defaults = { model = "gpt-4o", timeout = 30000, -- Timeout in milliseconds, increase this for reasoning models temperature = 0, - max_completion_tokens = 16384, -- Increase this to include reasoning tokens (for reasoning models) + max_tokens = 16384, -- Increase this to include reasoning tokens (for reasoning models) reasoning_effort = "medium", -- low|medium|high, only used for reasoning models }, ---@type AvanteSupportedProvider @@ -216,7 +216,7 @@ M._defaults = { api_version = "2024-12-01-preview", timeout = 30000, -- Timeout in milliseconds, increase this for reasoning models temperature = 0, - max_completion_tokens = 20480, -- Increase this to include reasoning tokens (for reasoning models) + max_tokens = 20480, -- Increase this to include reasoning tokens (for reasoning models) reasoning_effort = "medium", -- low|medium|high, only used for reasoning models }, ---@type AvanteSupportedProvider diff --git a/lua/avante/providers/azure.lua b/lua/avante/providers/azure.lua index b621f75..bf0de9c 100644 --- a/lua/avante/providers/azure.lua +++ b/lua/avante/providers/azure.lua @@ -2,7 +2,7 @@ ---@field deployment string ---@field api_version string ---@field temperature number ----@field max_completion_tokens number +---@field max_tokens number ---@field reasoning_effort? string local Utils = require("avante.utils") diff --git a/lua/avante/providers/openai.lua b/lua/avante/providers/openai.lua index 9b9bbd5..f77c7b9 100644 --- a/lua/avante/providers/openai.lua +++ b/lua/avante/providers/openai.lua @@ -67,8 +67,6 @@ function M.set_allowed_params(provider_conf, request_body) else request_body.reasoning_effort = nil end - -- If max_tokens is set in config, unset max_completion_tokens - if request_body.max_tokens then request_body.max_completion_tokens = nil end end function M:parse_messages(opts) diff --git a/lua/avante/types.lua b/lua/avante/types.lua index ab575ff..59a7149 100644 --- a/lua/avante/types.lua +++ b/lua/avante/types.lua @@ -217,7 +217,6 @@ vim.g.avante_login = vim.g.avante_login ---@field __inherited_from? string ---@field temperature? number ---@field max_tokens? number ----@field max_completion_tokens? number ---@field reasoning_effort? string ---@field display_name? string ---