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 • 1.81 kB
Source Map (JSON)
{"version":3,"sources":["../../src/actions/index.ts"],"sourcesContent":["/**\n * Copyright 2024 Bloom Labs Inc\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 { saveVectorIndexer } from './../indexer';\nimport { retrieveResponseWithVector } from './../retriever';\nimport {\n RetrieverFlowOptions,\n PluginOptions,\n IndexerFlowOptions,\n} from './../interfaces';\n\nexport const hnswIndexerAction = async (\n flowOptions: IndexerFlowOptions,\n pluginOptions: PluginOptions\n) => {\n try {\n return await saveVectorIndexer(flowOptions, pluginOptions);\n } catch (error) {\n return `Vector index saving error, ${error}`;\n }\n};\n\nexport const hnswRetrieverAction = async (\n flowOptions: RetrieverFlowOptions,\n pluginOptions: PluginOptions\n) => {\n try {\n return await retrieveResponseWithVector(flowOptions, pluginOptions);\n } catch (error) {\n return `Error generating prompt response, ${error}`;\n }\n};\n"],"mappings":"AAgBA,SAAS,yBAAyB;AAClC,SAAS,kCAAkC;AAOpC,MAAM,oBAAoB,OAC/B,aACA,kBACG;AACH,MAAI;AACF,WAAO,MAAM,kBAAkB,aAAa,aAAa;AAAA,EAC3D,SAAS,OAAO;AACd,WAAO,8BAA8B,KAAK;AAAA,EAC5C;AACF;AAEO,MAAM,sBAAsB,OACjC,aACA,kBACG;AACH,MAAI;AACF,WAAO,MAAM,2BAA2B,aAAa,aAAa;AAAA,EACpE,SAAS,OAAO;AACd,WAAO,qCAAqC,KAAK;AAAA,EACnD;AACF;","names":[]}