[RAG] Load Document
The Rag load document
operation retrieves information based on a plain text prompt from an in-memory embedding store. In this context, "RAG" stands for Retrieval-Augmented Generation, which combines the retrieval of relevant documents with the generation of responses. This technique enhances the performance of language models by providing them with specific context or background information from the retrieved documents, allowing them to generate more informed and accurate responses.
Input Fields
Module Configuration
This refers to the MuleSoft AI Chain LLM Configuration set up in the Getting Started section.
General Operation Fields
- Data: The prompt to be sent to the LLM along with the embedding store to respond to.
- Context Path: Contains the full file path for the document to be ingested into the embedding store. Ensure the file path is accessible. You can also use a DataWeave expression for this field, e.g.,
mule.home ++ "/apps/" ++ app.name ++ "/customer-service.pdf"
.
Context Operation Field
- File Type: Contains the type of the document to be ingested into the embedding store. Currently, three file types are supported:
- text: Any type of text files (json, xml, txt, csv, etc.)
- pdf: Only system-generated
- url: Only single URL supported
XML Configuration
Below is the XML configuration for this operation:
<ms-aichain:rag-load-document
doc:name="Rag load document"
doc:id="3d3edd66-4970-4dad-a5bf-2a8eae123da4"
config-ref="MAC_AI_Llm_configuration"
data="#[payload.prompt]"
contextPath="#[payload.contextPath]"
/>
Output Field for v0.2.0
This operation responds with a string
payload which needs to be converted into a json, this can be achieved with a Transform Message component with the following dataweave expression:
%dw 2.0
output application/json
---
read(payload,"application/json").
Output Field
This operation responds with a json
payload.
Example Use Cases
This operation is useful in scenarios where you need to retrieve information from a document based on a plain text prompt, such as:
- Knowledge Management: Extracting specific information from documents stored in a knowledge base.
- Customer Support: Retrieving relevant data from customer service documents to assist with inquiries.
- Research: Accessing information from research papers or documents based on specific queries.