genkit
Version:
Genkit AI framework
1 lines • 1.39 kB
Source Map (JSON)
{"version":3,"sources":["../src/plugin.ts"],"sourcesContent":["/**\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Genkit } from './genkit.js';\n\nexport interface PluginProvider {\n name: string;\n initializer: () => void | Promise<void>;\n}\n\ntype PluginInit = (genkit: Genkit) => void | Promise<void>;\n\nexport type GenkitPlugin = (genkit: Genkit) => PluginProvider;\n\n/**\n * Defines a Genkit plugin.\n */\nexport function genkitPlugin<T extends PluginInit>(\n pluginName: string,\n initFn: T\n): GenkitPlugin {\n return (genkit: Genkit) => ({\n name: pluginName,\n initializer: async () => {\n await initFn(genkit);\n },\n });\n}\n"],"mappings":"AA8BO,SAAS,aACd,YACA,QACc;AACd,SAAO,CAAC,YAAoB;AAAA,IAC1B,MAAM;AAAA,IACN,aAAa,YAAY;AACvB,YAAM,OAAO,MAAM;AAAA,IACrB;AAAA,EACF;AACF;","names":[]}