from truthsys import (
Client, # or AsyncClient if you like
TextInfluence,
TextSource,
Verdict,
)
client = Client.from_url("YOUR_BASE_URL") # or Client.from_httpx
ruling = client.judge(
claim="Sally is a cat.",
sources=[
TextSource.from_text("Sally is my pet."),
TextSource.from_text("My pets are all cats."),
],
){
"detailed_responses": [
{
"atomic": "Sally is a cat",
"prediction": "SUPPORTS",
"prediction_num": 2,
"prediction_vector": [
0.79541015625,
0,
0.2042236328125
],
"span": [
0,
14
],
"top5_sentences": [
[
"Sally is my pet.",
"My pets are all cats."
],
[
"1",
"2"
],
[
[
5.171875
],
[
2.439453125
]
],
[
[
0,
16
],
[
0,
21
]
]
]
}
],
"sentences": [
{
"evidence": {
"ids": [
"1"
],
"scores": [
[
5.171875
]
],
"source_spans": [
[
0,
16
]
]
},
"span": [
0,
14
],
"verdict": 2
}
]
}Detects hallucinations in a claim.
from truthsys import (
Client, # or AsyncClient if you like
TextInfluence,
TextSource,
Verdict,
)
client = Client.from_url("YOUR_BASE_URL") # or Client.from_httpx
ruling = client.judge(
claim="Sally is a cat.",
sources=[
TextSource.from_text("Sally is my pet."),
TextSource.from_text("My pets are all cats."),
],
){
"detailed_responses": [
{
"atomic": "Sally is a cat",
"prediction": "SUPPORTS",
"prediction_num": 2,
"prediction_vector": [
0.79541015625,
0,
0.2042236328125
],
"span": [
0,
14
],
"top5_sentences": [
[
"Sally is my pet.",
"My pets are all cats."
],
[
"1",
"2"
],
[
[
5.171875
],
[
2.439453125
]
],
[
[
0,
16
],
[
0,
21
]
]
]
}
],
"sentences": [
{
"evidence": {
"ids": [
"1"
],
"scores": [
[
5.171875
]
],
"source_spans": [
[
0,
16
]
]
},
"span": [
0,
14
],
"verdict": 2
}
]
}