UNPKG

@anthropic-ai/bedrock-sdk

Version:

The official TypeScript library for the Anthropic Bedrock API

65 lines 3.59 kB
import { BaseAnthropic, ClientOptions as CoreClientOptions } from '@anthropic-ai/sdk/client'; import * as Resources from '@anthropic-ai/sdk/resources/index'; import { FinalRequestOptions } from "./internal/request-options.mjs"; import { FinalizedRequestInit } from "./internal/types.mjs"; export { BaseAnthropic } from '@anthropic-ai/sdk/client'; export type ClientOptions = Omit<CoreClientOptions, 'apiKey' | 'authToken'> & { awsSecretKey?: string | null | undefined; awsAccessKey?: string | null | undefined; /** * Defaults to process.env['AWS_REGION']. */ awsRegion?: string | undefined; awsSessionToken?: string | null | undefined; skipAuth?: boolean; }; /** API Client for interfacing with the Anthropic Bedrock API. */ export declare class AnthropicBedrock extends BaseAnthropic { awsSecretKey: string | null; awsAccessKey: string | null; awsRegion: string; awsSessionToken: string | null; skipAuth: boolean; /** * API Client for interfacing with the Anthropic Bedrock API. * * @param {string | null | undefined} [opts.awsSecretKey] * @param {string | null | undefined} [opts.awsAccessKey] * @param {string | undefined} [opts.awsRegion=process.env['AWS_REGION'] ?? us-east-1] * @param {string | null | undefined} [opts.awsSessionToken] * @param {string} [opts.baseURL=process.env['ANTHROPIC_BEDROCK_BASE_URL'] ?? https://bedrock-runtime.${this.awsRegion}.amazonaws.com] - Override the default base URL for the API. * @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out. * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls. * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation. * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request. * @param {HeadersLike} opts.defaultHeaders - Default headers to include with every request to the API. * @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API. * @param {boolean} [opts.dangerouslyAllowBrowser=false] - By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers. * @param {boolean} [opts.skipAuth=false] - Skip authentication for this request. This is useful if you have an internal proxy that handles authentication for you. */ constructor({ awsRegion, baseURL, awsSecretKey, awsAccessKey, awsSessionToken, ...opts }?: ClientOptions); messages: MessagesResource; completions: Resources.Completions; beta: BetaResource; protected validateHeaders(): void; protected prepareRequest(request: FinalizedRequestInit, { url, options }: { url: string; options: FinalRequestOptions; }): Promise<void>; buildRequest(options: FinalRequestOptions): { req: FinalizedRequestInit; url: string; timeout: number; }; } /** * The Bedrock API does not currently support token counting or the Batch API. */ type MessagesResource = Omit<Resources.Messages, 'batches' | 'countTokens'>; /** * The Bedrock API does not currently support prompt caching, token counting or the Batch API. */ type BetaResource = Omit<Resources.Beta, 'promptCaching' | 'messages'> & { messages: Omit<Resources.Beta['messages'], 'batches' | 'countTokens'>; }; //# sourceMappingURL=client.d.mts.map