ai
ai copied to clipboard
Add session token to AWS bedrock
The default configuration of the bedrock provider doesn't account for session tokens, sessionTokens are common in local AWS environments and should be supported by default
jfyi you can use local credential or IAM role credential directly by setting bedrockOptions instead.
For example.
import { createAmazonBedrock } from '@ai-sdk/amazon-bedrock';
import { streamText } from 'ai';
export const maxDuration = 30;
export async function POST(req: Request) {
const { messages } = await req.json();
const result = await streamText({
model: createAmazonBedrock({ bedrockOptions: { region: 'us-east-1' } })('anthropic.claude-3-haiku-20240307-v1:0'),
messages,
});
return result.toAIStreamResponse();
}
jfyi
Thanks! I noticed that after I finished this code change lol I still feel like it makes sense to merge in. seems like most of the other providers just work without configuring
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
| Package | New capabilities | Transitives | Size | Publisher |
|---|---|---|---|---|
| npm/[email protected] | Transitive: environment, filesystem | +10 |
97.3 MB | rauchg, timneutkens, vercel-release-bot |
| npm/[email protected] | environment | +1 |
6.34 MB | react-bot |
| npm/[email protected] | environment | 0 |
237 kB | react-bot |
🚮 Removed packages: npm/[email protected], npm/[email protected], npm/[email protected]
Continued in #2755