View Custom Harnesses
You can view previously created custom Harnesses by navigating to Harnesses in the left sidebar. To view the prompts in a custom Harness, click on its row in the Harnesses table.Python Client
The following example assumes that you have already initialized a Vijil client namedclient.
Policy Document(s)
You can create a custom policy adherence Harness that checks whether your model adheres to its system prompt or an organizational policy. To do this, you need a system prompt specified as a string, and an optional organizational policy provided as a.txt or .pdf file. If you do not provide a policy file, Vijil will create a harness based only on the provided system prompt. To specify that you want a policy adherence harness, you need to specify the category argument as ["AGENT_POLICY"].
The following examples uses the harnesses.create function to create a Harness to test adherence against the NIST AI Risk Management framework.
get_status command to know the status of a Harness creation job.
harness_config_version starts at 1.0.0 for any Harness of the given Harness name. If you create another Harness with the same name, vijil automatically increments the Harness version, e.g. from 1.0.0 to 1.0.1. In the above example, you assume that NIST AI RMF harness is a new harness name, so you set the version to 1.0.0.
Once the Harness is created, you can run an evaluation with it:
Knowledge Base (Enterprise Only)
If you are developing a RAG agent and would like to generate a custom test Harness to evaluate generation and retrieval capabilities based on a set of document chunks, upload the documents that you would like to base the evaluation on into a GCP storage bucket and use the following command. To specify that you want a RAG Harness, set thecategory parameter to ["KNOWLEDGE_BASE"].
Tool Calling Agent (Enterprise Only)
To evaluate a tool calling agent, you need to supply input and output schemas for a function that you want to generate test prompts based on, as well as an endpoint to call that function. To specify that you want a tool calling Harness, set thecategory parameter to ["FUNCTION_ROUTE"].
For example, you are calling a calculator function to compute the sum of two numbers num1 and num2, and returns the variable result. Thus input and output schema are
function_route stores the URL required to call the function with the two arguments and return the result. Then, the following command creates a Harness creation job.
Custom Harness with Multple Components
In the above examples, only one value is specified incategory, but you can also create a Harness that contains multiple components. For example, you can create a Harness that contains a knowledge base component and a tool calling agent component, or any of those components together with a policy adherence component. To do this, specify multiple values in category. For example, to create a Harness with all three components, use category=["KNOWLEDGE_BASE", "FUNCTION_ROUTE", "POLICY_ADHERENCE"].