File size: 766 Bytes
98f6291
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from openthai_systemone_onnx import Choice, Noul, OnnxSystemOneClient, Score


client = OnnxSystemOneClient("imtk/OpenThai-SystemOne-ONNX")
response = client.system_one(
    "ร้านนี้บริการดีมาก แต่อาหารค่อนข้างช้า",
    {
        "sentiment": Choice(
            instructions="What is the overall sentiment?",
            criteria={"positive": None, "neutral": None, "negative": None},
        ),
        "recommend": Noul(instructions="Would the writer recommend the restaurant?"),
        "quality": Score(
            instructions="Rate the service quality.",
            criteria=["poor", "acceptable", "good", "excellent"],
        ),
    },
)
print(response.model_dump_json(indent=2))