Skip to content

Commit 097ecee

Browse files
authored
Add Bedrock to example.config.ts (#117)
1 parent b017559 commit 097ecee

File tree

2 files changed

+31
-17
lines changed

2 files changed

+31
-17
lines changed

deploy/example.config.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { env } from 'cloudflare:workers'
22
import type { Config } from '@deploy/types'
33

44
// can be whatever you want, just used to make linking apiKeys to providers typesafe.
5-
type ProviderKeys = 'a' | 'b' | 'c' | 'd'
5+
type ProviderKeys = 'a' | 'b' | 'c' | 'd' | 'e'
66

77
// projects, users and keys must have numeric keys, using constants here to make it easier to understand
88
// of course, keys must be unique within a type (e.g. project ids must be unique) but users and projects can have the same id
@@ -70,6 +70,13 @@ export const config: Config<ProviderKeys> = {
7070
credentials: env.ANTHROPIC_API_KEY,
7171
apiTypes: ['anthropic'],
7272
},
73+
e: {
74+
providerId: 'bedrock',
75+
baseUrl: 'https://bedrock-runtime.us-east-1.amazonaws.com',
76+
injectCost: true,
77+
credentials: env.AWS_BEARER_TOKEN_BEDROCK,
78+
apiTypes: ['anthropic', 'converse'],
79+
},
7380
},
7481
// individual apiKeys
7582
apiKeys: {

gateway/src/types.ts

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,39 +54,46 @@ export function guardAPIType(type: string): type is APIType {
5454
}
5555

5656
export interface ProviderProxy {
57-
/** @providerId: decides on the logic used to process the request and response */
57+
/** Decides on the logic used to process the request and response */
5858
providerId: ProviderID
59-
/** @baseUrl: decides what URL the request will be forwarded to */
59+
60+
/** Decides what URL the request will be forwarded to */
6061
baseUrl: string
61-
/** @injectCost: if injectCost is True, the cost of request from genai-prices is injected in the usage object in the response */
62+
63+
/** If injectCost is True, the cost of request from genai-prices is injected in the usage object in the response */
6264
injectCost: boolean
63-
/** @credentials: credentials are used by the ProviderProxy to authenticate the forwarded request,
64-
* should be either an API key or service JSON for google vertex.
65-
*/
65+
66+
/** Credentials are used by the ProviderProxy to authenticate the forwarded request,
67+
* should be either an API key or service JSON for Google Vertex. */
6668
credentials: string
67-
/** @profile: profile let's you select a provider when multiple providers with the same ProviderID are allowed */
69+
70+
/** Profile let's you select a provider when multiple providers with the same ProviderID are allowed */
6871
profile?: string
69-
/** @priority: higher priority providers will be used first */
72+
73+
/** Higher priority providers will be used first */
7074
priority?: number
71-
/** @disableKey: weather to disable the key in case of error, if missing defaults to True. */
75+
76+
/** Weather to disable the key in case of error, if missing defaults to True. */
7277
disableKey?: boolean
7378

74-
/** @apiTypes: the APIs that the provider supports. Example: ['chat', 'responses'] */
79+
/** The APIs that the provider supports. Example: ['chat', 'responses'] */
7580
apiTypes: APIType[]
76-
/** @routingGroups: a grouping of APIs that serve the same models.
81+
82+
/** A grouping of APIs that serve the same models.
7783
* @example: 'anthropic' would route the requests to Anthropic, Bedrock and Vertex AI. */
7884
routingGroup?: string
7985
}
8086

8187
export interface OtelSettings {
82-
/** @otelWriteToken: write token for sending proxy telemetry to Logfire or other OTel service,
83-
* generate at logfire.pydantic.dev
84-
*/
88+
/** Write token for sending proxy telemetry to Logfire or other OTel service,
89+
* generate at logfire.pydantic.dev */
8590
writeToken: string
86-
/** @otelBaseUrl: base URL to send opentelemetry data to,
91+
92+
/** Base URL to send opentelemetry data to,
8793
* if unset the baseUrl is derived from the Pydantic Logfire writeToken
8894
*/
8995
baseUrl?: string
90-
/** @otelExporterProtocol: whether to send OTel data over protobuf or JSON, defaults to protobuf */
96+
97+
/** Whether to send OTel data over protobuf or JSON, defaults to protobuf */
9198
exporterProtocol?: 'http/protobuf' | 'http/json'
9299
}

0 commit comments

Comments
 (0)