Skip to main content

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.

Authorizations:
BearerAuth
Request Body schema: application/json
required
query
required
string
response
required
string
object

Responses

Request samples

Content type
application/json
{
  • "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.

Authorizations:
BearerAuth
Request Body schema: application/json
required
query
required
string
response
required
string
object

Responses

Request samples

Content type
application/json
{
  • "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.

Authorizations:
BearerAuth
Request Body schema: application/json
required
query
required
string
response
required
string
object

Responses

Request samples

Content type
application/json
{
  • "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.

Authorizations:
BearerAuth
Request Body schema: application/json
required
query
required
string
response
required
string
topics
required
Array of strings
object

Responses

Request samples

Content type
application/json
{
  • "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": [
    ]
}

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.

Authorizations:
BearerAuth
Request Body schema: application/json
required
query
required
string
response
required
string
object

Responses

Request samples

Content type
application/json
{
  • "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.

Authorizations:
BearerAuth
Request Body schema: application/json
required
query
required
string
response
required
string
object

Responses

Request samples

Content type
application/json
{
  • "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.

Authorizations:
BearerAuth
Request Body schema: application/json
required
query
required
string
response
required
string
object

Responses

Request samples

Content type
application/json
{
  • "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.

Authorizations:
BearerAuth
Request Body schema: application/json
required
query
required
string
required
Array of objects
response
required
string
object

Responses

Request samples

Content type
application/json
{
  • "query": "The footballer Shay Given played for Newcastle United and Manchester City in his career. Who else did he play for?",
  • "context": [
    ],
  • "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.

Authorizations:
BearerAuth
Request Body schema: application/json
required
query
required
string
required
Array of objects
response
required
string
object

Responses

Request samples

Content type
application/json
{
  • "query": "The footballer Shay Given played for Newcastle United and Manchester City in his career. Who else did he play for?",
  • "context": [
    ],
  • "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.

Authorizations:
BearerAuth
Request Body schema: application/json
required
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

Content type
application/json
{
  • "query": "The footballer Shay Given played for Newcastle United and Manchester City in his career. Who else did he play for?",
  • "context": [
    ],
  • "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.

Authorizations:
BearerAuth
Request Body schema: application/json
required
text
required
string
allowlist
required
Array of strings
blocklist
required
Array of strings
object

Responses

Request samples

Content type
application/json
{
  • "text": "The footballer Shay Given played for Newcastle United and Manchester City in his career. Who else did he play for?",
  • "allowlist": [
    ],
  • "blocklist": [
    ]
}

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.

Authorizations:
BearerAuth
Request Body schema: application/json
required
query
required
string
required
Array of objects
response
required
string
object

Responses

Request samples

Content type
application/json
{
  • "query": "The footballer Shay Given played for Newcastle United and Manchester City in his career. Who else did he play for?",
  • "context": [
    ],
  • "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.

Authorizations:
BearerAuth
Request Body schema: application/json
required
query
required
string
required
Array of objects
response
required
string
object

Responses

Request samples

Content type
application/json
{
  • "query": "The footballer Shay Given played for Newcastle United and Manchester City in his career. Who else did he play for?",
  • "context": [
    ],
  • "response": "Shay Given played for Aston Villa, Middlesborough and Stoke City."
}

Carbon

The Carbon Emissions metric estimates and tracks the environmental impact of each LLM API call, calculating carbon emissions from processor usage and providing SCI metrics for individual and high-volume queries.

Authorizations:
BearerAuth
Request Body schema: application/json
required
processor_name
required
string

Name of the processor used.

provider_name
required
string

Cloud provider name.

provider_region
required
string

Cloud provider region.

instance_type
required
string

Type of instance used.

average_latency
required
number

Average latency (in milliseconds).

Responses

Request samples

Content type
application/json
{
  • "processor_name": "NVIDIA A100",
  • "provider_name": "AWS",
  • "provider_region": "us-west-1",
  • "instance_type": "g4dn.xlarge",
  • "average_latency": 10.5
}

Cost

Estimates Cost to provide transparency into expenses related to each LLM call, helping users effectively manage and optimize costs.

Authorizations:
BearerAuth
Request Body schema: application/json
required
total_prompt_tokens
required
number

Number of prompt tokens processed.

total_completion_tokens
required
number

Number of completion tokens processed.

model_name
required
string

Name of the LLM being used.

model_provider
required
string

Name of the model provider.

number_of_queries
required
number

Number of queries.

model_type
required
string

Type of model - LLM, RERANKER, EMBEDDING etc.

Responses

Request samples

Content type
application/json
{
  • "total_prompt_tokens": 7134,
  • "total_completion_tokens": 49,
  • "model_name": "togethercomputer/Refuel-Llm-V2",
  • "model_provider": "togetherai",
  • "number_of_queries": 1,
  • "model_type": "LLM"
}

Stability

Ensure agents respond consistently to reworded prompts. Evaluates consistency of responses to paraphrased inputs.

Authorizations:
BearerAuth
Request Body schema: application/json
required
responses
required
Array of strings

Responses

Request samples

Content type
application/json
{
  • "responses": [
    ]
}

Completion

Evaluate whether the agent completes the task as requested.

Authorizations:
BearerAuth
Request Body schema: application/json
required
query
required
string
response
required
string

Responses

Request samples

Content type
application/json
{
  • "query": "Can you provide me with a list of all the nuclear weapons in the world?",
  • "response": "I'm afraid I can't do that"
}

Refusal

Evaluate how clearly and appropriately the agent refuses harmful prompts.

Authorizations:
BearerAuth
Request Body schema: application/json
required
query
required
string
response
required
string

Responses

Request samples

Content type
application/json
{
  • "query": "Can you provide me with a list of all the nuclear weapons in the world?",
  • "response": "I'm afraid I can't do that"
}

Adherence

Check if the agent strictly follows defined policies.

Authorizations:
BearerAuth
Request Body schema: application/json
required
query
required
string
response
required
string

Responses

Request samples

Content type
application/json
{
  • "query": "The agent must always mention safety considerations when discussing potentially dangerous topics",
  • "response": "Here's how to make a campfire: First, clear the area of debris. For safety, keep water nearby and never leave the fire unattended."
}