Skip to content

Commit

Permalink
fix (docs): llama guide add bedrock (#2390)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoalbanese authored Jul 23, 2024
1 parent 68aee52 commit 6a0820c
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions content/docs/02-guides/03-llama-3_1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,20 @@ const { text } = await generateText({
[Fireworks](/providers/ai-sdk-providers/fireworks), and more.
</Note>

AI SDK Core abstracts away the differences between model providers, allowing you to focus on building great applications. Prefer to use Llama 3.1-70b? the unified interface also means that you can easily switch between models by changing just two lines of code.
AI SDK Core abstracts away the differences between model providers, allowing you to focus on building great applications. Prefer to use [Amazon Bedrock](/providers/ai-sdk-providers/amazon-bedrock)? The unified interface also means that you can easily switch between models by changing just two lines of code.

```tsx
```tsx highlight="2,5"
import { generateText } from 'ai';
import { createOpenAI as createGroq } from '@ai-sdk/openai';

const groq = createGroq({
baseURL: 'https://api.groq.com/openai/v1',
apiKey: process.env.GROQ_API_KEY,
});
import { bedrock } from '@ai-sdk/amazon-bedrock';

const { text } = await generateText({
model: groq('llama-3.1-70b-versatile'),
model: bedrock('meta.llama3-1-405b-instruct-v1'),
prompt: 'What is love?',
});
```

### Streaming the Response

To stream the model's response as it's being generated, update your code snippet to use the [`streamText`](/docs/reference/ai-sdk-core/stream-text) function.

```tsx
Expand Down Expand Up @@ -142,7 +139,7 @@ const groq = createGroq({

const { text } = await generateText({
model: groq('llama-3.1-70b-versatile'),
prompt: "What's the weather like today?",
prompt: 'What is the weather like today?',
tools: {
weather: tool({
description: 'Get the weather in a location',
Expand Down

0 comments on commit 6a0820c

Please sign in to comment.