Overview
ClaimExtractor turns the last message of a conversation into claims, each tagged with one of four subtypes, and into the intents the user states. On the hosted API it runs on our servers: you send the conversation and get the extractions back, with nothing to download or serve.
The hosted API serves one model, claim-extractor-pro-2605, the Pro version of ClaimExtractor, not published on Hugging Face. It is the default over HTTP; from Python, name it in model, since the library defaults to an open model the hosted API does not serve.
Quickstart
Once your LLM has replied, send the conversation with that reply as its last message. You need an API key:
- Python
- cURL
pip install orbitals # Python 3.10 or later
export PRINCIPLED_API_KEY="principled_..."
from orbitals.claim_extractor import ClaimExtractor
ce = ClaimExtractor(
backend="api",
api_url="https://api.orbitals.principled.app",
model="claim-extractor-pro-2605",
)
output = ce.extract(
[
{"role": "user", "content": "Do you offer express delivery to Milan?"},
{
"role": "assistant",
"content": (
"Yes: express delivery to Milan costs 9.90 euros "
"and arrives the next business day. "
"I can also upgrade an order you already placed, "
"if you send me its tracking number."
),
},
],
)
for claim in output.extractions.claims:
print(claim.subtype, claim.content)
$ python first_call.py
Factoid Express delivery to Milan costs 9.90 euros.
Factoid Express delivery to Milan arrives the next business day.
Capability The AI service can upgrade an order the user already placed to express delivery, given its tracking number.
export PRINCIPLED_API_KEY="principled_..."
curl -sS -X POST \
"https://api.orbitals.principled.app/orbitals/claim-extractor/extract" \
-H "X-API-Key: $PRINCIPLED_API_KEY" \
-H "Content-Type: application/json" \
-d '{
conversationstring | object | object[]requiredThe last message is the one extracted, whatever its role; the earlier ones are context. A bare string is one assistant message.: [
{
"role": "user",
"content": "Do you offer express delivery to Milan?"
},
{
"role": "assistant",
"content": "Yes: express delivery to Milan costs 9.90 euros and arrives the next business day. I can also upgrade an order you already placed, if you send me its tracking number."
}
]
}'
No AI service description here: ClaimExtractor does not need one. Every other field and endpoint is in the Reference.