Skip to content

qdrant/qdrant-genkit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Qdrant plugin

The Qdrant plugin provides Genkit indexer and retriever implementations in JS and Go that use the Qdrant.

Installation

npm i genkitx-qdrant

Configuration

To use this plugin, specify it when you call configureGenkit():

import { qdrant } from 'genkitx-qdrant';

export default configureGenkit({
  plugins: [
    qdrant([
      {
        clientParams: {
          host: 'localhost',
          port: 6333,
        },
        collectionName: 'some-collection',
        embedder: textEmbeddingGecko,
      },
    ]),
  ],
  // ...
});

You'll need to specify a collection name, the embedding model you want to use and the Qdrant client parameters. In addition, there are a few optional parameters:

  • embedderOptions: Additional options to pass options to the embedder:

    embedderOptions: { taskType: 'RETRIEVAL_DOCUMENT' },
  • contentPayloadKey: Name of the payload filed with the document content. Defaults to "content".

    contentPayloadKey: 'content';
  • metadataPayloadKey: Name of the payload filed with the document metadata. Defaults to "metadata".

    metadataPayloadKey: 'metadata';
  • collectionCreateOptions: Additional options when creating the Qdrant collection.

Usage

Import retriever and indexer references like so:

import { qdrantIndexerRef, qdrantRetrieverRef } from 'genkitx-qdrant';
import { Document, index, retrieve } from '@genkit-ai/ai/retriever';

Then, pass the references to retrieve() and index():

// To specify an indexer:
export const qdrantIndexer = qdrantIndexerRef({
  collectionName: 'some-collection',
  displayName: 'Some Collection indexer',
});

await index({ indexer: qdrantIndexer, documents });
// To specify a retriever:
export const qdrantRetriever = qdrantRetrieverRef({
  collectionName: 'some-collection',
  displayName: 'Some Collection Retriever',
});

let docs = await retrieve({ retriever: qdrantRetriever, query });

You can refer to Retrieval-augmented generation for a general discussion on indexers and retrievers.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published