Pinecone प्लगिन

Pinecone प्लगिन Pinecone क्लाउड वेक्टर डेटाबेस का इस्तेमाल करने वाले इंडेक्सर और रिट्रीवर इंप्लिमेंटेशन उपलब्ध कराता है.

इंस्टॉल करना

npm i --save genkitx-pinecone

कॉन्फ़िगरेशन

इस प्लग इन का उपयोग करने के लिए, configureGenkit() को कॉल करते समय इसका उल्लेख करें:

import { pinecone } from 'genkitx-pinecone';

export default configureGenkit({
  plugins: [
    pinecone([
      {
        indexId: 'bob-facts',
        embedder: textEmbeddingGecko,
      },
    ]),
  ],
  // ...
});

आपको पाइनकोन इंडेक्स आईडी और एम्बेड करने का वह मॉडल बताना होगा जिसका आपको इस्तेमाल करना है.

इसके अलावा, आपको Pinecone API पासकोड के साथ Genkit को कॉन्फ़िगर करना होगा. ऐसा करने के दो तरीके हैं:

  • PINECONE_API_KEY एनवायरमेंट वैरिएबल सेट करें.

  • इसे clientParams वैकल्पिक पैरामीटर में बताएं:

    clientParams: {
      apiKey: ...,
    }
    

    इस पैरामीटर की वैल्यू एक PineconeConfiguration ऑब्जेक्ट है, जिसे Pinecone क्लाइंट को पास किया जाता है. क्लाइंट के साथ काम करने वाले किसी भी पैरामीटर को पास करने के लिए, इसका इस्तेमाल किया जा सकता है.

इस्तेमाल किए जाने से जुड़ी जानकारी

रिट्रीवर और इंडेक्सर रेफ़रंस को इस तरह से इंपोर्ट करें:

import { pineconeRetrieverRef } from 'genkitx-pinecone';
import { pineconeIndexerRef } from 'genkitx-pinecone';

इसके बाद, retrieve() और index() को रेफ़रंस पास करें:

// To use the index you configured when you loaded the plugin:
let docs = await retrieve({ retriever: pineconeRetrieverRef, query });

// To specify an index:
export const bobFactsRetriever = pineconeRetrieverRef({
  indexId: 'bob-facts',
});
docs = await retrieve({ retriever: bobFactsRetriever, query });
// To use the index you configured when you loaded the plugin:
await index({ indexer: pineconeIndexerRef, documents });

// To specify an index:
export const bobFactsIndexer = pineconeIndexerRef({
  indexId: 'bob-facts',
});
await index({ indexer: bobFactsIndexer, documents });

इंडेक्स करने वाले और रिट्रीवर की जानकारी पाने वाले लोगों के बारे में सामान्य जानकारी पाने के लिए, Retrieval- Augmented जनरेशन पेज देखें.