feat: bedrock temporary credentials support (#1207)

This commit is contained in:
Daniel Tabuenca 2025-02-08 11:40:20 -06:00 committed by GitHub
parent 4ffec5a039
commit 987275c64a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View File

@ -471,8 +471,10 @@ Given its early stage, `avante.nvim` currently supports the following basic func
> For Amazon Bedrock:
>
> ```sh
> export BEDROCK_KEYS=aws_access_key_id,aws_secret_access_key,aws_region
> export BEDROCK_KEYS=aws_access_key_id,aws_secret_access_key,aws_region[,aws_session_token]
>
> ```
> Note: The aws_session_token is optional and only needed when using temporary AWS credentials
1. Open a code file in Neovim.
2. Use the `:AvanteAsk` command to query the AI about the code.

View File

@ -64,6 +64,7 @@ M.parse_curl_args = function(provider, prompt_opts)
local aws_access_key_id = parts[1]
local aws_secret_access_key = parts[2]
local aws_region = parts[3]
local aws_session_token = parts[4]
local endpoint = string.format(
"https://bedrock-runtime.%s.amazonaws.com/model/%s/invoke-with-response-stream",
@ -75,6 +76,8 @@ M.parse_curl_args = function(provider, prompt_opts)
["Content-Type"] = "application/json",
}
if aws_session_token and aws_session_token ~= "" then headers["x-amz-security-token"] = aws_session_token end
local body_payload = M.build_bedrock_payload(prompt_opts, body_opts)
local rawArgs = {