- RAG+Citation
- Text Classification
RAG+C System Message Format
Proper formatting of the system message is essential for the effective functioning of RAG-Buddy. The system message for the RAG+C use case is comprised of an introduction, optional instructions, and a series of articles.RAG+C Elements of the System Message
-
System Introduction: Sets the context for the interaction.
- Example: “You are a customer support agent of the e-banking application Piggy Bank Extraordinaire.”
-
System Instructions (Optional): Use default instructions or provide custom ones.
- Default: Guidelines for selecting and referencing articles (recommended).
- Custom: Replace
{system_instructions}in the template with your instructions.
-
Articles: Each article should have a unique ID and relevant content.
- Format:
## ID:<unique_identifier> [Article Title and Content]. Content can be multi-line.
- Format:
Formatting the Message for RAG+C
Assemble the system message like the Python example below, with each section with an all caps header and separated by double line breaks:Construction of the system message
Text-Classification System Message Format
The system message for the Text-Classification use case is comprised of system instructions (not optional).Text-Classification Elements of the System Message
- System Instructions: Guidelines for the LLM to select the most relevant class and to return that.
- Example: “You are an expert assistant in the field of customer service. Your task is to help workers in the customer service department of a company.\nYour task is to classify the customer’s question in order to help the customer service worker to answer the question. In order to help the worker, you MUST respond with the name of one of the following classes you know.\nIn case you reply with something else, you will be penalized.\nThe classes are the following:“
Formatting the Message for Text-Classification
Assemble the system message like the Python example below:Construction of the system message
Advanced Features
The feature below are applicable to both RAG+C and Text Classification use cases.Cache-Control
TheHelvia-RAG-Buddy-Cache-Control header is essential for managing how RAG-Buddy’s cache is used, influencing both reading and writing operations.
Options for Cache-Control
no-cache: The cache will not be used for reading, but it will be updated with the new response.no-store: Responses will not be added to the cache.no-cache, no-store: Both reading from and writing to the cache are disabled.- Omitting the header: This enables both reading from and writing to the cache.
Effects of Cache-Control Options
The table below summarizes the impact of each Cache-Control option on cache behavior:
Understanding and applying these options correctly can significantly impact the performance and efficiency of your integration with RAG-Buddy.
Reading Response Headers
- Purpose: Understanding whether your request was served from the cache or fetched anew can be critical for debugging and performance optimization.
- Implementation:
- After each API call, check the response headers.
- Look for the response header
Helvia-RAG-Buddy-Cache-Status. - This header will indicate whether the response was a cache hit or not. If there was a cache hit, the value will be an integer, referring to an internal database ID. If there was a cache miss, the header will not be part of the repsponse or will have value
Noneor an empty string.
Comprehensive Example
In this example we implement the RAG+C use case. For the Text-Classification use case please refer to the Quickstart.
RAG-Buddy Proxy Integration