npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-red-contrib-ml-rag

v1.0.30

Published

Retrieval Augmented Generation (RAG) and local GPT (text generation LLM - large language models) toolkit for machine learning (ML) apps with node-red

Downloads

139

Readme

node-red-contrib-ml-rag

This module for Node-RED contains a set of nodes which offer Retrieval Augmented Generation (RAG) and local GPT (text generation LLM - large language models) toolkit for machine learning (ML) apps with node-red.

Pre requisites

Be sure to have a working installation of Node-RED.
Install python and the following libraries:

  • Python 3.9.+ accessible by the command 'python' (on linux 'python3')
  • Full pip install: pip install langchain langchain_core PyPDF2 qdrant_client langchain-community langchain_huggingface langchain_qdrant pypdf sentence-transformers transformers nltk mmh3
  • Run the following in your python after installation:
    • import nltk
    • nltk.download('stopwords')
    • nltk.download('punkt_tab')
    • nltk.download('wordnet')

Install

To install the latest version use the Menu - Manage palette option and search for node-red-contrib-ml-rag, or run the following command in your Node-RED user directory (typically ~/.node-red):

npm i node-red-contrib-ml-rag

Usage

  • rag-pdf-loader: parse PDF files to text page-by-page using LangChain PyPDFLoader
  • rag-document-splitter: split text pages to chunks using LangChain RecursiveCharacterTextSplitter
  • rag-embedding-generator: generate regular dense and/or BM42 (sparse) embeddings for text using pretrained Hugging Face sentence transformers models. See https://huggingface.co/models?library=sentence-transformers . More about BM42: https://qdrant.tech/articles/bm42/
  • rag-vectordb-qdrant: awesome vector database Qdrant to store vectors/embedding and similarity search by them using dense vector or BM42 or dense-BM42 hybrid search with maximal marginal relevance (MMR) post-filter. More about BM42: https://qdrant.tech/articles/bm42/
  • rag-local-gpt: LLM/GPT model to generate text by prompt using pretrained Hugging Face text generation models and LangChain HuggingFacePipeline. See https://huggingface.co/models?pipeline_tag=text-generation

Example flows available here:

