Create multiple Testcases in the specified Testset.
import Scorecard from 'scorecard-ai';
const client = new Scorecard({
apiKey: 'My API Key',
});
const testcase = await client.testcases.create('246', {
items: [
{
jsonData: {
question: 'What is the capital of France?',
idealAnswer: 'Paris',
provenance: 'hand_curated',
},
},
{
jsonData: {
question: 'What is the largest planet in our solar system?',
idealAnswer: 'Jupiter',
provenance: 'synthetic',
},
},
{
jsonData: {
question: 'How many planets are in our solar system?',
idealAnswer: 8,
provenance: 'user_feedback',
},
},
],
});
console.log(testcase.items);{
"items": [
{
"id": "123",
"testsetId": "246",
"jsonData": {
"question": "What is the capital of France?",
"idealAnswer": "Paris",
"provenance": "hand_curated"
},
"inputs": {
"question": "What is the capital of France?"
},
"expected": {
"idealAnswer": "Paris"
}
},
{
"id": "124",
"testsetId": "246",
"jsonData": {
"question": "What is the largest planet in our solar system?",
"idealAnswer": "Jupiter",
"provenance": "synthetic"
},
"inputs": {
"question": "What is the largest planet in our solar system?"
},
"expected": {
"idealAnswer": "Jupiter"
}
},
{
"id": "125",
"testsetId": "246",
"jsonData": {
"question": "How many planets are in our solar system?",
"idealAnswer": 8,
"provenance": "user_feedback"
},
"inputs": {
"question": "How many planets are in our solar system?"
},
"expected": {
"idealAnswer": 8
},
"validationErrors": [
{
"path": "/data/idealAnswer",
"message": "Expected string, received number"
}
]
}
]
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
The ID of the Testset to add the Testcases to.
"246"
Testcases to create (max 100).
1 - 100 elementsShow child attributes
Testcases created successfully
Show child attributes
Was this page helpful?
import Scorecard from 'scorecard-ai';
const client = new Scorecard({
apiKey: 'My API Key',
});
const testcase = await client.testcases.create('246', {
items: [
{
jsonData: {
question: 'What is the capital of France?',
idealAnswer: 'Paris',
provenance: 'hand_curated',
},
},
{
jsonData: {
question: 'What is the largest planet in our solar system?',
idealAnswer: 'Jupiter',
provenance: 'synthetic',
},
},
{
jsonData: {
question: 'How many planets are in our solar system?',
idealAnswer: 8,
provenance: 'user_feedback',
},
},
],
});
console.log(testcase.items);{
"items": [
{
"id": "123",
"testsetId": "246",
"jsonData": {
"question": "What is the capital of France?",
"idealAnswer": "Paris",
"provenance": "hand_curated"
},
"inputs": {
"question": "What is the capital of France?"
},
"expected": {
"idealAnswer": "Paris"
}
},
{
"id": "124",
"testsetId": "246",
"jsonData": {
"question": "What is the largest planet in our solar system?",
"idealAnswer": "Jupiter",
"provenance": "synthetic"
},
"inputs": {
"question": "What is the largest planet in our solar system?"
},
"expected": {
"idealAnswer": "Jupiter"
}
},
{
"id": "125",
"testsetId": "246",
"jsonData": {
"question": "How many planets are in our solar system?",
"idealAnswer": 8,
"provenance": "user_feedback"
},
"inputs": {
"question": "How many planets are in our solar system?"
},
"expected": {
"idealAnswer": 8
},
"validationErrors": [
{
"path": "/data/idealAnswer",
"message": "Expected string, received number"
}
]
}
]
}