feat: allow disabling tools for claude & copilot (#1300)

This commit is contained in:
Lucas Pereira
2025-02-19 17:00:10 +01:00
committed by GitHub
parent 3476eabc4c
commit 36f8db9629
2 changed files with 4 additions and 2 deletions

View File

@@ -227,6 +227,7 @@ end
---@return table
M.parse_curl_args = function(provider, prompt_opts)
local provider_conf, request_body = P.parse_config(provider)
local disable_tools = provider_conf.disable_tools or false
local headers = {
["Content-Type"] = "application/json",
@@ -239,7 +240,7 @@ M.parse_curl_args = function(provider, prompt_opts)
local messages = M.parse_messages(prompt_opts)
local tools = {}
if prompt_opts.tools then
if not disable_tools and prompt_opts.tools then
for _, tool in ipairs(prompt_opts.tools) do
table.insert(tools, transform_tool(tool))
end

View File

@@ -250,9 +250,10 @@ M.parse_curl_args = function(provider, prompt_opts)
H.refresh_token(false, false)
local provider_conf, request_body = P.parse_config(provider)
local disable_tools = provider_conf.disable_tools or false
local tools = {}
if prompt_opts.tools then
if not disable_tools and prompt_opts.tools then
for _, tool in ipairs(prompt_opts.tools) do
table.insert(tools, OpenAI.transform_tool(tool))
end