[
  {"id":"341d988d86ddbfae","type":"tab","label":"Examples node-red-contrib-ml-rag","disabled":false,"info":"","env":[]},{"id":"28a6fefd2290a22c","type":"inject","z":"341d988d86ddbfae","name":"set payload.file=$CWD/test.pdf","props":[{"p":"topic","v":"","vt":"date"},{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"file\":\"test.pdf\"}","payloadType":"json","x":210,"y":180,"wires":[["13b1f0f9ea370915"]]},{"id":"49a847d2d50f8c05","type":"file in","z":"341d988d86ddbfae","name":"","filename":"test.pdf","filenameType":"str","format":"","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":380,"y":280,"wires":[["577b8cecf0667df3"]]},{"id":"e9d382d4dda7c00a","type":"inject","z":"341d988d86ddbfae","name":"run flow with reading file","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"test","payload":"","payloadType":"date","x":180,"y":280,"wires":[["49a847d2d50f8c05"]]},{"id":"577b8cecf0667df3","type":"function","z":"341d988d86ddbfae","name":"set payload.filename and payload.buffer","func":"msg.payload={buffer:Array.from(msg.payload),\nfilename:msg.filename}\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":660,"y":280,"wires":[["13b1f0f9ea370915"]]},{"id":"13b1f0f9ea370915","type":"rag-pdf-loader","z":"341d988d86ddbfae","name":"rag-pdf-loader","x":1000,"y":280,"wires":[["36fa5b3700e70820","d85961a036da6fc8"],["d5a747423c1692a4"]]},{"id":"36fa5b3700e70820","type":"debug","z":"341d988d86ddbfae","name":"good","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1210,"y":260,"wires":[]},{"id":"d5a747423c1692a4","type":"debug","z":"341d988d86ddbfae","name":"errors and warnings","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1260,"y":320,"wires":[]},{"id":"d85961a036da6fc8","type":"rag-document-splitter","z":"341d988d86ddbfae","name":"rag-document-splitter","chunkSize":2048,"chunkOverlap":0,"x":640,"y":500,"wires":[["9ab50d9a90db2276","beb1f67252a15ba0"],["498a22456bd50d6b"]]},{"id":"9ab50d9a90db2276","type":"debug","z":"341d988d86ddbfae","name":"good","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":930,"y":480,"wires":[]},{"id":"498a22456bd50d6b","type":"debug","z":"341d988d86ddbfae","name":"errors and warnings","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":980,"y":540,"wires":[]},{"id":"531a79df512034ff","type":"inject","z":"341d988d86ddbfae","name":"test with json array of documents","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"test doc splitter","payload":"{\"documents\":[{\"page_content\":\"\\t1\\tSample PDF  Created for testing PDFObject  This PDF is three pages long. Three long pages. Or three short pages if you’re optimistic. Is it the same as saying “three long minutes”, knowing that all minutes are the same duration, and one cannot possibly be longer than the other? If these pages are all the same size, can one possibly be longer than the other?  I digress. Here’s some Latin. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur sodales ligula in libero.   Sed dignissim lacinia nunc. Curabitur tortor. Pellentesque nibh. Aenean quam. In scelerisque sem at dolor. Maecenas mattis. Sed convallis tristique sem. Proin ut ligula vel nunc egestas porttitor. Morbi lectus risus, iaculis vel, suscipit quis, luctus non, massa. Fusce ac turpis quis ligula lacinia aliquet. Mauris ipsum. Nulla metus metus, ullamcorper vel, tincidunt sed, euismod in, nibh.   Quisque volutpat condimentum velit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nam nec ante. Sed lacinia, urna non tincidunt mattis, tortor neque adipiscing diam, a cursus ipsum ante quis turpis. Nulla facilisi. Ut fringilla. Suspendisse potenti. Nunc feugiat mi a tellus consequat imperdiet. Vestibulum sapien. Proin quam. Etiam ultrices.   Suspendisse in justo eu magna luctus suscipit. Sed lectus. Integer euismod lacus luctus magna. Quisque cursus, metus vitae pharetra auctor, sem massa mattis sem, at interdum magna augue eget diam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Morbi lacinia molestie dui. Praesent blandit dolor. Sed non quam. In vel mi sit amet augue congue elementum. Morbi in ipsum sit amet pede facilisis laoreet. Donec lacus nunc, viverra nec, blandit vel, egestas et, augue. Vestibulum tincidunt malesuada tellus. Ut ultrices ultrices enim. Curabitur sit amet mauris.   Morbi in dui quis est pulvinar ullamcorper. Nulla facilisi. Integer lacinia sollicitudin massa. Cras metus. Sed aliquet risus a tortor. Integer id quam. Morbi mi. Quisque nisl felis, venenatis tristique, dignissim in, ultrices sit amet, augue. Proin sodales libero eget ante. Nulla quam. Aenean laoreet. Vestibulum nisi lectus, commodo ac, facilisis ac, ultricies eu, pede. Ut orci risus, accumsan porttitor, cursus quis, aliquet eget, justo. Sed pretium blandit orci.   Ut eu diam at pede suscipit sodales. Aenean lectus elit, fermentum non, convallis id, sagittis at, neque. Nullam mauris orci, aliquet et, iaculis et, viverra vitae, ligula. Nulla ut felis in purus aliquam imperdiet. Maecenas aliquet mollis lectus. Vivamus consectetuer risus et tortor. Lorem \",\"metadata\":{\"source\":\"d:/a/sample-local-pdf.2.pdf\",\"page\":0}},{\"page_content\":\"\\t2\\tipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris.   Fusce nec tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur sodales ligula in libero. Sed dignissim lacinia nunc. Curabitur tortor. Pellentesque nibh. Aenean quam. In scelerisque sem at dolor. Maecenas mattis. Sed convallis tristique sem.   Proin ut ligula vel nunc egestas porttitor. Morbi lectus risus, iaculis vel, suscipit quis, luctus non, massa. Fusce ac turpis quis ligula lacinia aliquet. Mauris ipsum. Nulla metus metus, ullamcorper vel, tincidunt sed, euismod in, nibh. Quisque volutpat condimentum velit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nam nec ante. Sed lacinia, urna non tincidunt mattis, tortor neque adipiscing diam, a cursus ipsum ante quis turpis. Nulla facilisi. Ut fringilla. Suspendisse potenti.   Nunc feugiat mi a tellus consequat imperdiet. Vestibulum sapien. Proin quam. Etiam ultrices. Suspendisse in justo eu magna luctus suscipit. Sed lectus. Integer euismod lacus luctus magna. Quisque cursus, metus vitae pharetra auctor, sem massa mattis sem, at interdum magna augue eget diam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Morbi lacinia molestie dui. Praesent blandit dolor. Sed non quam. In vel mi sit amet augue congue elementum. Morbi in ipsum sit amet pede facilisis laoreet.   Donec lacus nunc, viverra nec, blandit vel, egestas et, augue. Vestibulum tincidunt malesuada tellus. Ut ultrices ultrices enim. Curabitur sit amet mauris. Morbi in dui quis est pulvinar ullamcorper. Nulla facilisi. Integer lacinia sollicitudin massa. Cras metus. Sed aliquet risus a tortor. Integer id quam. Morbi mi.   Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur sodales ligula in libero.   Sed dignissim lacinia nunc. Curabitur tortor. Pellentesque nibh. Aenean quam. In scelerisque sem at dolor. Maecenas mattis. Sed convallis tristique sem. Proin ut ligula vel nunc egestas porttitor. Morbi lectus risus, iaculis vel, suscipit quis, luctus non, massa. Fusce ac turpis quis ligula lacinia aliquet. Mauris ipsum. Nulla metus metus, ullamcorper vel, tincidunt sed, euismod in, nibh.   Quisque volutpat condimentum velit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nam nec ante. Sed lacinia, urna non tincidunt mattis, tortor neque adipiscing diam, a cursus ipsum ante quis turpis. Nulla facilisi. Ut fringilla. Suspendisse potenti. Nunc feugiat mi a tellus consequat imperdiet. Vestibulum sapien. Proin quam. Etiam ultrices.   Suspendisse in justo eu magna luctus suscipit. Sed lectus. Integer euismod lacus luctus magna. Quisque cursus, metus vitae pharetra auctor, sem massa mattis sem, at interdum magna augue eget diam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Morbi lacinia molestie dui. Praesent blandit dolor. Sed non quam. In vel mi sit amet augue congue \",\"metadata\":{\"source\":\"d:/a/sample-local-pdf.2.pdf\",\"page\":1}},{\"page_content\":\"\\t3\\telementum. Morbi in ipsum sit amet pede facilisis laoreet. Donec lacus nunc, viverra nec, blandit vel, egestas et, augue. Vestibulum tincidunt malesuada tellus. Ut ultrices ultrices enim. Curabitur sit amet mauris.   Morbi in dui quis est pulvinar ullamcorper. Nulla facilisi. Integer lacinia sollicitudin massa. Cras metus. Sed aliquet risus a tortor. Integer id quam. Morbi mi. Quisque nisl felis, venenatis tristique, dignissim in, ultrices sit amet, augue. Proin sodales libero eget ante. Nulla quam. Aenean laoreet. Vestibulum nisi lectus, commodo ac, facilisis ac, ultricies eu, pede. Ut orci risus, accumsan porttitor, cursus quis, aliquet eget, justo. Sed pretium blandit orci.   Ut eu diam at pede suscipit sodales. Aenean lectus elit, fermentum non, convallis id, sagittis at, neque. Nullam mauris orci, aliquet et, iaculis et, viverra vitae, ligula. Nulla ut felis in purus aliquam imperdiet. Maecenas aliquet mollis lectus. Vivamus consectetuer risus et tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris.   Fusce nec tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur sodales ligula in libero. Sed dignissim lacinia nunc. Curabitur tortor. Pellentesque nibh. Aenean quam. In scelerisque sem at dolor. Maecenas mattis. Sed convallis tristique sem.   Proin ut ligula vel nunc egestas porttitor. Morbi lectus risus, iaculis vel, suscipit quis, luctus non, massa. Fusce ac turpis quis ligula lacinia aliquet. Mauris ipsum. Nulla metus metus, ullamcorper vel, tincidunt sed, euismod in, nibh. Quisque volutpat condimentum velit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nam nec ante. Sed lacinia, urna non tincidunt mattis, tortor neque adipiscing diam, a cursus ipsum ante quis turpis. Nulla facilisi. Ut fringilla. Suspendisse potenti.   Nunc feugiat mi a tellus consequat imperdiet. Vestibulum sapien. Proin quam. Etiam ultrices. Suspendisse in justo eu magna luctus suscipit. Sed lectus. Integer euismod lacus luctus magna. Quisque cursus, metus vitae pharetra auctor, sem massa mattis sem, at interdum magna augue eget diam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Morbi lacinia molestie dui. Praesent blandit dolor. Sed non quam. In vel mi sit amet augue congue elementum. Morbi in ipsum sit amet pede facilisis laoreet.   \",\"metadata\":{\"source\":\"d:/a/sample-local-pdf.2.pdf\",\"page\":2}}]}","payloadType":"json","x":230,"y":500,"wires":[["d85961a036da6fc8"]]},{"id":"41b8d4bcd0b09f72","type":"comment","z":"341d988d86ddbfae","name":"rag-pdf-loader examples","info":"","x":650,"y":100,"wires":[]},{"id":"da84f2d7bfac52e1","type":"comment","z":"341d988d86ddbfae","name":"rag-document-splitter examples","info":"","x":650,"y":400,"wires":[]},{"id":"beb1f67252a15ba0","type":"rag-embedding-generator","z":"341d988d86ddbfae","name":"rag-embedding-generator","modelNameOrPath":"sergeyzh/LaBSE-ru-turbo","x":650,"y":680,"wires":[["67f8d7e791766d78"],["abcb44bfd766a9ee"]]},{"id":"fe9f2c6eb6f9508d","type":"comment","z":"341d988d86ddbfae","name":"rag-embedding-generator examples","info":"","x":640,"y":600,"wires":[]},{"id":"67f8d7e791766d78","type":"debug","z":"341d988d86ddbfae","name":"good","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":930,"y":660,"wires":[]},{"id":"abcb44bfd766a9ee","type":"debug","z":"341d988d86ddbfae","name":"errors and warnings","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":980,"y":720,"wires":[]},{"id":"392c9250714dfae4","type":"inject","z":"341d988d86ddbfae","name":"test with json array of documents","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"test doc splitter","payload":"{\"state\":\"success\",\"documents\":[{\"page_content\":\"\\t1\\tSample PDF  Created for testing PDFObject  This PDF is three pages long. Three long pages. Or three short pages if you’re optimistic. Is it the same as saying “three long minutes”, knowing that all minutes are the same duration, and one cannot possibly be longer than the other? If these pages are all the same size, can one possibly be longer than the other?  I digress. Here’s some Latin. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur sodales ligula in libero.   Sed dignissim lacinia nunc. Curabitur tortor. Pellentesque nibh. Aenean quam. In scelerisque sem at dolor. Maecenas mattis. Sed convallis tristique sem. Proin ut ligula vel nunc egestas porttitor. Morbi lectus risus, iaculis vel, suscipit quis, luctus non, massa. Fusce ac turpis quis ligula lacinia aliquet. Mauris ipsum. Nulla metus metus, ullamcorper vel, tincidunt sed, euismod in, nibh.   Quisque volutpat condimentum velit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nam nec ante. Sed lacinia, urna non tincidunt mattis, tortor neque adipiscing diam, a cursus ipsum ante quis turpis. Nulla facilisi. Ut fringilla. Suspendisse potenti. Nunc feugiat mi a tellus consequat imperdiet. Vestibulum sapien. Proin quam. Etiam ultrices.   Suspendisse in justo eu magna luctus suscipit. Sed lectus. Integer euismod lacus luctus magna. Quisque cursus, metus vitae pharetra auctor, sem massa mattis sem, at interdum magna augue eget diam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Morbi lacinia molestie dui. Praesent blandit dolor. Sed non quam. In vel mi sit amet augue congue elementum. Morbi in ipsum sit amet pede facilisis laoreet. Donec lacus nunc, viverra nec, blandit vel, egestas et, augue. Vestibulum tincidunt malesuada tellus. Ut ultrices ultrices enim. Curabitur sit amet mauris.   Morbi in dui quis est pulvinar ullamcorper. Nulla facilisi. Integer lacinia sollicitudin massa. Cras metus. Sed aliquet risus a tortor. Integer id quam. Morbi mi. Quisque nisl felis, venenatis tristique, dignissim in, ultrices sit amet, augue. Proin sodales libero eget ante. Nulla quam. Aenean laoreet. Vestibulum nisi lectus, commodo ac, facilisis ac, ultricies eu, pede. Ut orci risus, accumsan porttitor, cursus quis, aliquet eget, justo. Sed pretium blandit orci.   Ut eu diam at pede suscipit sodales. Aenean lectus elit, fermentum non, convallis id, sagittis at, neque. Nullam mauris orci, aliquet et, iaculis et, viverra vitae, ligula. Nulla ut felis in purus aliquam imperdiet. Maecenas aliquet mollis lectus. Vivamus consectetuer risus et tortor. Lorem \",\"metadata\":{\"source\":\"d:/a/sample-local-pdf.2.pdf\",\"page\":0}},{\"page_content\":\"\\t2\\tipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris.   Fusce nec tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur sodales ligula in libero. Sed dignissim lacinia nunc. Curabitur tortor. Pellentesque nibh. Aenean quam. In scelerisque sem at dolor. Maecenas mattis. Sed convallis tristique sem.   Proin ut ligula vel nunc egestas porttitor. Morbi lectus risus, iaculis vel, suscipit quis, luctus non, massa. Fusce ac turpis quis ligula lacinia aliquet. Mauris ipsum. Nulla metus metus, ullamcorper vel, tincidunt sed, euismod in, nibh. Quisque volutpat condimentum velit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nam nec ante. Sed lacinia, urna non tincidunt mattis, tortor neque adipiscing diam, a cursus ipsum ante quis turpis. Nulla facilisi. Ut fringilla. Suspendisse potenti.   Nunc feugiat mi a tellus consequat imperdiet. Vestibulum sapien. Proin quam. Etiam ultrices. Suspendisse in justo eu magna luctus suscipit. Sed lectus. Integer euismod lacus luctus magna. Quisque cursus, metus vitae pharetra auctor, sem massa mattis sem, at interdum magna augue eget diam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Morbi lacinia molestie dui. Praesent blandit dolor. Sed non quam. In vel mi sit amet augue congue elementum. Morbi in ipsum sit amet pede facilisis laoreet.   Donec lacus nunc, viverra nec, blandit vel, egestas et, augue. Vestibulum tincidunt malesuada tellus. Ut ultrices ultrices enim. Curabitur sit amet mauris. Morbi in dui quis est pulvinar ullamcorper. Nulla facilisi. Integer lacinia sollicitudin massa. Cras metus. Sed aliquet risus a tortor. Integer id quam. Morbi mi.   Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur sodales ligula in libero.   Sed dignissim lacinia nunc. Curabitur tortor. Pellentesque nibh. Aenean quam. In scelerisque sem at dolor. Maecenas mattis. Sed convallis tristique sem. Proin ut ligula vel nunc egestas porttitor. Morbi lectus risus, iaculis vel, suscipit quis, luctus non, massa. Fusce ac turpis quis ligula lacinia aliquet. Mauris ipsum. Nulla metus metus, ullamcorper vel, tincidunt sed, euismod in, nibh.   Quisque volutpat condimentum velit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nam nec ante. Sed lacinia, urna non tincidunt mattis, tortor neque adipiscing diam, a cursus ipsum ante quis turpis. Nulla facilisi. Ut fringilla. Suspendisse potenti. Nunc feugiat mi a tellus consequat imperdiet. Vestibulum sapien. Proin quam. Etiam ultrices.   Suspendisse in justo eu magna luctus suscipit. Sed lectus. Integer euismod lacus luctus magna. Quisque cursus, metus vitae pharetra auctor, sem massa mattis sem, at interdum magna augue eget diam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Morbi lacinia molestie dui. Praesent blandit dolor. Sed non quam. In vel mi sit amet augue congue \",\"metadata\":{\"source\":\"d:/a/sample-local-pdf.2.pdf\",\"page\":1}},{\"page_content\":\"\\t3\\telementum. Morbi in ipsum sit amet pede facilisis laoreet. Donec lacus nunc, viverra nec, blandit vel, egestas et, augue. Vestibulum tincidunt malesuada tellus. Ut ultrices ultrices enim. Curabitur sit amet mauris.   Morbi in dui quis est pulvinar ullamcorper. Nulla facilisi. Integer lacinia sollicitudin massa. Cras metus. Sed aliquet risus a tortor. Integer id quam. Morbi mi. Quisque nisl felis, venenatis tristique, dignissim in, ultrices sit amet, augue. Proin sodales libero eget ante. Nulla quam. Aenean laoreet. Vestibulum nisi lectus, commodo ac, facilisis ac, ultricies eu, pede. Ut orci risus, accumsan porttitor, cursus quis, aliquet eget, justo. Sed pretium blandit orci.   Ut eu diam at pede suscipit sodales. Aenean lectus elit, fermentum non, convallis id, sagittis at, neque. Nullam mauris orci, aliquet et, iaculis et, viverra vitae, ligula. Nulla ut felis in purus aliquam imperdiet. Maecenas aliquet mollis lectus. Vivamus consectetuer risus et tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris.   Fusce nec tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur sodales ligula in libero. Sed dignissim lacinia nunc. Curabitur tortor. Pellentesque nibh. Aenean quam. In scelerisque sem at dolor. Maecenas mattis. Sed convallis tristique sem.   Proin ut ligula vel nunc egestas porttitor. Morbi lectus risus, iaculis vel, suscipit quis, luctus non, massa. Fusce ac turpis quis ligula lacinia aliquet. Mauris ipsum. Nulla metus metus, ullamcorper vel, tincidunt sed, euismod in, nibh. Quisque volutpat condimentum velit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nam nec ante. Sed lacinia, urna non tincidunt mattis, tortor neque adipiscing diam, a cursus ipsum ante quis turpis. Nulla facilisi. Ut fringilla. Suspendisse potenti.   Nunc feugiat mi a tellus consequat imperdiet. Vestibulum sapien. Proin quam. Etiam ultrices. Suspendisse in justo eu magna luctus suscipit. Sed lectus. Integer euismod lacus luctus magna. Quisque cursus, metus vitae pharetra auctor, sem massa mattis sem, at interdum magna augue eget diam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Morbi lacinia molestie dui. Praesent blandit dolor. Sed non quam. In vel mi sit amet augue congue elementum. Morbi in ipsum sit amet pede facilisis laoreet.   \",\"metadata\":{\"source\":\"d:/a/sample-local-pdf.2.pdf\",\"page\":2}}]}","payloadType":"json","x":230,"y":680,"wires":[["beb1f67252a15ba0"]]},{"id":"bfc698c4e85c36a5","type":"rag-vectordb-qdrant","z":"341d988d86ddbfae","name":"rag-vectordb-qdrant","localSavePath":"somedir","remoteUrl":"","remoteApiKey":"","x":830,"y":920,"wires":[["751ed29f83bab5bf"],["3667724087530fda"]]},{"id":"7d44d529873d5c4e","type":"inject","z":"341d988d86ddbfae","name":"set payload.file and load example pdf to db","props":[{"p":"topic","vt":"str"},{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"load_to_db","payload":"{\"file\":\"d:/a/sample-local-pdf.pdf\"}","payloadType":"json","x":200,"y":840,"wires":[["f052d0af9c133fd2"]]},{"id":"f052d0af9c133fd2","type":"rag-pdf-loader","z":"341d988d86ddbfae","name":"rag-pdf-loader","x":500,"y":840,"wires":[["e9861e3dd9f69b21"],[]]},{"id":"e9861e3dd9f69b21","type":"rag-document-splitter","z":"341d988d86ddbfae","name":"rag-document-splitter","chunkSize":2048,"chunkOverlap":0,"x":500,"y":900,"wires":[["4a68d31acdbb4218"],[]]},{"id":"4a68d31acdbb4218","type":"rag-embedding-generator","z":"341d988d86ddbfae","name":"rag-embedding-generator","modelNameOrPath":"sergeyzh/LaBSE-ru-turbo","x":510,"y":980,"wires":[["a108a56270484f58"],[]]},{"id":"751ed29f83bab5bf","type":"debug","z":"341d988d86ddbfae","name":"good","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1110,"y":900,"wires":[]},{"id":"3667724087530fda","type":"debug","z":"341d988d86ddbfae","name":"errors and warnings","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1160,"y":960,"wires":[]},{"id":"a108a56270484f58","type":"function","z":"341d988d86ddbfae","name":"set vectordb input","func":"if (msg.topic===\"load_to_db\") {\n    msg.payload.collection_name='test'\n    msg.payload.command ='add_document'\n    msg.payload.documents[0].id=123\n} else if (msg.topic===\"test_retrieve\") {\n    msg.payload.command=\"similarity_search\"\n    msg.payload.collection_name='test'\n    msg.payload.k=5\n    msg.payload.with_payload=1\n    msg.payload.with_vectors=0\n    msg.payload.search_type='mmr'\n    msg.payload.embeddings=msg.payload.documents[0].embeddings\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":790,"y":840,"wires":[["bfc698c4e85c36a5"]]},{"id":"7b0e064b5aec79a1","type":"comment","z":"341d988d86ddbfae","name":"rag-vectordb-qdrant examples","info":"","x":600,"y":760,"wires":[]},{"id":"48c382825a597edd","type":"inject","z":"341d988d86ddbfae","name":"send test prompt for doc retriever","props":[{"p":"topic","vt":"str"},{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"test_retrieve","payload":"{\"documents\":[{\"page_content\":\"test prompt\"}]}","payloadType":"json","x":190,"y":1000,"wires":[["4a68d31acdbb4218"]]},{"id":"5e301b284c60f214","type":"comment","z":"341d988d86ddbfae","name":"rag-local-gpt examples","info":"","x":600,"y":1060,"wires":[]},{"id":"871ccb7e97cd3d41","type":"rag-local-gpt","z":"341d988d86ddbfae","name":"rag-local-gpt","modelNameOrPath":"openai-community/gpt2","promptTemplate":"Text:{context} Question: {input}","deviceMap":"auto","maxNewTokens":2048,"doSample":1,"topK":0,"topP":0.15,"temperature":0.3,"repetitionPenalty":1.1,"x":590,"y":1140,"wires":[["e7c57cad709b0652"],["c936b5a14cf5117c"]]},{"id":"c6d20fb51115624d","type":"inject","z":"341d988d86ddbfae","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"test_gpt","payload":"{\"input\":\"Hello world\",\"documents\":[{\"page_content\":\"hello exclamation, noun UK  /heˈləʊ/ US  /heˈloʊ/ (also mainly UK hallo); (hullo) Add to word list A1 used when meeting or greeting someone: Hello, Paul. I haven't seen you for ages. I know her vaguely - we've exchanged hellos a few times. say hello I just thought I'd call by and say hello. a big hello And a big hello (= welcome) to all the parents who've come to see the show.   A1 something that is said at the beginning of a phone conversation: Hello, I'd like some information about flights to the US, please. something that is said to attract someone's attention: The front door was open so she walked inside and called out, Hello! Is there anybody in?\"}]}","payloadType":"json","x":240,"y":1140,"wires":[["871ccb7e97cd3d41"]]},{"id":"e7c57cad709b0652","type":"debug","z":"341d988d86ddbfae","name":"good","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":790,"y":1120,"wires":[]},{"id":"c936b5a14cf5117c","type":"debug","z":"341d988d86ddbfae","name":"errors and warnings","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":840,"y":1160,"wires":[]}
]

Thanks

Thanks to Gabriele Maurina for awesome nodes - node-red-contrib-machine-learning Thanks to Qdrant for BM42 hybrid search - BM42: New Baseline for Hybrid Search