{ "name": "Appointment Confirmation Check", "criteria": [ "Agent must confirm the appointment date", "Agent must verify patient identity", "Agent should maintain professional tone", "Agent must handle any scheduling conflicts appropriately" ]}
A webhook evaluator allows you to implement custom evaluation logic by hosting your own evaluation endpoint. This gives you complete control over the evaluation process and allows for complex, domain-specific evaluation criteria.
You can host your webhook evaluator using services like Val Town, which provides a simple way to deploy and run JavaScript functions as webhooks.Example implementation using Val Town:
Copy
Ask AI
// Example webhook evaluator hosted on Val Town// https://www.val.town/x/autoblocks/Autoblocks_Webhook_Evaluatorimport { Evaluation } from "npm:@autoblocks/client/testing";export default async function httpHandler(request: Request): Promise<Response> { if (request.method !== "POST") { return Response.json({ message: "Invalid method." }, { status: 400, }); } try { const body = await request.json(); // Analyze the messages in the body // Create an evaluation object const response: Evaluation = { // Add your score between 0 and 1 score: 1, // Use threshold to detrmine if the evaluation passed or failed. threshold: { gte: 1, }, metadata: { reason: "Add in your reason here.", }, }; return Response.json(response); } catch (e) { return Response.json({ message: "Could not evaluate." }, { status: 500, }); }}