---
depth: 2
local: true
backlinks: none
---
-
Edit the
RetrievalAugmentedGeneration/examples/simple_rag_api_catalog/chains.pyfile and add the following statements after theimportstatements.-
Replace the
document_searchmethod with the following code::language: python :start-after: start-document-search-method :end-before: end-document-search-method -
Replace the
get_documentsmethod with the following code::language: python :start-after: start-get-documents-method :end-before: end-get-documents-method -
Replace the
delete_documentsmethod with the following code::language: python :start-after: start-delete-documents-method :end-before: end-delete-documents-method
-
Using the containers has one additional step this time: exporting your NVIDIA API key as an environment variable.
-
Build the container for the Chain Server:
$ docker compose --env-file deploy/compose/compose.env -f deploy/compose/simple-rag-api-catalog.yaml build chain-server -
Export your NVIDIA API key in an environment variable:
$ export NVIDIA_API_KEY=nvapi-... -
Run the containers:
$ docker compose --env-file deploy/compose/compose.env -f deploy/compose/simple-rag-api-catalog.yaml up -d
You can access the Chain Server with a URL like http://localhost:8081.
-
Upload the README from the repository:
$ curl http://localhost:8081/documents -F "file=@README.md"Example Output
:language: json -
List the ingested documents:
$ curl -X GET http://localhost:8081/documentsExample Output
:language: json -
Submit a query to search the documents:
$ curl -H "Content-Type: application/json" \ http://localhost:8081/search \ -d '{"query":"Does NVIDIA have sample RAG code?", "top_k":1}'
Example Output
:language: json -
Confirm that the search returns relevant documents:
$ curl -H "Content-Type: application/json" \ http://localhost:8081/search \ -d '{"query":"Is vanilla ice cream better than chocolate ice cream?", "top_k":1}'
Example Output
:language: json -
Confirm the delete method works:
$ curl -X DELETE http://localhost:8081/documents\?filename\=README.mdExample Output
:language: json