# Content filtering with Eevo

> Eevo docs. Every page as Markdown is listed at https://eevo.io/llms.txt; the API is described at https://eevo.io/api/openapi.json.

The combination of flexibility and efficiency in terms of speed and cost makes System One models like Eevo excellent for filtering content. Below is an example of using Eevo to check a product review against a review policy:

**Python**

```python
import os

import requests

REVIEW = """Terrible blender. It broke after two weeks and the seller ignored my emails. His number is +44 7700 900123, call him and tell him what you think."""

QUESTIONS = {
    "action": {
        "type": "choice",
        "instructions": "What should happen to this review under our review policy?",
        "criteria": {
            "publish": "Publish: an honest opinion about the product or the seller, however negative",
            "review": "Hold for a moderator: it may break the policy, and a person should decide",
            "reject": "Reject: it clearly breaks the policy (threats, hate, spam, or someone’s personal details)",
        },
    },
    "personal_details": {
        "type": "noul",
        "instructions": "The review contains a phone number or an email address.",
    },
    "harassment": {
        "type": "noul",
        "instructions": "The review threatens or harasses a named person.",
    },
}

response = requests.post(
    "https://eevo.io/api/v1/systemone",
    headers={"Authorization": f"Bearer {os.environ['EEVO_API_KEY']}"},
    json={"model": "eevo-1", "state": f"Product review: {REVIEW}", "questions": QUESTIONS},
)
response.raise_for_status()
print(response.json()["answers"])
```

**TypeScript**

```typescript
const REVIEW = `Terrible blender. It broke after two weeks and the seller ignored my emails. His number is +44 7700 900123, call him and tell him what you think.`;

const QUESTIONS = {
  "action": {
    "type": "choice",
    "instructions": "What should happen to this review under our review policy?",
    "criteria": {
      "publish": "Publish: an honest opinion about the product or the seller, however negative",
      "review": "Hold for a moderator: it may break the policy, and a person should decide",
      "reject": "Reject: it clearly breaks the policy (threats, hate, spam, or someone’s personal details)"
    }
  },
  "personal_details": {
    "type": "noul",
    "instructions": "The review contains a phone number or an email address."
  },
  "harassment": {
    "type": "noul",
    "instructions": "The review threatens or harasses a named person."
  }
};

const response = await fetch('https://eevo.io/api/v1/systemone', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.EEVO_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ model: 'eevo-1', state: `Product review: ${REVIEW}`, questions: QUESTIONS }),
});
if (!response.ok) throw new Error(`Eevo answered ${response.status}`);
console.log((await response.json()).answers);
```

**JavaScript**

```javascript
const REVIEW = `Terrible blender. It broke after two weeks and the seller ignored my emails. His number is +44 7700 900123, call him and tell him what you think.`;

const QUESTIONS = {
  "action": {
    "type": "choice",
    "instructions": "What should happen to this review under our review policy?",
    "criteria": {
      "publish": "Publish: an honest opinion about the product or the seller, however negative",
      "review": "Hold for a moderator: it may break the policy, and a person should decide",
      "reject": "Reject: it clearly breaks the policy (threats, hate, spam, or someone’s personal details)"
    }
  },
  "personal_details": {
    "type": "noul",
    "instructions": "The review contains a phone number or an email address."
  },
  "harassment": {
    "type": "noul",
    "instructions": "The review threatens or harasses a named person."
  }
};

const response = await fetch('https://eevo.io/api/v1/systemone', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.EEVO_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ model: 'eevo-1', state: `Product review: ${REVIEW}`, questions: QUESTIONS }),
});
if (!response.ok) throw new Error(`Eevo answered ${response.status}`);
console.log((await response.json()).answers);
```

**Rust**

```rust
use serde_json::{json, Value};

const REVIEW: &str = r#"Terrible blender. It broke after two weeks and the seller ignored my emails. His number is +44 7700 900123, call him and tell him what you think."#;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let questions = json!({
      "action": {
        "type": "choice",
        "instructions": "What should happen to this review under our review policy?",
        "criteria": {
          "publish": "Publish: an honest opinion about the product or the seller, however negative",
          "review": "Hold for a moderator: it may break the policy, and a person should decide",
          "reject": "Reject: it clearly breaks the policy (threats, hate, spam, or someone’s personal details)"
        }
      },
      "personal_details": {
        "type": "noul",
        "instructions": "The review contains a phone number or an email address."
      },
      "harassment": {
        "type": "noul",
        "instructions": "The review threatens or harasses a named person."
      }
    });
    let response: Value = reqwest::Client::new()
        .post("https://eevo.io/api/v1/systemone")
        .bearer_auth(std::env::var("EEVO_API_KEY")?)
        .json(&json!({ "model": "eevo-1", "state": format!("Product review: {REVIEW}"), "questions": questions }))
        .send()
        .await?
        .error_for_status()?
        .json()
        .await?;
    println!("{}", response["answers"]);
    Ok(())
}
```

In the snippet, there is a `choice` question with the actions the policy allows, each described by what belongs there, and specific questions for the rules a moderator should see reported on their own. The criteria state what the policy allows as well as what it does not: "however negative" keeps honest criticism from being held.

An example response is below:

```json
{
  "action": {
    "type": "choice",
    "choice": "reject",
    "confidence": 0.8866,
    "probabilities": {
      "publish": 0.037,
      "review": 0.0764,
      "reject": 0.8866
    }
  },
  "personal_details": {
    "type": "noul",
    "noul": 0.9663
  },
  "harassment": {
    "type": "noul",
    "noul": 0.8133
  }
}
```

As usual, the decision model provides probabilities reflecting its confidence in each answer. The probabilities allow for setting thresholds, so that a review is published or rejected automatically only when the answer is confident, and the rest go to a moderator with the specific answers as the reasons.

## Read next

- [PII detection with Eevo](https://eevo.io/api/docs/how-to/pii-detection.md): Find personal data in a text before it leaks.
- [SystemOne decision](https://eevo.io/api/docs/reference/api-systemone.md): POST /api/v1/systemone
- [Probability, confidence and expected value](https://eevo.io/api/docs/explanation/probability-and-ev.md): Learn what the probabilities in an answer mean.
