@ai-sdk/groq
Version:
The **[Groq provider](https://ai-sdk.dev/providers/ai-sdk-providers/groq)** for the [AI SDK](https://ai-sdk.dev/docs) contains language model support for the Groq chat and completion APIs, transcription support, and browser search tool.
20 lines (18 loc) • 475 B
text/typescript
import type { LanguageModelV4FinishReason } from '@ai-sdk/provider';
export function mapGroqFinishReason(
finishReason: string | null | undefined,
): LanguageModelV4FinishReason['unified'] {
switch (finishReason) {
case 'stop':
return 'stop';
case 'length':
return 'length';
case 'content_filter':
return 'content-filter';
case 'function_call':
case 'tool_calls':
return 'tool-calls';
default:
return 'other';
}
}