File size: 1,885 Bytes
97155c0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import os
os.environ["HF_HUB_OFFLINE"] = "1"
import warnings
warnings.filterwarnings("ignore", message="laya: this checkpoint ships temperatures")
import laya
import time

# Load current model
agent = laya.load(".")

# Content
article = "By 2031, artificial intelligences no longer merely answer: they anticipate, negotiate and sometimes push back. In newsrooms, hospitals and courtrooms, autonomous agents propose decisions, draft summaries and flag their own uncertainty. Some observers speak of a 'second cognitive wave': systems capable of doubting, asking for clarification and refusing a poorly specified task. Others worry about a silent dependency, where humans approve without truly understanding. One thing is certain: the question is no longer whether AIs think, but how we will coexist with them."

# Questions
payload = {
    "tone": {
        "type": "choice",
        "instructions": "What is the dominant tone of `body`?",
        "criteria": {
            "neutral": "factual account, no judgment",
            "alarmist": "emphasis on risks and dangers",
            "enthusiastic": "emphasis on promises and benefits"
        }
    },
    "domain_coverage": {
        "type": "score",
        "instructions": "How many distinct application domains are covered in `body`?",
        "criteria": ["none", "one", "two", "three or more"]
    },
    "mentions_doubt": {
        "type": "noul",
        "instructions": "Does the text mention AIs' ability to doubt or flag their own uncertainty?"
    }
}

# Predict/Evaluate
timer = time.perf_counter()
result = agent.predict({ "body": article }, payload)

# Show result
for name in payload:
    print(payload[name]['instructions'])
    print('->', result["answers"][name][payload[name]['type']], '\n')

# Debug
print(f"Duration: {((time.perf_counter() - timer) * 1000):.2f} ms")