Skip to content

Commit 1e4c512

Browse files
authored
(docs): fix plugin guidance (#1276)
1 parent 557db47 commit 1e4c512

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

‎docs/plugin-authoring.md‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ that can provide models, retrievers, indexers, trace stores, and more. You've al
55
action just by using Genkit:
66

77
```ts
8-
import { configureGenkit } from '@genkit-ai/core';
8+
import { genkit } from 'genkit';
99
import { vertexAI } from '@genkit-ai/vertexai';
1010

11-
configureGenkit({
11+
const ai = genkit({
1212
plugins: [vertexAI({ projectId: 'my-project' })],
1313
});
1414
```
@@ -40,23 +40,20 @@ npx tsc --init
4040
Then, define and export your plugin from your main entry point:
4141

4242
```ts
43-
import { genkitPlugin } from '@genkit-ai/core';
43+
import { Genkit, z } from 'genkit';
44+
import { GenkitPlugin, genkitPlugin } from 'genkit/plugin';
4445

4546
interface MyPluginOptions {
4647
// add any plugin configuration here
4748
}
4849

49-
import { Genkit, z } from 'genkit';
50-
import { GenkitPlugin, genkitPlugin } from 'genkit/plugin';
51-
5250
export function myPlugin(options?: MyPluginOptions) {
5351
return genkitPlugin('myPlugin', async (ai: Genkit) => {
5452
ai.defineModel(...);
5553
ai.defineEmbedder(...)
5654
// ....
5755
});
5856
};
59-
6057
```
6158

6259
### Plugin options guidance
@@ -123,7 +120,8 @@ import { genkitPlugin, GenkitPlugin } from 'genkit/plugin';
123120
import { GenkitError } from '@genkit-ai/core';
124121
import { GenerationCommonConfigSchema } from '@genkit-ai/ai/model';
125122
import { simulateSystemPrompt } from '@genkit-ai/ai/model/middleware';
126-
import { z } from 'zod';
123+
import { z } from 'genkit';
124+
127125

128126
export function myPlugin(options?: MyPluginOptions) {
129127
return genkitPlugin('my-plugin', async (ai: Genkit) => {

0 commit comments

Comments
 (0)