File tree 2 files changed +12
-3
lines changed
2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -2,14 +2,20 @@ import { ProviderAPIConfig } from '../types';
2
2
3
3
const AnthropicAPIConfig : ProviderAPIConfig = {
4
4
getBaseURL : ( ) => 'https://api.anthropic.com/v1' ,
5
- headers : ( { providerOptions, fn } ) => {
5
+ headers : ( { providerOptions, fn, gatewayRequestBody } ) => {
6
6
const headers : Record < string , string > = {
7
7
'X-API-Key' : `${ providerOptions . apiKey } ` ,
8
8
} ;
9
9
10
+ // Accept anthropic_beta and anthropic_version in body to support enviroments which cannot send it in headers.
10
11
const betaHeader =
11
- providerOptions ?. [ 'anthropicBeta' ] ?? 'messages-2023-12-15' ;
12
- const version = providerOptions ?. [ 'anthropicVersion' ] ?? '2023-06-01' ;
12
+ providerOptions ?. [ 'anthropicBeta' ] ??
13
+ gatewayRequestBody ?. [ 'anthropic_beta' ] ??
14
+ 'messages-2023-12-15' ;
15
+ const version =
16
+ providerOptions ?. [ 'anthropicVersion' ] ??
17
+ gatewayRequestBody ?. [ 'anthropic_version' ] ??
18
+ '2023-06-01' ;
13
19
14
20
if ( fn === 'chatComplete' ) {
15
21
headers [ 'anthropic-beta' ] = betaHeader ;
Original file line number Diff line number Diff line change @@ -317,6 +317,9 @@ export interface Params {
317
317
} ;
318
318
// Google Vertex AI specific
319
319
safety_settings ?: any ;
320
+ // Anthropic specific
321
+ anthropic_beta ?: string ;
322
+ anthropic_version ?: string ;
320
323
}
321
324
322
325
interface Examples {
You can’t perform that action at this time.
0 commit comments