Applies to:
const options = {
method: "POST",
headers: {
Authorization: "Bearer <your-api-key>",
"Content-Type": "application/json",
},
body: JSON.stringify({
project_id: "<project-id>",
name: "<dataset-name>",
metadata: {
__schemas: {
input: {
type: "object",
properties: {
postal: { type: "number" },
},
additionalProperties: false,
enforce: true
},
},
},
}),
};
fetch("https://api.braintrust.dev/v1/dataset", options)
.then((res) => res.json())
.then((res) => console.log(res));
const options = {
method: "PATCH",
headers: {
Authorization: "Bearer <your-api-key>",
"Content-Type": "application/json",
},
body: JSON.stringify({
metadata: {
__schemas: {
input: {
type: "object",
properties: {
postal: { type: "number" },
},
additionalProperties: false,
enforce: true
},
},
},
}),
};
fetch("https://api.braintrust.dev/v1/dataset/<dataset-id>", options)
.then((res) => res.json())
.then((res) => console.log(res));
const options = {
method: "GET",
headers: {
Authorization: "Bearer <your-api-key>",
},
};
fetch("https://api.braintrust.dev/v1/dataset/<dataset-id>", options)
.then((res) => res.json())
.then((res) => console.log(res.metadata.__schemas));
Was this page helpful?