(npm: string)
| 28 | |
| 29 | // Maps npm package to the key the AI SDK expects for providerOptions |
| 30 | function sdkKey(npm: string): string | undefined { |
| 31 | switch (npm) { |
| 32 | case "@ai-sdk/github-copilot": |
| 33 | return "copilot" |
| 34 | case "@ai-sdk/azure": |
| 35 | return "azure" |
| 36 | case "@ai-sdk/openai": |
| 37 | return "openai" |
| 38 | case "@ai-sdk/amazon-bedrock/mantle": |
| 39 | return "openai" |
| 40 | case "@ai-sdk/amazon-bedrock": |
| 41 | return "bedrock" |
| 42 | case "@ai-sdk/anthropic": |
| 43 | case "@ai-sdk/google-vertex/anthropic": |
| 44 | return "anthropic" |
| 45 | case "@ai-sdk/google-vertex": |
| 46 | return "vertex" |
| 47 | case "@ai-sdk/google": |
| 48 | return "google" |
| 49 | case "@ai-sdk/gateway": |
| 50 | return "gateway" |
| 51 | case "@openrouter/ai-sdk-provider": |
| 52 | return "openrouter" |
| 53 | case "ai-gateway-provider": |
| 54 | // ai-gateway-provider/unified wraps createOpenAICompatible({ name: "Unified" }), |
| 55 | // and @ai-sdk/openai-compatible parses compatibleOptions from one of |
| 56 | // "openai-compatible" / "openaiCompatible" / "Unified" / "unified". The |
| 57 | // "openai-compatible" key emits a deprecation warning at runtime, so we |
| 58 | // pick the camelCase form the SDK now treats as canonical. |
| 59 | return "openaiCompatible" |
| 60 | } |
| 61 | return undefined |
| 62 | } |
| 63 | |
| 64 | // TODO: fix this stupid inefficient dogshit function |
| 65 | function normalizeMessages( |
no outgoing calls
no test coverage detected