Skip to content

Commit c915ce4

Browse files
committed
update summary
1 parent c3e1570 commit c915ce4

File tree

2 files changed

+22
-26
lines changed

2 files changed

+22
-26
lines changed

jigsawstack/summary.py

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
from .async_request import AsyncRequest
55
from typing import List, Union
66
from ._config import ClientConfig
7+
from ._types import BaseResponse
78

89

910
class 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,

jigsawstack/translate.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ class TranslateImageParams(TypedDict):
2323
"""
2424

2525
return_type: NotRequired[Literal["url", "binary", "base64"]]
26+
"""
27+
The return type of the response.
28+
"""
2629

2730

2831
class TranslateParams(TypedDict):
@@ -47,11 +50,7 @@ class TranslateResponse(BaseResponse):
4750
"""
4851

4952

50-
class TranslateImageResponse(TypedDict):
51-
success: bool
52-
"""
53-
Indicates whether the translation was successful.
54-
"""
53+
class TranslateImageResponse(BaseResponse):
5554
image: bytes
5655
"""
5756
The image data that was translated.

0 commit comments

Comments
 (0)