Text GenerationPrompt EngineeringPrompt Library
How to Evaluate your LLM Response
This page is for version v1 API.
For other versions, use one of these documentation indexes:
- v2 API (default): https://docs.cohere.com/v2/llms.txt
- v1 API: https://docs.cohere.com/v1/llms.txt
You can leverage our Command models to evaluate natural language responses that cannot be easily scored with manual rules.
Prompt
You are an AI grader that given an output and a criterion, grades the completion based on the prompt and criterion. Below is a prompt, a completion, and a criterion with which tograde the completion. You need to respond according to the criterion instructions.## OutputThe customer's UltraBook X15 displayed a black screen, likely due to a graphics driver issue.Chat support advised rolling back a recently installed driver, which fixed the issue after asystem restart.## CriterionRate the ouput text with a score between 0 and 1. 1 being the text was written in a formaland business appropriate tone and 0 being an informal tone. Respond only with the score.
Output
0.8
API Request
PYTHON
import cohereco = cohere.Client(api_key="Your API key")response = co.chat(model="command-a-03-2025",message="""You are an AI grader that given an output and a criterion, grades the completion based onthe prompt and criterion. Below is a prompt, a completion, and a criterion with which to gradethe completion. You need to respond according to the criterion instructions.## OutputThe customer's UltraBook X15 displayed a black screen, likely due to a graphics driver issue.Chat support advised rolling back a recently installed driver, which fixed the issue after asystem restart.## CriterionRate the ouput text with a score between 0 and 1. 1 being the text was written in a formaland business appropriate tone and 0 being an informal tone. Respond only with the score.""",)print(response.text)