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 ऑब्जेक्ट है, जो पाइनकोन क्लाइंट को भेजा गया; इसका इस्तेमाल करके, क्लाइंट के लिए कोई भी पैरामीटर पास किया जा सकता है इस्तेमाल किया जा सकता है.

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

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

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 });

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