
* feat: autobuild tiktoken lib and schenanigans Signed-off-by: Aaron Pham <contact@aarnphm.xyz> * chore: revert readme changes Signed-off-by: Aaron Pham <contact@aarnphm.xyz> * fix(build): windows Signed-off-by: Hanchin Hsieh <me@yuchanns.xyz> * chore(plugin): early load commands and base setup Signed-off-by: Aaron Pham <contact@aarnphm.xyz> * fix(build): make sync Signed-off-by: Aaron Pham <contact@aarnphm.xyz> * feat: rust go vroom vroom Signed-off-by: Aaron Pham <contact@aarnphm.xyz> * feat: scuffed afaf implementation binding go brrrr Signed-off-by: Aaron Pham <contact@aarnphm.xyz> * chore: remove dups Signed-off-by: Aaron Pham <contact@aarnphm.xyz> * fix(tokens): calculate whether we should do prompt_caching (fixes #416) Signed-off-by: Aaron Pham <contact@aarnphm.xyz> * chore: ignore lockfiles Signed-off-by: Aaron Pham <contact@aarnphm.xyz> * Update README.md * Update crates/avante-tokenizers/README.md * chore: remove unused Signed-off-by: Aaron Pham <contact@aarnphm.xyz> * chore: remove auto build Signed-off-by: Aaron Pham <contact@aarnphm.xyz> --------- Signed-off-by: Aaron Pham <contact@aarnphm.xyz> Signed-off-by: Hanchin Hsieh <me@yuchanns.xyz> Co-authored-by: yuchanns <me@yuchanns.xyz>
47 lines
1.1 KiB
Lua
47 lines
1.1 KiB
Lua
---@class AvanteAzureProvider: AvanteDefaultBaseProvider
|
|
---@field deployment string
|
|
---@field api_version string
|
|
---@field temperature number
|
|
---@field max_tokens number
|
|
|
|
local Utils = require("avante.utils")
|
|
local P = require("avante.providers")
|
|
local O = require("avante.providers").openai
|
|
|
|
---@class AvanteProviderFunctor
|
|
local M = {}
|
|
|
|
M.api_key_name = "AZURE_OPENAI_API_KEY"
|
|
M.tokenizer_id = "gpt-4o"
|
|
|
|
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("azure") then
|
|
headers["api-key"] = provider.parse_api_key()
|
|
end
|
|
|
|
return {
|
|
url = Utils.trim(base.endpoint, { suffix = "/" })
|
|
.. "/openai/deployments/"
|
|
.. base.deployment
|
|
.. "/chat/completions?api-version="
|
|
.. base.api_version,
|
|
proxy = base.proxy,
|
|
insecure = base.allow_insecure,
|
|
headers = headers,
|
|
body = vim.tbl_deep_extend("force", {
|
|
messages = M.parse_message(code_opts),
|
|
stream = true,
|
|
}, body_opts),
|
|
}
|
|
end
|
|
|
|
return M
|