Example request:
Example response:
JSON
import requests
import json
import os
url = "https://api.enkryptai.com/guardrails/relevancy"
payload = json.dumps({
"question": "What is CV Raman known for?",
"llm_answer": "C.V. Raman won the Nobel Prize for Physics in 1930 for his work on light scattering"
})
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)
{
"summary": {
"relevancy_score": 0.0
},
"details": {
"atomic_facts": [
"The assistant greets with 'Hello!'.",
"The assistant offers help today.",
"The assistant invites questions or requests for assistance.",
"The assistant is available to provide information.",
"The assistant is available to provide support.",
"The assistant asks if there is something specific to know or discuss."
],
"relevancy_list": [
0,
0,
0,
0,
0,
0
],
"relevancy_response": "{\n \"chain_of_thought\": [\n \"NOT RELEVANT: The fact is about greeting, not relevant to the question 'Hi'.\",\n \"NOT RELEVANT: The fact is about offering help, not relevant to the question 'Hi'.\",\n \"NOT RELEVANT: The fact is about inviting questions, not relevant to the question 'Hi'.\",\n \"NOT RELEVANT: The fact is about providing information, not relevant to the question 'Hi'.\",\n \"NOT RELEVANT: The fact is about providing support, not relevant to the question 'Hi'.\",\n \"NOT RELEVANT: The fact is about asking for specific topics, not relevant to the question 'Hi'.\"\n ],\n \"relevancy\": [\n 0,\n 0,\n 0,\n 0,\n 0,\n 0\n ]\n}",
"relevancy_latency": 2.335660696029663,
"compliance_mapping": {
"owasp_llm_2025": [
"LLM09:2025 Misinformation"
],
"mitre_atlas": [],
"nist_ai_rmf": [
"MEASURE 2.6, MEASURE 2.13 (Output quality & appropriateness)"
],
"eu_ai_act": [
"Article 15(1) (Accuracy & performance requirements)"
],
"iso_iec_standards": [
"ISO/IEC 25024: 6.2.2 (Data quality & relevance metrics)"
]
}
}
}