@ai-sdk/perplexity
Version:
The **[Perplexity provider](https://ai-sdk.dev/providers/ai-sdk-providers/perplexity)** for the [AI SDK](https://ai-sdk.dev/docs) contains language model support for Perplexity's Sonar API - a powerful answer engine with real-time web search capabilities.
14 lines (12 loc) • 325 B
text/typescript
import { LanguageModelV3FinishReason } from '@ai-sdk/provider';
export function mapPerplexityFinishReason(
finishReason: string | null | undefined,
): LanguageModelV3FinishReason['unified'] {
switch (finishReason) {
case 'stop':
case 'length':
return finishReason;
default:
return 'other';
}
}