Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/qdrant/qdrant-genkit
https://github.com/qdrant/qdrant-genkit
Last synced: 6 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/qdrant/qdrant-genkit
- Owner: qdrant
- License: apache-2.0
- Created: 2024-06-10T06:25:28.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-12-30T05:27:44.000Z (16 days ago)
- Last Synced: 2025-01-03T10:41:09.211Z (12 days ago)
- Language: TypeScript
- Size: 28.3 KB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-firebase-genkit - `genkitx-qdrant` - Plugin for Qdrant Vector Stores. (Plugins / JavaScript - Community)
- trackawesomelist - `genkitx-qdrant` - Plugin for Qdrant Vector Stores. (Recently Updated / [Sep 15, 2024](/content/2024/09/15/README.md))
README
# Qdrant plugin
The Qdrant plugin provides [Genkit](https://firebase.google.com/docs/genkit) indexer and retriever implementations in JS and Go that use the [Qdrant](https://qdrant.tech/).
## Installation
```bash
npm i genkitx-qdrant
```## Configuration
To use this plugin, specify it when you call `configureGenkit()`:
```js
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:
```js
embedderOptions: { taskType: 'RETRIEVAL_DOCUMENT' },
```- `contentPayloadKey`: Name of the payload filed with the document content. Defaults to "content".
```js
contentPayloadKey: 'content';
```- `metadataPayloadKey`: Name of the payload filed with the document metadata. Defaults to "metadata".
```js
metadataPayloadKey: 'metadata';
```- `collectionCreateOptions`: [Additional options](<(https://qdrant.tech/documentation/concepts/collections/#create-a-collection)>) when creating the Qdrant collection.
## Usage
Import retriever and indexer references like so:
```js
import { qdrantIndexerRef, qdrantRetrieverRef } from 'genkitx-qdrant';
import { Document, index, retrieve } from '@genkit-ai/ai/retriever';
```Then, pass the references to `retrieve()` and `index()`:
```js
// To specify an indexer:
export const qdrantIndexer = qdrantIndexerRef({
collectionName: 'some-collection',
displayName: 'Some Collection indexer',
});await index({ indexer: qdrantIndexer, documents });
``````js
// 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](https://firebase.google.com/docs/genkit/rag) for a general
discussion on indexers and retrievers.