This RAG API facilitates the ingestion of data into a vector store and the retrieval of the content from the vector store to be used in a RAG-based flow.
The API also provides an interface for managing RAG configurations, which can be helpful for naming and versioning configurations for different use cases, as well as for tracking purposes during the experimentation journey.
The following configuration parameters need to be defined per the sample.env
file:
-
AZURE_OPENAI_API_VERSION [REQUIRED]: The OpenAI API version.
-
AZURE_OPENAI_API_KEY [REQUIRED]: The OpenAI API key.
-
AZURE_MLLM_DEPLOYMENT_MODEL [REQUIRED]: The OpenAI multi-modal LLM model (i.e. GPT-4v, GPT 4o)
-
AZURE_SEARCH_ENDPOINT [REQUIRED]: The Azure AI Search endpoint.
-
AZURE_SEARCH_API_KEY [REQUIRED]: The Azure AI Search key.
-
AZURE_COSMOS_DB_URI [REQUIRED]: The CosmosDb connection string.
-
AZURE_COSMOS_DB_KEY [REQUIRED]: The CosmosDb key.
-
AZURE_COSMOS_DB_DATABASE [REQUIRED]: The CosmosDb database name.
-
AZURE_COSMOS_DB_CONTAINER [REQUIRED]: The CosmosDb container name.
-
AZURE_COSMOS_DB_ENRICHMENT_CONTAINER [REQUIRED]: The CosmosDB container for the enrichment cache
-
AZURE_COMPUTER_VISION_ENDPOINT [REQUIRED]: The Azure computer vision endpoint.
-
AZURE_COMPUTER_VISION_KEY [REQUIRED]: The Azure computer vision key.
- Python 3.11
- Docker (Optional)
If running outside of the dev-container
, create your virtual environment.
# Under ./src/api/ directory
python -m venv venv
source ./venv/Scripts/activate
Copy the sample.env to .env and define the parameters based on the configure section.
cp ./configs/sample.env ./configs/.env
pip install -r requirements.txt
This can be done via command line:
python -m main
Or via the VS Code debugger using the provided launch task "Python Debugger: API".
Once the app starts, visit localhost:{PORT}/docs
to view the autogenerated Swagger definition for the API. You can make requests using the Swagger UI, or via Postman.