Buckets:
| import type { RouteDefaultsInput } from "../route/client" | |
| import { Auth } from "../route/auth" | |
| import { ProviderID, type ModelID } from "../schema" | |
| import * as BedrockConverse from "../protocols/bedrock-converse" | |
| import type { BedrockCredentials } from "../protocols/bedrock-converse" | |
| export const id = ProviderID.make("amazon-bedrock") | |
| export type Config = RouteDefaultsInput & { | |
| readonly apiKey?: string | |
| readonly headers?: Record<string, string> | |
| readonly credentials?: BedrockCredentials | |
| /** AWS region. Defaults to `us-east-1` when neither this nor `credentials.region` is set. */ | |
| readonly region?: string | |
| /** Override the computed `https://bedrock-runtime.<region>.amazonaws.com` URL. */ | |
| readonly baseURL?: string | |
| } | |
| export const routes = [BedrockConverse.route] | |
| const bedrockBaseURL = (region: string) => `https://bedrock-runtime.${region}.amazonaws.com` | |
| const configuredRoute = (input: Config) => { | |
| const { apiKey, credentials, region, baseURL, ...rest } = input | |
| const resolvedRegion = region ?? credentials?.region ?? "us-east-1" | |
| return BedrockConverse.route.with({ | |
| ...rest, | |
| provider: id, | |
| endpoint: { baseURL: baseURL ?? bedrockBaseURL(resolvedRegion) }, | |
| auth: apiKey === undefined ? BedrockConverse.sigV4Auth(credentials) : Auth.bearer(apiKey), | |
| }) | |
| } | |
| export const configure = (input: Config = {}) => { | |
| const route = configuredRoute(input) | |
| return { | |
| id, | |
| model: (modelID: string | ModelID) => route.model({ id: modelID }), | |
| configure, | |
| } | |
| } | |
| export const provider = configure() | |
| export const model = provider.model | |
Xet Storage Details
- Size:
- 1.58 kB
- Xet hash:
- 936cdb411c7247ab293f079d44a0af8ddc27cf349b5adfa2475aadc92b1514f6
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.