feat(Qdrant Vector Store Node): Qdrant vector store support (#8080)

## Summary
This PR intends to add [Qdrant](https://qdrant.tech/) as a supported
vectorstore node to load and retrieve documents from in a workflow.


## Review / Merge checklist
- [x] PR title and summary are descriptive. 
- [x] Node/credentials documentation to be updated in
https://github.com/n8n-io/n8n-docs/pull/1796.

---------

Co-authored-by: oleg <me@olegivaniv.com>
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
Anush
2024-01-03 15:44:51 +05:30
committed by GitHub
parent ef3a57719e
commit 66460f66b0
7 changed files with 228 additions and 2 deletions

View File

@@ -45,3 +45,26 @@ export const supabaseTableNameRLC: INodeProperties = {
},
],
};
export const qdrantCollectionRLC: INodeProperties = {
displayName: 'Qdrant Collection',
name: 'qdrantCollection',
type: 'resourceLocator',
default: { mode: 'list', value: '' },
required: true,
modes: [
{
displayName: 'From List',
name: 'list',
type: 'list',
typeOptions: {
searchListMethod: 'qdrantCollectionsSearch',
},
},
{
displayName: 'ID',
name: 'id',
type: 'string',
},
],
};

View File

@@ -1,5 +1,6 @@
import { ApplicationError, type IDataObject, type ILoadOptionsFunctions } from 'n8n-workflow';
import { Pinecone } from '@pinecone-database/pinecone';
import { QdrantClient } from '@qdrant/js-client-rest';
export async function pineconeIndexSearch(this: ILoadOptionsFunctions) {
const credentials = await this.getCredentials('pineconeApi');
@@ -49,3 +50,21 @@ export async function supabaseTableNameSearch(this: ILoadOptionsFunctions) {
return { results };
}
export async function qdrantCollectionsSearch(this: ILoadOptionsFunctions) {
const credentials = await this.getCredentials('qdrantApi');
const client = new QdrantClient({
url: credentials.qdrantUrl as string,
apiKey: credentials.apiKey as string,
});
const response = await client.getCollections();
const results = response.collections.map((collection) => ({
name: collection.name,
value: collection.name,
}));
return { results };
}