Skip to content

SSRAG Framework

Single Shot RAG (SSRAG) Framework is a variant of the RAG framework. Instead of generating the search query, user input is directly sent to the datasource to retrieve the relevant content.

Since it only performs 1 LLM call. It is generally faster than RAG framework. This framework requires a specific format of prompt.

Data Flow

flowchart LR
    A[Input] -->B[SSRAG Framework]
    B --> |prompt| D[DataSource]
    D[DataSource] --> |retrieved documents| B[RAG Framework]
    B[RAG Framework] --> |Input + retrieved docs|E[LLM] -->|LLM Response|B
    B --> |post processing|F[Output]

How to use

Usecase Creation

You can use the developer portal under the tab usecase creation or call the POST API. Please use the following steps:

  1. Create a datasource first by uploading relevant files (Please refer to Datasource for further details.) We provide a SingtelDemo datasource as an example.

  2. Create SSRAG use case by providing the required attirbutes. Prompt that needs to have {input question} and {sources}.

Here's a sample: ```text Explain why each of the 3 sources retrieved is relevant to the user query.

User Query: {input_question}

Sources: {sources}

Return in the following format: 1. Resource No: Resource Number for the job\n Content: Content of the sources\n Explanation:\n A concise paragraph explaining to a user why this is chosen. ```

Remember to set the topk value to 3 so that it is consistent with the prompt.

Usecase Test/Debug

You can test the usecase through the frontend or debug using the developer portal under the tab Debug.

Type your query under the message and the framework will refer to the assigned datasource and will execute the SSRAG method to answer your query.

How to use SingtelSRAG usecase?

you can ask questions related to Singtel which has been uploaded as a datasource,

Sample input:

who is Singtel Chairman in 2021?

The response will list out 3 most relevant resources in the format specified in the prompt earlier.

Sample response:

1. Resource No: /api/v1/resources/id/data/SingtelDemov4/singtel-annual-report-2021.pdf#page=108
Content: This source provides information about the Singtel Directors, including the Chairman, Lee Theng Kiat, who served in 2021, and who was replaced by Yuen Kuan Moon as Group Chief Executive Officer effective January 1, 2021. The report also lists other Directors who served during the financial year ended March 31, 2021, including Rajeev Suri, who was appointed on January 1, 2021, and Simon Claude Israel, who stepped down as a Director and Chairman of the Company following the conclusion of the Annual General Meeting on 30 July 2020.
Explanation: This source is relevant to the user query as it provides information about the Chairman of Singtel who served in 2021, Lee Theng Kiat. It also lists the other Directors who served during the same financial year, including Rajeev Suri, who was appointed as Director on January 1, 2021.

Note: The response wording might be different, but the content should remain the same.