MCPcopy Index your code
hub / github.com/TanStack/ai / getAdapter

Function getAdapter

examples/ts-code-mode-web/src/routes/_reporting/api.reports.ts:16–26  ·  view source on GitHub ↗
(provider: Provider, model?: string)

Source from the content-addressed store, hash-verified

14type Provider = 'anthropic' | 'openai' | 'gemini'
15
16function getAdapter(provider: Provider, model?: string): AnyTextAdapter {
17 switch (provider) {
18 case 'openai':
19 return openaiText((model || 'gpt-4o') as 'gpt-4o')
20 case 'gemini':
21 return geminiText((model || 'gemini-2.5-flash') as 'gemini-2.5-flash')
22 case 'anthropic':
23 default:
24 return anthropicText((model || 'claude-haiku-4-5') as 'claude-haiku-4-5')
25 }
26}
27
28// Lazy initialization to avoid loading native modules at module load time
29// This is necessary for RSC compatibility with Vite's module runner

Callers 1

api.reports.tsFile · 0.70

Calls 3

openaiTextFunction · 0.90
geminiTextFunction · 0.90
anthropicTextFunction · 0.90

Tested by

no test coverage detected