Chapter 7. Test your model with retrieval augmented generation (RAG)
You can enhance your model responses by providing it with contextual information from your own documents using retrieval augmented generation (RAG). You can upload documents to the vector database associated with the playground to provide context for your model responses.
The RAG feature of the gen AI playground is currently configured to work only with an inline vector database. There is currently no mechanism to configure the playground to connect this RAG feature to an external or remote vector database.
Prerequisites
- You have configured a playground for your project.
- You have the document files ready to upload. The supported file formats are PDF, DOC, or CSV. You can upload up to 10 files, with a maximum size of 10MB per file.
Procedure
-
From the OpenShift AI dashboard, click Gen AI studio
Playground. - In the settings panel, click the Knowledge tab.
- Click Upload files.
Click Upload.
The Upload files dialog opens.
- Drag and drop your file or click to browse and select a file from your local system.
- Optional: Adjust the Maximum chunk length and Chunk overlap and Delimiter values as needed for your document type. For more information about these settings, see Understanding RAG settings.
Click Upload.
Wait for the file to finish processing. A Source uploaded notification appears, and the file is listed under Uploaded files.
- Repeat these steps to upload additional files if needed.
- Optional: In the Prompt tab, review or edit the system instructions. The playground provides a default prompt.
- In the chat input field, ask a question related to your documents that the model would not know otherwise.
Observe the model response.
TipIf the model does not use its knowledge search tool, you can modify the system instructions in the Prompt tab to change this behavior.
To ensure that the model actively utilizes the available RAG documents rather than relying solely on its pre-trained data, refine the system prompt by including directives as shown in the following examples:
-
To force use: "You MUST use the
knowledge_searchtool to obtain updated information." - To specify context: "Always search the knowledge base before answering questions about company policies, recent events, or specific documentation."
NoteAfter you send a prompt, the Send button changes to a Stop button. Click it to interrupt the model response.
-
To force use: "You MUST use the
- Optional: To clear the chat history and start a new conversation, click New Chat. Your playground configuration settings are preserved.
Verification
- The model retrieves information from the uploaded documents to answer the questions.