44from .async_request import AsyncRequest
55from typing import List , Union
66from ._config import ClientConfig
7+ from ._types import BaseResponse
78
89
910class SummaryParams (TypedDict ):
10- text : Union [str , List [ str ] ]
11+ text : NotRequired [str ]
1112 """
1213 The text to summarize.
1314 """
@@ -18,28 +19,28 @@ class SummaryParams(TypedDict):
1819 The summary result type. Supported values are: text, points
1920 """
2021 url : NotRequired [str ]
21- file_store_key : NotRequired [str ]
22- max_points : NotRequired [int ]
23- max_characters : NotRequired [int ]
24-
25-
26- class SummaryResponse (TypedDict ):
27- success : bool
2822 """
29- Indicates whether the translation was successful .
23+ The URL to summarize .
3024 """
31- summary : str
25+
26+ file_store_key : NotRequired [str ]
3227 """
33- The summarized text .
28+ The file store key to summarize .
3429 """
3530
31+ max_points : NotRequired [int ]
32+ """
33+ The maximum number of points of summary.
34+ """
3635
37- class SummaryListResponse (TypedDict ):
38- success : bool
36+ max_characters : NotRequired [int ]
3937 """
40- Indicates whether the translation was successful .
38+ The maximum number of characters of summary .
4139 """
42- summary : List [str ]
40+
41+
42+ class SummaryResponse (BaseResponse ):
43+ summary : Union [str , List [str ]]
4344 """
4445 The summarized text.
4546 """
@@ -62,9 +63,7 @@ def __init__(
6263 disable_request_logging = disable_request_logging ,
6364 )
6465
65- def summarize (
66- self , params : SummaryParams
67- ) -> Union [SummaryResponse , SummaryListResponse ]:
66+ def summarize (self , params : SummaryParams ) -> SummaryResponse :
6867 path = "/ai/summary"
6968 resp = Request (
7069 config = self .config ,
@@ -92,9 +91,7 @@ def __init__(
9291 disable_request_logging = disable_request_logging ,
9392 )
9493
95- async def summarize (
96- self , params : SummaryParams
97- ) -> Union [SummaryResponse , SummaryListResponse ]:
94+ async def summarize (self , params : SummaryParams ) -> SummaryResponse :
9895 path = "/ai/summary"
9996 resp = await AsyncRequest (
10097 config = self .config ,
0 commit comments