Skip to content

Commit

Permalink
sample and docs cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelgj committed Jul 23, 2024
1 parent ea5e733 commit cf9c63e
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 4 deletions.
30 changes: 30 additions & 0 deletions docs/plugins/vertex-ai.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,36 @@ const llmResponse = await generate({
});
```

#### Llama 3.1 405b on Vertex AI Model Garden

If you have access to Llama 3.1 405b in Vertex AI Model Garden you can use it with Genkit.

Here's sample configuration for enabling Vertex AI Model Garden models:

```js
import { vertexAI, llama3 } from '@genkit-ai/vertexai';

export default configureGenkit({
plugins: [
vertexAI({
location: 'us-central1',
modelGarden: {
models: [llama3],
},
}),
],
});
```

Then use it as regular models:

```js
const llmResponse = await generate({
model: llama3,
prompt: 'Write a function that adds two numbers together',
});
```

### Evaluators

To use the evaluators from Vertex AI Rapid Evaluation, add an `evaluation` block to your `vertexAI` plugin configuration.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h2>Choose an LLM</h2>
}
} @else {
<h2>Chat with {{ llmNames[llmIndex] }}</h2>

<div *ngFor="let entry of history; let i = index">
<div *ngIf="entry.role === 'user'" class="user-bubble">
{{ entry.text }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export class ChatbotComponent {
id = Date.now() + '' + Math.floor(Math.random() * 1000000000);
llmIndex: number | undefined;

llmNames = ['Gemini 1.5 Flash', 'Llama 3.1 405b']
llmNames = ['Gemini 1.5 Flash', 'Llama 3.1 405b'];

chatFormControl = new FormControl(
'write a function that adds two number together',
Expand Down
7 changes: 5 additions & 2 deletions samples/chatbot/server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,17 @@
*/

import { generate } from '@genkit-ai/ai';
import { GenerateResponseChunkSchema, ModelReference } from '@genkit-ai/ai/model';
import {
GenerateResponseChunkSchema,
ModelReference,
} from '@genkit-ai/ai/model';
import { configureGenkit } from '@genkit-ai/core';
import { defineFlow, run, startFlowsServer } from '@genkit-ai/flow';
import {
VertexAIEvaluationMetricType,
gemini15Flash,
vertexAI,
llama3,
vertexAI,
} from '@genkit-ai/vertexai';
import { inMemoryStore } from './memory.js';

Expand Down

0 comments on commit cf9c63e

Please sign in to comment.