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 색인 ID와 사용할 임베딩 모델을 지정해야 합니다.

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

일반적인 내용은 검색 증강 생성 페이지를 참조하세요. 오신 것을 환영합니다