LLM Examples

With the LLM tooling provided by Pathway, building LLM and RAG pipelines have become easy. If you want to see how it works, this page gathers practical examples using Pathway LLM tooling.

Pathway RAG app with always up-to-date knowledge This example shows how to create a RAG application using Pathway that provides always up-to-date knowledge to your LLM without the need for a separate ETL. You can create a vector store from different data sources, such as SharePoint or Google Drive, and use any LLM model to answer questions using the indexed documents.
Adaptive RAG Example of the Adaptive RAG, a technique to dynamically adapt the number of documents in a RAG prompt using feedback from the LLM.
Fully Private RAG with Pathway This example shows how to set up a private RAG pipeline with adaptive retrieval using Pathway, Mistral, and Ollama.
Multimodal RAG with Pathway This example demonstrates how you can launch a Multimodal RAG with Pathway. It relies on a document processing pipeline that utilizes GPT-4o in the parsing stage. Pathway extracts information from unstructured financial documents in your folders, updating results as documents change or new ones arrive. You can make your AI application run in permanent connection with your drive, in sync with your documents which include visually formatted elements: tables, charts, etc. This example highlights the limitations of traditional RAG setups, which struggle to answer questions based on table data. By contrast, our multimodal RAG approach excels in extracting accurate information from tables.

Simple examples

Contextless Pipeline This example implements a pipeline that answers a single question, without any context. The query is asked such as it is, without prompt engineering, to the model.
Contextful Pipeline This example implements a simple pipeline that answers questions based on documents in a given folder. The query is enhanced using prompt engineering: the most relevant documents are retrieved from the folder, and added to the prompt to allow the LLM model to have more context to answer the query.
Contextful S3 Pipeline This example implements a pipeline similar to the "contextful" one, it answers questions based on documents stored in S3.
Local Pipeline This pipeline is similar to the contextful pipeline, but relies on local computations, rather than querying external API.
Realtime Document Indexing with Pathway Basic example of a real-time document indexing pipeline powered by Pathway. You can index documents from different data sources, such as SharePoint or Google Drive. You can then query the index to retrieve documents, get statistics about the index, and retrieve file metadata.
Contextful Parsing Pipeline This example implements a RAG pipeline, similarly to contextful pipeline. It parses unstructured documents such as PDFs.

Advanced examples

Alert Pipeline Example implementing a pipeline that answers questions based on documents in a given folder. Additionally, in your prompts you can ask to be notified of any changes - in such case an alert will be sent to a Slack channel.
Drive Alert Pipeline This example is very similar to the "Alert" example, the only difference is the data source (Google Drive). To learn more, you can read [our article](https://pathway.com/developers/templates/llm-alert-pathway/) about it.
Unstructured to SQL The example extracts and structures the data out of unstructured data (PDFs and queries) on the fly. You can read more about this example in [our article](https://pathway.com/developers/templates/unstructured-to-structured/) about it.
Contextful Geometric Pipeline This example implements a pipeline that answers questions based on documents in a given folder. To get the answer it sends increasingly more documents to the LLM chat until it can find an answer. You can read more about the reasoning behind this approach here.
Discuss tricks & tips for RAG

Join our Discord community and dive into discussions on tricks and tips for mastering Retrieval Augmented Generation

LLMRAGLLM examples