File tree Expand file tree Collapse file tree 3 files changed +13
-10
lines changed
Expand file tree Collapse file tree 3 files changed +13
-10
lines changed Original file line number Diff line number Diff line change 11[project ]
22name = " kintsugi-python"
3- version = " 0.1.7 "
3+ version = " 0.1.8 "
44
55description = " Python SDK to access Kintsugi Voice API V2."
66authors = [
Original file line number Diff line number Diff line change 11from __future__ import annotations
22from datetime import datetime
3-
3+ from dataclasses import dataclass , field
4+ from typing import Optional
45
56class FeedbackScore :
67 category : str
@@ -9,14 +10,15 @@ class FeedbackScore:
910 phq_9 : str
1011
1112
13+ @dataclass
1214class Prediction :
1315 session_id : str
14- predicted_score : dict = {}
15- feedback_score : FeedbackScore
1616 created_at : datetime
1717 updated_at : datetime
1818 is_calibrated : bool
1919 status : str
20+ feedback_score : Optional [FeedbackScore ] = None
21+ predicted_score : dict = field (default_factory = dict )
2022
2123 def get_score (self , category : str ) -> str | None :
2224 return self .predicted_score .get (category , None )
Original file line number Diff line number Diff line change @@ -21,13 +21,14 @@ def parse(self, data: dict) -> FeedbackScore:
2121
2222class PredictionParser :
2323 def parse (self , data : dict ) -> Prediction :
24- output = Prediction ()
24+ output = Prediction (
25+ session_id = data ['session_id' ],
26+ created_at = data ['created_at' ],
27+ updated_at = data ['updated_at' ],
28+ is_calibrated = data ['is_calibrated' ],
29+ status = data ['status' ],
30+ )
2531
26- output .session_id = data ['session_id' ]
27- output .created_at = data ['created_at' ]
28- output .updated_at = data ['updated_at' ]
29- output .is_calibrated = data ['is_calibrated' ]
30- output .status = data ['status' ]
3132
3233 if output .status != 'processing' :
3334 categories = data ['model_category' ].split (',' )
You can’t perform that action at this time.
0 commit comments