Skip to content

Commit 12873ca

Browse files
BruceWouaigneBruceWouaigne
authored andcommitted
Address PR comments
1 parent 38a24e6 commit 12873ca

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

linkup/client.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def search(
5050
depth: Literal["standard", "deep"],
5151
output_type: Literal["searchResults", "sourcedAnswer", "structured"],
5252
structured_output_schema: Union[Type[BaseModel], str, None] = None,
53-
include_images: Union[bool, None] = None,
53+
include_images: bool = False,
5454
) -> Any:
5555
"""
5656
Search for a query in the Linkup API.
@@ -67,7 +67,7 @@ def search(
6767
output. Supported formats are a pydantic.BaseModel or a string representing a
6868
valid object JSON schema.
6969
include_images: If output_type is "searchResults", specifies if the response can include
70-
images.
70+
images. Default to False.
7171
7272
Returns:
7373
The Linkup API search result. If output_type is "searchResults", the result will be a
@@ -114,7 +114,7 @@ async def async_search(
114114
depth: Literal["standard", "deep"],
115115
output_type: Literal["searchResults", "sourcedAnswer", "structured"],
116116
structured_output_schema: Union[Type[BaseModel], str, None] = None,
117-
include_images: Union[bool, None] = None,
117+
include_images: bool = False,
118118
) -> Any:
119119
"""
120120
Asynchronously search for a query in the Linkup API.
@@ -131,7 +131,7 @@ async def async_search(
131131
output. Supported formats are a pydantic.BaseModel or a string representing a
132132
valid object JSON schema.
133133
include_images: If output_type is "searchResults", specifies if the response can include
134-
images.
134+
images. Default to False
135135
136136
Returns:
137137
The Linkup API search result. If output_type is "searchResults", the result will be a
@@ -247,12 +247,13 @@ def _get_search_params(
247247
depth: Literal["standard", "deep"],
248248
output_type: Literal["searchResults", "sourcedAnswer", "structured"],
249249
structured_output_schema: Union[Type[BaseModel], str, None],
250-
include_images: Union[bool, None] = None,
250+
include_images: bool,
251251
) -> Dict[str, Union[str, bool]]:
252252
params: Dict[str, Union[str, bool]] = dict(
253253
q=query,
254254
depth=depth,
255255
outputType=output_type,
256+
includeImages=include_images,
256257
)
257258

258259
if output_type == "structured" and structured_output_schema is not None:
@@ -266,9 +267,6 @@ def _get_search_params(
266267
f"Unexpected structured_output_schema type: '{type(structured_output_schema)}'"
267268
)
268269

269-
if include_images:
270-
params["includeImages"] = True
271-
272270
return params
273271

274272
def _validate_search_response(

linkup/types.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ class LinkupSearchTextResult(BaseModel):
88
A text result from a Linkup search.
99
1010
Attributes:
11+
type: The type of the search result, in this case 'text'
1112
name: The name of the search result.
1213
url: The URL of the search result.
1314
content: The text of the search result.
@@ -24,6 +25,7 @@ class LinkupSearchImageResult(BaseModel):
2425
An image result from a Linkup search.
2526
2627
Attributes:
28+
type: The type of the search result, in this case 'image'
2729
name: The name of the image result.
2830
url: The URL of the image result.
2931
"""

0 commit comments

Comments
 (0)