-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.ts
28 lines (25 loc) · 917 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { genkitPlugin } from "@genkit-ai/core";
import { defineFlow } from "@genkit-ai/flow";
import { PluginOptions } from "./interfaces";
import { hnswIndexerAction, hnswRetrieverAction } from "./actions";
import { indexerFlowConfig, retrieverflowConfig } from "./config";
import { checkApiKey } from "./utilities";
import { PLUGIN_NAME_INDEXER, PLUGIN_NAME_RETRIEVER } from "./constants";
export const hnswIndexer = genkitPlugin(
PLUGIN_NAME_INDEXER,
async (pluginOptions: PluginOptions) => {
checkApiKey(pluginOptions);
defineFlow(indexerFlowConfig, (flowOptions) =>
hnswIndexerAction(flowOptions, pluginOptions)
);
}
);
export const hnswRetriever = genkitPlugin(
PLUGIN_NAME_RETRIEVER,
async (pluginOptions: PluginOptions) => {
checkApiKey(pluginOptions);
defineFlow(retrieverflowConfig, (flowOptions) =>
hnswRetrieverAction(flowOptions, pluginOptions)
);
}
);