UNPKG

genkitx-hnsw

Version:

Firebase Genkit AI framework plugin for HNSW vector database. Get AI response enriched with additional context and knowledge with HNSW Vector Database using RAG Implementation

1 lines 2.08 kB
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * Copyright 2024 The Fire Company\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 { genkitPlugin } from '@genkit-ai/core';\nimport { defineFlow } from '@genkit-ai/flow';\n\nimport { PluginOptions } from './interfaces';\nimport { hnswIndexerAction, hnswRetrieverAction } from './actions';\nimport { indexerFlowConfig, retrieverflowConfig } from './config';\nimport { checkApiKey } from './utilities';\nimport { PLUGIN_NAME_INDEXER, PLUGIN_NAME_RETRIEVER } from './constants';\n\nexport const hnswIndexer = genkitPlugin(\n PLUGIN_NAME_INDEXER,\n async (pluginOptions: PluginOptions) => {\n checkApiKey(pluginOptions);\n defineFlow(indexerFlowConfig, (flowOptions) =>\n hnswIndexerAction(flowOptions, pluginOptions)\n );\n }\n);\n\nexport const hnswRetriever = genkitPlugin(\n PLUGIN_NAME_RETRIEVER,\n async (pluginOptions: PluginOptions) => {\n checkApiKey(pluginOptions);\n defineFlow(retrieverflowConfig, (flowOptions) =>\n hnswRetrieverAction(flowOptions, pluginOptions)\n );\n }\n);\n"],"mappings":"AAgBA,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AAG3B,SAAS,mBAAmB,2BAA2B;AACvD,SAAS,mBAAmB,2BAA2B;AACvD,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB,6BAA6B;AAEpD,MAAM,cAAc;AAAA,EACzB;AAAA,EACA,OAAO,kBAAiC;AACtC,gBAAY,aAAa;AACzB;AAAA,MAAW;AAAA,MAAmB,CAAC,gBAC7B,kBAAkB,aAAa,aAAa;AAAA,IAC9C;AAAA,EACF;AACF;AAEO,MAAM,gBAAgB;AAAA,EAC3B;AAAA,EACA,OAAO,kBAAiC;AACtC,gBAAY,aAAa;AACzB;AAAA,MAAW;AAAA,MAAqB,CAAC,gBAC/B,oBAAoB,aAAa,aAAa;AAAA,IAChD;AAAA,EACF;AACF;","names":[]}