RAG4P - Retrieval Augmented Generation for Python
Welcome to the repository for our project RAG4P.org. This project is a Python implementation of the Retrieval Augmented Generation framework. It is a framework that is simple to use and understand. But powerful enough to extend for your own projects.
Setting up your environment
Python
We encourage you to use a python environment manager. Poetry makes it easy to use multiple python versions and packages. where you can switch versions per project. Read this Poetry documentation page to learn how to set up your environment. No poetry installed? Read this page to install it for your environment. Poetry installation
Setting the right version of python for the project
poetry env use 3.10
Install dependencies
poetry install
Run the project
poetry run python rag4p/app_step1_chunking_strategy.py
No poetry
Setup your venv
python3 -m venv venv
source venv/bin/activate
Install dependencies
pip install -r poetry-requirements.txt
Loading API keys
We try to limit accessing Large Language Models and vector stores to a minimum. You do not need an LLM or vector store to learn about all the elements of the Retrieval Augmented Generation framework, except for the generation part. In the workshop we use the LLM of Open AI, which is not publicly available. We will provide you with a key to access it, if you don't have your own key.
Please use this key for the workshop only, and limit the amount of interaction, or we get blocked for exceeding our limits. The API key is obtained through a remote file, which is encrypted. Of course you can also use your own key if you have it.
Environment variables
The easiest way to load the API key is to set an environment variable for each required key. In Python we prefer the file .env.properties in the root of the project with the following properties:
OPENAI_API_KEY=sk-...
WEAVIATE_API_KEY=...
WEAVIATE_URL=...
If you do not have your own key, you can load ours. The key is stored in a remote location. You need the .env.properties file in the root of the project with the following line:
SECRET_KEY=...
This secret key is used to decrypt the remote file containing the API keys. We will provide the value for this key during the workshop.
Using Ollama
There is a simple way to run a Language Model on your local machine. Depending on your machine and the chosen model, it runs fast. I am not going in to much details on how to install it, but you can find the installation instructions on the Ollama Downloads page.
At the moment we prefer the model Phi 3. You can learn more about the model on the Ollama Models page. A lot of other models are available as well. You can try them out yourself. Make sure you pull the model first before you can use it. You can also use Ollama for the embeddings. We advice to pull the model nomic-embed-text for this purpose.
ollama pull phi3
ollama pull nomic-embed-text
Metadata
Release files for rag4p 0.13.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rag4p-0.13.3.tar.gz | 34.7 kB | Without provenance | Details for rag4p-0.13.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rag4p-0.13.3-py3-none-any.whl | Python 3 | none | any | Details for rag4p-0.13.3-py3-none-any.whl |
Total release size: 110.9 kB
Release files / rag4p-0.13.3.tar.gz
| Download URL | rag4p-0.13.3.tar.gz |
|---|---|
| Size | 34.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8bc97b7bdbbcdccc2cb2bddfe2471d0030444780d12f53d7982ec12d03f28b34
|
|
BLAKE2b-256 checksum How to use checksums |
a14399e64cf4b03f66e7f8b162f17594261046b72901a21aef2f7b0810fae8ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.1 CPython/3.12.7 Darwin/24.3.0
|
Release files / rag4p-0.13.3-py3-none-any.whl
| Download URL | rag4p-0.13.3-py3-none-any.whl |
|---|---|
| Size | 76.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5f853ad7e09db8d1cb3089839b51e42e446d864cb9e1c08999c686706dadb8a1
|
|
BLAKE2b-256 checksum How to use checksums |
492b6a5a1370c1a82509dd29d8e1e39873690c44cfeb81c0de15bae32b10217d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.1 CPython/3.12.7 Darwin/24.3.0
|
Security for rag4p 0.13.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.