Skip to content

Commit

Permalink
feat (provider/groq): add deepseek r1 (#4546)
Browse files Browse the repository at this point in the history
  • Loading branch information
lgrammel authored Jan 27, 2025
1 parent 883a7e8 commit 3864284
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/perfect-kangaroos-drop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@ai-sdk/groq': patch
---

feat (provider/groq): add deepseek r1
33 changes: 27 additions & 6 deletions content/providers/01-ai-sdk-providers/50-groq.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,26 @@ The first argument is the model id, e.g. `gemma2-9b-it`.
const model = groq('gemma2-9b-it');
```

### Reasoning Models

Groq exposes the thinking of `deepseek-r1-distill-llama-70b` in the generated text using the `<think>` tag.
You can use the `extractReasoningMiddleware` to extract this reasoning and expose it as a `reasoning` property on the result:

```ts
import { groq } from '@ai-sdk/groq';
import {
experimental_wrapLanguageModel as wrapLanguageModel,
extractReasoningMiddleware,
} from 'ai';

const enhancedModel = wrapLanguageModel({
model: groq('deepseek-r1-distill-llama-70b'),
middleware: extractReasoningMiddleware({ tagName: 'think' }),
});
```

You can then use that enhanced model in functions like `generateText` and `streamText`.

### Example

You can use Groq language models to generate text with the `generateText` function:
Expand All @@ -91,12 +111,13 @@ const { text } = await generateText({

## Model Capabilities

| Model | Image Input | Object Generation | Tool Usage | Tool Streaming |
| ------------------------- | ------------------- | ------------------- | ------------------- | ------------------- |
| `llama-3.3-70b-versatile` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
| `llama-3.1-8b-instant` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
| `gemma2-9b-it` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
| `mixtral-8x7b-32768` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
| Model | Image Input | Object Generation | Tool Usage | Tool Streaming |
| ------------------------------- | ------------------- | ------------------- | ------------------- | ------------------- |
| `deepseek-r1-distill-llama-70b` | <Cross size={18} /> | <Cross size={18} /> | <Cross size={18} /> | <Cross size={18} /> |
| `llama-3.3-70b-versatile` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
| `llama-3.1-8b-instant` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
| `gemma2-9b-it` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
| `mixtral-8x7b-32768` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |

<Note>
The table above lists popular models. Please see the [Grop
Expand Down
1 change: 1 addition & 0 deletions packages/groq/src/groq-chat-settings.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// https://console.groq.com/docs/models
// production models
export type GroqChatModelId =
| 'deepseek-r1-distill-llama-70b'
| 'gemma2-9b-it'
| 'gemma-7b-it'
| 'llama-3.3-70b-versatile'
Expand Down

0 comments on commit 3864284

Please sign in to comment.