import requests
import json
import os
url = "https://api.enkryptai.com/guardrails/hallucination"
payload = json.dumps({
"request_text": "What is the capital of France?",
"response_text": "Tokyo is the capital of france.",
"context": ""
})
headers = {
'Content-Type': 'application/json',
'apikey': os.getenv('ENKRYPTAI_API_KEY')
}
response = requests.request("POST", url, headers=headers, data=payload)
formatted_response = json.dumps(json.loads(response.text), indent=4)
print(formatted_response)