add in type for anthropic gateway

This commit is contained in:
dal 2025-09-29 09:46:31 -06:00
parent c603ae1ebf
commit 200ea567a7
No known key found for this signature in database
GPG Key ID: 16F4B0E1E9F61122
1 changed files with 39 additions and 2 deletions

View File

@ -2,7 +2,44 @@ import { createGateway } from '@ai-sdk/gateway';
import { wrapLanguageModel } from 'ai';
import { BraintrustMiddleware } from 'braintrust';
export const DEFAULT_ANTHROPIC_OPTIONS = {
// Provider-specific option types
export type GatewayProviderOrder = string[];
export type AnthropicOptions = {
cacheControl?: { type: 'ephemeral' };
};
export type BedrockOptions = {
cachePoint?: { type: 'default' };
additionalModelRequestFields?: {
anthropic_beta?: string[];
};
};
export type OpenAIOptions = {
// parallelToolCalls?: boolean;
reasoningEffort?: 'low' | 'medium' | 'high' | 'minimal';
verbosity?: 'low' | 'medium' | 'high';
};
// Main provider options types
export type AnthropicProviderOptions = {
gateway: {
order: GatewayProviderOrder;
};
anthropic: AnthropicOptions;
bedrock: BedrockOptions;
};
export type OpenAIProviderOptions = {
gateway: {
order: GatewayProviderOrder;
};
openai: OpenAIOptions;
};
// Default options with proper typing
export const DEFAULT_ANTHROPIC_OPTIONS: AnthropicProviderOptions = {
gateway: {
order: ['bedrock', 'anthropic', 'vertex'],
},
@ -17,7 +54,7 @@ export const DEFAULT_ANTHROPIC_OPTIONS = {
},
};
export const DEFAULT_OPENAI_OPTIONS = {
export const DEFAULT_OPENAI_OPTIONS: OpenAIProviderOptions = {
gateway: {
order: ['openai'],
},