RAG approach - Introduction

1 What is a RAG ? Why using a RAG ?

Rag worklow scheme

Rag worklow scheme

TO COMPLETE

2 What are we about to learn ?

TO COMPLETE

3 Technical requirements for this tutorial

  • Connection to :
    • A Qdrant vectorial database
    • llm.lab: The SSPCloud’s LLM provider (Ollama/OpenWebUI)

3.1 Environment variables and secrets

To connect your SSPCloud VSCode service to Qdrant and llm.lab, you will need the folowing credentials.

QDRANT_URL=https://YOURNAMESPACE-qdrant.user.lab.sspcloud.fr/
QDRANT_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxx
QDRANT_API_PORT=443
LLMLAB_API_KEY=xxxxxxxxxxxxxxxxxxxxxx
LLMLAB_URL=https://llm.lab.sspcloud.fr/api

Make sure to never leak thoses credentials! They will need to be stored as an Onyxia Secret, or alternatively in a .env file. Let’s dive in with the second possibility.

3.2 Where to get thoses creds ?

3.2.1 For llm.lab

Please verify you are connected to the SSPCloud and then use the following link to reach llm.lab UI : https://llm.lab.sspcloud.fr/. Now, go to your account settings (upper right - “Réglages”) / account (“Compte”) / API Keys (“Clés d’API”) => you are now ready to create your api key!

Create an API key on llm.lab

Create an API key on llm.lab

You can now fill your LLMLAB_API_KEY variable.

3.2.2 For Qdrant

TO COMPLETE : Shared qdrant or 1 Qdrant per namespace ?

  • Create a Qdrant service in your personal namespace as follows

Create a Qdrant service

Create a Qdrant service
  • Copy and save properly your Qdrant token

Get you Qdrant token

Get you Qdrant token
  • Launch you Qdrant service

3.3 How to pass them as environment variables

    1. Create an empty .env file (at your repo’s root)
    1. Write your environment variables as above, and save
    1. Use the folowing code to export theses variables to your environment variables
from dotenv import load_dotenv
load_dotenv()
    1. Verify all is good:
import os
try:
    QDRANT_URL = os.environ["QDRANT_URL"]
    print(f"All right with QDRANT_URL secret")
except KeyError:
    raise ValueError("QDRANT_URL environment variable not set")

warn

3.4 Attention

Warning

Do not leak your secrets => Do not commit your .env file!

(use your .gitignore config do deal with it)