mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-12 04:15:30 +00:00
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:
parent
d9fa221d72
commit
ca9069e0fa
11 changed files with 292 additions and 0 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.",
|
||||
|
|
|
|||
|
|
@ -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.",
|
||||
|
|
|
|||
|
|
@ -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.",
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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.",
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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.",
|
||||
|
|
|
|||
Loading…
Reference in a new issue