1- from typing import Any , Dict , List , Union , cast
1+ from typing import Any , Dict , List , Union , cast , Literal
22from typing_extensions import NotRequired , TypedDict
33from .request import Request , RequestConfig
44from typing import List , Union
55from ._config import ClientConfig
66
77
88class SummaryParams (TypedDict ):
9- text : str
9+ text : NotRequired [ str ]
1010 """
1111 The text to summarize.
1212 """
1313
14- type : NotRequired [str ]
14+ type : NotRequired [Literal [ "text" , "points" ] ]
1515
1616 """
1717 The summary result type. Supported values are: text, points
1818 """
19+ url : NotRequired [str ]
20+ file_store_key : NotRequired [str ]
21+ max_points : NotRequired [int ]
22+ max_characters : NotRequired [int ]
1923
2024
2125class SummaryResponse (TypedDict ):
@@ -29,6 +33,17 @@ class SummaryResponse(TypedDict):
2933 """
3034
3135
36+ class SummaryListResponse (TypedDict ):
37+ success : bool
38+ """
39+ Indicates whether the translation was successful.
40+ """
41+ summary : List [str ]
42+ """
43+ The summarized text.
44+ """
45+
46+
3247class Summary (ClientConfig ):
3348
3449 config : RequestConfig
@@ -46,7 +61,9 @@ def __init__(
4661 disable_request_logging = disable_request_logging ,
4762 )
4863
49- def summarize (self , params : SummaryParams ) -> SummaryResponse :
64+ def summarize (
65+ self , params : SummaryParams
66+ ) -> Union [SummaryResponse , SummaryListResponse ]:
5067 path = "/ai/summary"
5168 resp = Request (
5269 config = self .config ,
0 commit comments