| 1 | import * as Alchemy from "alchemy"; |
| 2 | import * as AWS from "alchemy/AWS"; |
| 3 | import * as Output from "alchemy/Output"; |
| 4 | import * as Effect from "effect/Effect"; |
| 5 | import ChatFunction from "./src/ChatFunction.ts"; |
| 6 | |
| 7 | // AWS.providers() already provides AWSEnvironment from the SSO profile |
| 8 | // named by $AWS_PROFILE (defaults to "default"). |
| 9 | const aws = AWS.providers(); |
| 10 | |
| 11 | export default Alchemy.Stack( |
| 12 | "BedrockAI", |
| 13 | { |
| 14 | providers: aws, |
| 15 | state: Alchemy.localState(), |
| 16 | }, |
| 17 | Effect.gen(function* () { |
| 18 | const func = yield* ChatFunction; |
| 19 | return { |
| 20 | url: func.functionUrl, |
| 21 | streamUrl: Output.interpolate`${func.functionUrl}stream?prompt=Write+a+haiku`, |
| 22 | weatherUrl: Output.interpolate`${func.functionUrl}weather?prompt=What's+the+weather+in+Seattle%3F`, |
| 23 | }; |
| 24 | }), |
| 25 | ); |