Comments (11)
Good point! I'll think about how to expose the full range of authentication options, while keeping the most basic one as easy as possible
from ai.
get this error in a AWS Lambda context with implicit role credentials from the Lambda function. So that's essentially the session token missing here as well, I believe.
"errorType": "Error",
"errorMessage": "The security token included in the request is invalid.",
"trace": [
"Error: The security token included in the request is invalid.",
" at Runtime.handler (/var/task/index.js:6720:11)",
" at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"
]
}
from ai.
Note sure if this will fully address this issue, since I did not find profile
in BedrockRuntimeClientConfig
, but this is the level of integration that I want to support: #2074 - you can pass any custom client config.
from ai.
Thank you for the quick solution!
from ai.
from ai.
Note sure if this will fully address this issue, since I did not find
profile
inBedrockRuntimeClientConfig
, but this is the level of integration that I want to support: #2074 - you can pass any custom client config.
I think this will do. This allows passing in https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-credential-providers/#fromini to the client
from ai.
Note sure if this will fully address this issue, since I did not find
profile
inBedrockRuntimeClientConfig
, but this is the level of integration that I want to support: #2074 - you can pass any custom client config.I think this will do. This allows passing in docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-credential-providers/#fromini to the client
I'm still getting an issue with regards to using aws sso profiles to access bedrock.
...
"@ai-sdk/amazon-bedrock": "^0.0.3",
"@ai-sdk/openai": "^0.0.34",
"@ai-sdk/provider": "0.0.11",
"ai": "^3.2.14",
"ollama-ai-provider": "^0.7.0",
...
I debug everything, and the secret key, etc all available as envvars, but i still get
UnrecognizedClientException: The security token included in the request is invalid.
from ai.
ok maybe I misinterpreted what is required.
@lgrammel I see you've marked it as complete. (as a result of #2074)
does this mean if we need to use a session token that we then are expected to own all the pieces of relicating this in our own code:
ai/packages/amazon-bedrock/src/bedrock-provider.ts
Lines 49 to 69 in 77df9f0
from ai.
ok yep... I had to provide this:
import { loadSetting } from '@ai-sdk/provider-utils';
import {
AmazonBedrockProviderSettings,
createAmazonBedrock,
type AmazonBedrockProvider,
} from '@ai-sdk/amazon-bedrock';
const bedrock = createAmazonBedrock({
bedrockOptions: {
region: loadSetting({
settingValue: this.options.region,
settingName: 'region',
environmentVariableName: 'AWS_REGION',
description: 'AWS region',
}),
credentials: {
accessKeyId: loadSetting({
settingValue: this.options.accessKeyId,
settingName: 'accessKeyId',
environmentVariableName: 'AWS_ACCESS_KEY_ID',
description: 'AWS access key ID',
}),
secretAccessKey: loadSetting({
settingValue: this.options.secretAccessKey,
settingName: 'secretAccessKey',
environmentVariableName: 'AWS_SECRET_ACCESS_KEY',
description: 'AWS secret access key',
}),
sessionToken: loadSetting({
settingValue: this.options.sessionToken,
settingName: 'sessionToken',
environmentVariableName: 'AWS_SESSION_TOKEN',
description: 'AWS secret access key',
}),
},
},
});
from ai.
@airtonix yes you need to provide the bedrockOptions
that you otherwise would use directly w/ Bedrock. However, your version has this.options
which is not valid in this context. You could try the following (which does not have error handling though):
const bedrock = createAmazonBedrock({
bedrockOptions: {
region: process.env.AWS_REGION!,
credentials: {
accessKeyId: process.env.AWS_ACCESS_KEY!,
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
sessionToken: process.env.AWS_SESSION_TOKEN!
},
},
});
from ai.
Oh the soul less abandonment to !
.
π₯Ίπ₯Ήπ
All good. I just replicated what you did internally.
from ai.
Related Issues (20)
- Error in implementing in nodejs HOT 6
- getMutableAIState(key [keyof AI Context]) update() and done() didn't change object reference
- useAssistant: option to ignore annotations in text deltas
- Bedrock: can't use AWS metadata service for authentication HOT 1
- Save chat to database on onSetAIState is not working correctly if connection_limit is set to high HOT 3
- vLLM Provider HOT 1
- Ending `textStream.done()` in `streamUI()` causes another render in component after version `>=3.2.6`
- Add Azure Extensions to the Azure provider
- Add support for edit history
- Create a tool to summarise results HOT 6
- AI_TypeValidationError: Optional type validation in generateObject function. HOT 10
- Model Registry non-standard parameters
- Cannot use zod tuple() in tool schema HOT 2
- Vercel AI SDK Incompatibility with Latest Perplexity API Updates HOT 2
- stop_sequences
- json mode
- experimental_useObject onFinish
- Increased Token Limit Not Working with Claude 3.5 Sonnet HOT 4
- Let AI use multiple times tools before answering HOT 1
- Add `baseURL` and `apiVersion` to the Azure OpenAI Provider
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ai.