Example repo to use GitHub Models with a RAG example on my blog posts as the data source.
To get started with this repositor, open it using a GitHub Codespace. It has all the tools you need to start working with the data and GitHub Models.
After opening the repository in a Codespace, you can run the following command to install the dependencies:
pip install -r requirements.txtTo run the script, you can use the following command:
python script.pyTo run the embedding and inference steps on you local machine, start here. This will show you the basic moving parts. The script will execute the following steps:
Now that we have seen the moving parts, we can start leveling up and run this with Azure resources.
- Use Azure Blob Storage to store the data: See lab 3
- Use Azure Cognitive Services to create embeddings: See lab 4
- Use Azure Machine Learning to run the inference
- Look at the scripts for the documented parameters on the top
- Configure the necesary environment variables (also see
.env-examplethat can be copied to.envand filled in) - Run the download of the dependencies with
pip install -r requirements.txt - Run the scripts one by one with
python <script-name>.py
All along the way, the most interesting durationss for each step is shown to give you an idea of the performance of the script. At the end of the script, the used API requests to GitHub Models are printed, together with the information about the used tokens, as this is all dependent on the rate limit for GitHub Models.