RATIO MACHINA STARTER logo

MERCURY

PersonaEvals REST API

The PersonaEvals REST API manages individual persona evaluation configurations. Define evaluation criteria, message validation, and assessment parameters for comprehensive persona performance testing.

Base URL & Authentication

Base URL: https://your-api-name.mercury.ratiomachina.com
Authentication: x-mercury-api-key: YOUR_API_KEY (Note: Not validated for persona-eval endpoints)

List Persona Evaluations

GET /persona-evals

Query Parameters

  • personaExternalId - Filter by persona external ID (optional)

Response Example

{
  "personaEvals": [
    {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "name": "Customer Service Tone Check",
      "personaExternalId": "agent456",
      "contactData": {"name": "Test Customer", "email": "test@example.com"},
      "conversationData": {"channel": "SMS", "context": "support"},
      "messageHistory": [
        {"sender": "contact", "message": "I need help", "timestamp": "2024-01-15T10:35:00Z"}
      ],
      "criteria": {
        "message": {
          "operator": "contains",
          "value": "thank you"
        }
      },
      "createdAt": "2024-01-15T10:30:00Z",
      "updatedAt": "2024-01-15T10:30:00Z"
    }
  ]
}

Create Persona Evaluation

POST /persona-evals

Request Body

{
  "name": "Customer Service Tone Check",
  "personaExternalId": "agent456",
  "criteria": {
    "message": {
      "operator": "contains",
      "value": "thank you"
    }
  },
  "contactData": {
    "name": "Test Customer",
    "email": "test@example.com"
  },
  "conversationData": {
    "channel": "SMS",
    "context": "support"
  },
  "messageHistory": [
    {
      "sender": "contact",
      "message": "I need help with my order",
      "timestamp": "2024-01-15T10:35:00Z"
    }
  ]
}

Response Example

{
  "personaEval": {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "name": "Customer Service Tone Check",
    "personaExternalId": "agent456",
    "contactData": "{\"name\":\"Test Customer\"}",
    "conversationData": "{\"channel\":\"SMS\"}",
    "messageHistory": "[{\"sender\":\"contact\",\"message\":\"I need help\"}]",
    "criteria": "{\"message\":{\"operator\":\"contains\",\"value\":\"thank you\"}}",
    "createdAt": "2024-01-15T10:30:00Z",
    "updatedAt": "2024-01-15T10:30:00Z"
  }
}

Get Persona Evaluation by ID

GET /persona-evals/{id}

Path Parameters

  • id - Persona evaluation UUID

Response Example

{
  "personaEval": {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "name": "Customer Service Tone Check",
    "personaExternalId": "agent456",
    "contactData": "{\"name\":\"Test Customer\"}",
    "conversationData": "{\"channel\":\"SMS\"}",
    "messageHistory": "[{\"sender\":\"contact\",\"message\":\"I need help\"}]",
    "criteria": "{\"message\":{\"operator\":\"contains\",\"value\":\"thank you\"}}",
    "createdAt": "2024-01-15T10:30:00Z",
    "updatedAt": "2024-01-15T10:30:00Z"
  }
}

Update Persona Evaluation

PUT /persona-evals/{id}

Request Body

{
  "name": "Updated Tone Check",
  "criteria": {
    "message": {
      "operator": "contains",
      "value": "please"
    }
  }
}

Response Example

{
  "personaEval": {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "name": "Updated Tone Check",
    "personaExternalId": "agent456",
    "contactData": "{\"name\":\"Test Customer\"}",
    "conversationData": "{\"channel\":\"SMS\"}",
    "messageHistory": "[{\"sender\":\"contact\",\"message\":\"I need help\"}]",
    "criteria": "{\"message\":{\"operator\":\"contains\",\"value\":\"please\"}}",
    "createdAt": "2024-01-15T10:30:00Z",
    "updatedAt": "2024-01-15T11:45:00Z"
  }
}

Delete Persona Evaluation

DELETE /persona-evals/{id}

⚠️ Warning: This will permanently delete the persona evaluation.

Path Parameters

  • id - Persona evaluation UUID

Response Example

{
  "message": "Persona evaluation deleted successfully",
  "deletedPersonaEval": {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "name": "Customer Service Tone Check",
    "personaExternalId": "agent456"
  }
}

Batch Delete Persona Evaluations

DELETE /persona-evals

⚠️ Warning: This will permanently delete multiple persona evaluations.

Request Body

{
  "ids": [
    "123e4567-e89b-12d3-a456-426614174000",
    "456e7890-e89b-12d3-a456-426614174001"
  ]
}

Response Example

{
  "message": "Persona evaluations deleted successfully",
  "deletedCount": 2,
  "deletedPersonaEvals": [
    {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "name": "Customer Service Tone Check"
    }
  ]
}

PersonaEvals API Best Practices

Evaluation Design

  • Use specific criteria with appropriate operators
  • Test evaluations with realistic message histories
  • Include relevant contact and conversation context
  • Validate operator usage: equals, contains, length_gt, etc.

Data Management

  • Data fields are stored as JSON strings
  • Filter evaluations by persona external ID when needed
  • Use batch operations for multiple evaluations
  • Consider archiving instead of deleting
Transcend the hype with MERCURY by Ratio Machina