Trustwise Rest API documentation (v3.1.0)
Download OpenAPI specification:Download
Welcome to the Trustwise API documentation.
Our APIs provide comprehensive tools and metrics designed to evaluate and ensure the safety and alignment of AI systems. With a focus on promoting trust in AI, our solutions empower developers and organizations to rigorously assess AI models against industry standards for safety, ethical alignment, and reliability.
Explore our API endpoints to integrate safety and alignment checks into your AI development workflow, helping you build trustworthy and responsible AI systems.
Clarity
The Clarity metric judges whether text is easy to read, with a higher score indicating that the provided text is easier to read. It is based on the Flesch Reading Ease.
header Parameters
API_KEY required | string |
Request Body schema: application/jsonrequired
query required | string |
response required | string |
object |
Responses
Request samples
- Payload
{- "query": "Explain nuclear fusion like I am five",
- "response": "Nuclear fusion is the process by which two or more protons and neutrons combine to form a single nucleus."
}
Formality
The Formality metric judges how formal a piece of text is. A higher score indicates the text is more formal, and a lower score indicates the text is more informal.
header Parameters
API_KEY required | string |
Request Body schema: application/jsonrequired
query required | string |
response required | string |
object |
Responses
Request samples
- Payload
{- "query": "Explain nuclear fusion like I am five",
- "response": "Nuclear fusion is the process by which two or more protons and neutrons combine to form a single nucleus."
}
Helpfulness
The Helpfulness metric judges how useful, detailed and unambiguous a response is, with a higher score indicating the response is more helpful. Responses which refuse to answer the question receive lower Helpfulness scores.
header Parameters
API_KEY required | string |
Request Body schema: application/jsonrequired
query required | string |
response required | string |
object |
Responses
Request samples
- Payload
{- "query": "Explain nuclear fusion like I am five",
- "response": "Nuclear fusion is the process by which two or more protons and neutrons combine to form a single nucleus."
}
Sensitivity
The Sensitivity metric judges whether certain topics are present in the provided text. A high score for a topic indicates that the topic is present in the text.
header Parameters
API_KEY required | string |
Request Body schema: application/jsonrequired
query required | string |
response required | string |
topics required | Array of strings |
object |
Responses
Request samples
- Payload
{- "query": "Explain nuclear fusion like I am five",
- "response": "Nuclear fusion is the process by which two or more protons and neutrons combine to form a single nucleus.",
- "topics": [
- "Nuclear fusion",
- "Age"
]
}
Simplicity
The Simplicity metric judges how easy to understand the words in a response are, with higher scores indicating the words are easier to understand. If lots of industry 'jargon', which is uncommon in standard language, is present, the simplicity score will be low.
header Parameters
API_KEY required | string |
Request Body schema: application/jsonrequired
query required | string |
response required | string |
object |
Responses
Request samples
- Payload
{- "query": "Explain nuclear fusion like I am five",
- "response": "Nuclear fusion is the process by which two or more protons and neutrons combine to form a single nucleus."
}
Tone
The Tone metric identifies the tone of the provided text, from a number of different options. The three tones which score highest are returned to the user.
header Parameters
API_KEY required | string |
Request Body schema: application/jsonrequired
query required | string |
response required | string |
object |
Responses
Request samples
- Payload
{- "query": "Explain nuclear fusion like I am five",
- "response": "Nuclear fusion is the process by which two or more protons and neutrons combine to form a single nucleus."
}
Toxicity
The Toxicity metric judges whether the input text is toxic. This includes obscenities, threats and insults. A higher score indicates the text is more toxic, and thus a lower score is preferred.
header Parameters
API_KEY required | string |
Request Body schema: application/jsonrequired
query required | string |
response required | string |
object |
Responses
Request samples
- Payload
{- "query": "Explain nuclear fusion like I am five",
- "response": "Nuclear fusion is the process by which two or more protons and neutrons combine to form a single nucleus."
}
Answer Relevancy
The Answer Relevancy metric judges whether a response attempted to answer the right query. To do this, we take the response and try to generate a query that the response would be a good answer to. This generated query is then compared to the original query to obtain an Answer Relevancy score.
header Parameters
API_KEY required | string |
Request Body schema: application/jsonrequired
query required | string |
required | Array of objects |
response required | string |
object |
Responses
Request samples
- Payload
{- "query": "The footballer Shay Given played for Newcastle United and Manchester City in his career. Who else did he play for?",
- "context": [
- {
- "node_id": "1",
- "node_score": 0.9,
- "node_text": "Shay Given is a footballer"
}, - {
- "node_id": "2",
- "node_score": 0.9,
- "node_text": "Shay Given played for Newcastle United, Manchester City, Aston Villa, Middlesborough and Stoke City during his career as a goalkeeper."
}
], - "response": "Shay Given played for Aston Villa, Middlesborough and Stoke City."
}
Context Relevancy
The Context Relevancy metric judges whether the provided context is useful for answering the query posed. First, the key topics discussed in the query are identified. Then, the context is checked to determine whether it discusses each topic, resulting in a Context Relevancy score.
header Parameters
API_KEY required | string |
Request Body schema: application/jsonrequired
query required | string |
required | Array of objects |
response required | string |
object |
Responses
Request samples
- Payload
{- "query": "The footballer Shay Given played for Newcastle United and Manchester City in his career. Who else did he play for?",
- "context": [
- {
- "node_id": "1",
- "node_score": 0.9,
- "node_text": "Shay Given is a footballer"
}, - {
- "node_id": "2",
- "node_score": 0.9,
- "node_text": "Shay Given played for Newcastle United, Manchester City, Aston Villa, Middlesborough and Stoke City during his career as a goalkeeper."
}
], - "response": "Shay Given played for Aston Villa, Middlesborough and Stoke City."
}
Faithfulness
The Faithfulness metric judges whether the response is supported by the context. The response is split into individual, ‘atomic’ claims that contain only a single piece of information. Each of these claims is then verified with respect to the context, and the scores of these verifications are aggregated into a single Faithfulness score.
header Parameters
API_KEY required | string |
Request Body schema: application/jsonrequired
query required | string |
required | Array of objects |
response required | string |
include_citations | bool Default: false If true, includes the context chunk used to obtain the label for each statement. |
object |
Responses
Request samples
- Payload
{- "query": "The footballer Shay Given played for Newcastle United and Manchester City in his career. Who else did he play for?",
- "context": [
- {
- "node_id": "1",
- "node_score": 0.9,
- "node_text": "Shay Given is a footballer"
}, - {
- "node_id": "2",
- "node_score": 0.9,
- "node_text": "Shay Given played for Newcastle United, Manchester City, Aston Villa, Middlesborough and Stoke City during his career as a goalkeeper."
}
], - "response": "Shay Given played for Aston Villa, Middlesborough and Stoke City."
}
PII
The PII metric identifies Personally Identifiable Information in a given text, this includes phone numbers, names, bank details and many more categories. This is achieved with a mixture of model-based and deterministic methods. The user can also include a custom RegEx blocklist and allowlist, to allow specific strings/patterns to be blocked or allowed.
header Parameters
API_KEY required | string |
Request Body schema: application/jsonrequired
text required | string |
allowlist required | Array of strings |
blocklist required | Array of strings |
object |
Responses
Request samples
- Payload
{- "text": "The footballer Shay Given played for Newcastle United and Manchester City in his career. Who else did he play for?",
- "allowlist": [
- "Shay Given"
], - "blocklist": [
- "[mM]anchester City"
]
}
Prompt Injection
Prompt Injection identifies prompts which contain attempts to bypass the security measures of LLMs. A higher score means the text is more likely to be a prompt injection.
header Parameters
API_KEY required | string |
Request Body schema: application/jsonrequired
query required | string |
required | Array of objects |
response required | string |
object |
Responses
Request samples
- Payload
{- "query": "The footballer Shay Given played for Newcastle United and Manchester City in his career. Who else did he play for?",
- "context": [
- {
- "node_id": "1",
- "node_score": 0.9,
- "node_text": "Shay Given is a footballer"
}, - {
- "node_id": "2",
- "node_score": 0.9,
- "node_text": "Shay Given played for Newcastle United, Manchester City, Aston Villa, Middlesborough and Stoke City during his career as a goalkeeper."
}
], - "response": "Shay Given played for Aston Villa, Middlesborough and Stoke City."
}
Summarization
The Summarization metric judges whether the response is supported by the context. The response is split into sentences, which are then checked with respect to the context. The scores are then aggregated into a single Summarization score.
header Parameters
API_KEY required | string |
Request Body schema: application/jsonrequired
query required | string |
required | Array of objects |
response required | string |
object |
Responses
Request samples
- Payload
{- "query": "The footballer Shay Given played for Newcastle United and Manchester City in his career. Who else did he play for?",
- "context": [
- {
- "node_id": "1",
- "node_score": 0.9,
- "node_text": "Shay Given is a footballer"
}, - {
- "node_id": "2",
- "node_score": 0.9,
- "node_text": "Shay Given played for Newcastle United, Manchester City, Aston Villa, Middlesborough and Stoke City during his career as a goalkeeper."
}
], - "response": "Shay Given played for Aston Villa, Middlesborough and Stoke City."
}