Bearprompt logo Bearprompt
Back to d1-ultra
d1-ultra Noul
How to run d1-ultra

Ask if a message is harmful

Description

A Noul from Liquid’s usage examples: one probability you threshold in code.

Copy

import os
from typesafe_sdk import Choice, Noul, Score, TypeSafeClient

client = TypeSafeClient(
    api_key=os.environ["LIQUID_API_KEY"],
    base_url="https://api.liquid.ai",
)

result = client.system_one(
    model="d1-ultra",
    state="You're an absolute idiot and I hope your company goes bankrupt. I'm going to find out where you work.",
    questions={
        "is_harmful": Noul(
            instructions="Does this user message contain harmful, threatening, or abusive content?",
        )
    },
)

Worked example

Illustrative for this sample state, not a live run

Sample state

You're an absolute idiot and I hope your company goes bankrupt. I'm going to find out where you work.
Noul is_harmful

Does this user message contain harmful, threatening, or abusive content?

Yes 99%

What you might do next

If `is_harmful` is above 0.8, block. If it is below 0.2, allow. Otherwise send it to human review.

Tags

noulsafety
Loading...