Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/docs/configuration/language-model-providers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
62 changes: 62 additions & 0 deletions docs/snippets/schemas/v3/index.schema.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down Expand Up @@ -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.",
Expand Down
62 changes: 62 additions & 0 deletions docs/snippets/schemas/v3/languageModel.schema.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down Expand Up @@ -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.",
Expand Down
62 changes: 62 additions & 0 deletions packages/schemas/src/v3/index.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down Expand Up @@ -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.",
Expand Down
16 changes: 16 additions & 0 deletions packages/schemas/src/v3/index.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
62 changes: 62 additions & 0 deletions packages/schemas/src/v3/languageModel.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down Expand Up @@ -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.",
Expand Down
16 changes: 16 additions & 0 deletions packages/schemas/src/v3/languageModel.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
1 change: 1 addition & 0 deletions packages/web/src/env.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
3 changes: 3 additions & 0 deletions packages/web/src/features/chat/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions schemas/v3/languageModel.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
Loading