Add AWS Bedrock sessionToken (#478)

* add aws bedrock sessionToken

* update changelog for bedrock sessionToken

---------

Co-authored-by: Brendan Kellam <bshizzle1234@gmail.com>
This commit is contained in:
Brian Mcclaugherty 2025-08-25 10:32:59 -04:00 committed by GitHub
parent d9fa221d72
commit ca9069e0fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 292 additions and 0 deletions

View file

@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Updated NextJS to version 15. [#477](https://github.com/sourcebot-dev/sourcebot/pull/477)
- Add `sessionToken` as optional Bedrock configuration parameter. [#478](https://github.com/sourcebot-dev/sourcebot/pull/478)
## [4.6.4] - 2025-08-11

View file

@ -67,6 +67,9 @@ For a detailed description of all the providers, please refer to the [schema](ht
"accessKeySecret": {
"env": "AWS_SECRET_ACCESS_KEY"
},
"sessionToken": {
"env": "AWS_SESSION_TOKEN"
},
"region": "YOUR_REGION_HERE", // defaults to the AWS_REGION env var if not set
"baseUrl": "OPTIONAL_BASE_URL"
}

View file

@ -1284,6 +1284,37 @@
}
]
},
"sessionToken": {
"description": "Optional session token to use with the model. Defaults to the `AWS_SESSION_TOKEN` environment variable.",
"anyOf": [
{
"type": "object",
"properties": {
"secret": {
"type": "string",
"description": "The name of the secret that contains the token."
}
},
"required": [
"secret"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"env": {
"type": "string",
"description": "The name of the environment variable that contains the token. Only supported in declarative connection configs."
}
},
"required": [
"env"
],
"additionalProperties": false
}
]
},
"region": {
"type": "string",
"description": "The AWS region. Defaults to the `AWS_REGION` environment variable.",
@ -2628,6 +2659,37 @@
}
]
},
"sessionToken": {
"description": "Optional session token to use with the model. Defaults to the `AWS_SESSION_TOKEN` environment variable.",
"anyOf": [
{
"type": "object",
"properties": {
"secret": {
"type": "string",
"description": "The name of the secret that contains the token."
}
},
"required": [
"secret"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"env": {
"type": "string",
"description": "The name of the environment variable that contains the token. Only supported in declarative connection configs."
}
},
"required": [
"env"
],
"additionalProperties": false
}
]
},
"region": {
"type": "string",
"description": "The AWS region. Defaults to the `AWS_REGION` environment variable.",

View file

@ -81,6 +81,37 @@
}
]
},
"sessionToken": {
"description": "Optional session token to use with the model. Defaults to the `AWS_SESSION_TOKEN` environment variable.",
"anyOf": [
{
"type": "object",
"properties": {
"secret": {
"type": "string",
"description": "The name of the secret that contains the token."
}
},
"required": [
"secret"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"env": {
"type": "string",
"description": "The name of the environment variable that contains the token. Only supported in declarative connection configs."
}
},
"required": [
"env"
],
"additionalProperties": false
}
]
},
"region": {
"type": "string",
"description": "The AWS region. Defaults to the `AWS_REGION` environment variable.",
@ -1425,6 +1456,37 @@
}
]
},
"sessionToken": {
"description": "Optional session token to use with the model. Defaults to the `AWS_SESSION_TOKEN` environment variable.",
"anyOf": [
{
"type": "object",
"properties": {
"secret": {
"type": "string",
"description": "The name of the secret that contains the token."
}
},
"required": [
"secret"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"env": {
"type": "string",
"description": "The name of the environment variable that contains the token. Only supported in declarative connection configs."
}
},
"required": [
"env"
],
"additionalProperties": false
}
]
},
"region": {
"type": "string",
"description": "The AWS region. Defaults to the `AWS_REGION` environment variable.",

View file

@ -1283,6 +1283,37 @@ const schema = {
}
]
},
"sessionToken": {
"description": "Optional session token to use with the model. Defaults to the `AWS_SESSION_TOKEN` environment variable.",
"anyOf": [
{
"type": "object",
"properties": {
"secret": {
"type": "string",
"description": "The name of the secret that contains the token."
}
},
"required": [
"secret"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"env": {
"type": "string",
"description": "The name of the environment variable that contains the token. Only supported in declarative connection configs."
}
},
"required": [
"env"
],
"additionalProperties": false
}
]
},
"region": {
"type": "string",
"description": "The AWS region. Defaults to the `AWS_REGION` environment variable.",
@ -2627,6 +2658,37 @@ const schema = {
}
]
},
"sessionToken": {
"description": "Optional session token to use with the model. Defaults to the `AWS_SESSION_TOKEN` environment variable.",
"anyOf": [
{
"type": "object",
"properties": {
"secret": {
"type": "string",
"description": "The name of the secret that contains the token."
}
},
"required": [
"secret"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"env": {
"type": "string",
"description": "The name of the environment variable that contains the token. Only supported in declarative connection configs."
}
},
"required": [
"env"
],
"additionalProperties": false
}
]
},
"region": {
"type": "string",
"description": "The AWS region. Defaults to the `AWS_REGION` environment variable.",

View file

@ -488,6 +488,22 @@ export interface AmazonBedrockLanguageModel {
*/
env: string;
};
/**
* Optional session token to use with the model. Defaults to the `AWS_SESSION_TOKEN` environment variable.
*/
sessionToken?:
| {
/**
* The name of the secret that contains the token.
*/
secret: string;
}
| {
/**
* The name of the environment variable that contains the token. Only supported in declarative connection configs.
*/
env: string;
};
/**
* The AWS region. Defaults to the `AWS_REGION` environment variable.
*/

View file

@ -80,6 +80,37 @@ const schema = {
}
]
},
"sessionToken": {
"description": "Optional session token to use with the model. Defaults to the `AWS_SESSION_TOKEN` environment variable.",
"anyOf": [
{
"type": "object",
"properties": {
"secret": {
"type": "string",
"description": "The name of the secret that contains the token."
}
},
"required": [
"secret"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"env": {
"type": "string",
"description": "The name of the environment variable that contains the token. Only supported in declarative connection configs."
}
},
"required": [
"env"
],
"additionalProperties": false
}
]
},
"region": {
"type": "string",
"description": "The AWS region. Defaults to the `AWS_REGION` environment variable.",
@ -1424,6 +1455,37 @@ const schema = {
}
]
},
"sessionToken": {
"description": "Optional session token to use with the model. Defaults to the `AWS_SESSION_TOKEN` environment variable.",
"anyOf": [
{
"type": "object",
"properties": {
"secret": {
"type": "string",
"description": "The name of the secret that contains the token."
}
},
"required": [
"secret"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"env": {
"type": "string",
"description": "The name of the environment variable that contains the token. Only supported in declarative connection configs."
}
},
"required": [
"env"
],
"additionalProperties": false
}
]
},
"region": {
"type": "string",
"description": "The AWS region. Defaults to the `AWS_REGION` environment variable.",

View file

@ -59,6 +59,22 @@ export interface AmazonBedrockLanguageModel {
*/
env: string;
};
/**
* Optional session token to use with the model. Defaults to the `AWS_SESSION_TOKEN` environment variable.
*/
sessionToken?:
| {
/**
* The name of the secret that contains the token.
*/
secret: string;
}
| {
/**
* The name of the environment variable that contains the token. Only supported in declarative connection configs.
*/
env: string;
};
/**
* The AWS region. Defaults to the `AWS_REGION` environment variable.
*/

View file

@ -121,6 +121,7 @@ export const env = createEnv({
AWS_ACCESS_KEY_ID: z.string().optional(),
AWS_SECRET_ACCESS_KEY: z.string().optional(),
AWS_SESSION_TOKEN: z.string().optional(),
AWS_REGION: z.string().optional(),
SOURCEBOT_CHAT_MODEL_TEMPERATURE: numberSchema.default(0.3),

View file

@ -389,6 +389,9 @@ export const _getAISDKLanguageModelAndOptions = async (config: LanguageModel, or
secretAccessKey: config.accessKeySecret
? await getTokenFromConfig(config.accessKeySecret, orgId, prisma)
: env.AWS_SECRET_ACCESS_KEY,
sessionToken: config.sessionToken
? await getTokenFromConfig(config.sessionToken, orgId, prisma)
: env.AWS_SESSION_TOKEN,
headers: config.headers
? await extractLanguageModelHeaders(config.headers, orgId, prisma)
: undefined,

View file

@ -25,6 +25,10 @@
"$ref": "./shared.json#/definitions/Token",
"description": "Optional secret access key to use with the model. Defaults to the `AWS_SECRET_ACCESS_KEY` environment variable."
},
"sessionToken": {
"$ref": "./shared.json#/definitions/Token",
"description": "Optional session token to use with the model. Defaults to the `AWS_SESSION_TOKEN` environment variable."
},
"region": {
"type": "string",
"description": "The AWS region. Defaults to the `AWS_REGION` environment variable.",