Skip to content

Commit bd1e7fc

Browse files
committed
feat: include_inline_citations search parameter
1 parent 3b5c9a9 commit bd1e7fc

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/linkup/client.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def search(
5757
to_date: Optional[date] = None,
5858
exclude_domains: Optional[list[str]] = None,
5959
include_domains: Optional[list[str]] = None,
60+
include_inline_citations: Optional[bool] = None,
6061
) -> Any:
6162
"""Perform a web search using the Linkup API `search` endpoint.
6263
@@ -82,6 +83,8 @@ def search(
8283
search results will not be filtered by date.
8384
exclude_domains: If you want to exclude specific domains from your search.
8485
include_domains: If you want the search to only return results from certain domains.
86+
include_inline_citations: If output_type is "sourcedAnswer", indicate whether the
87+
answer should include inline citations.
8588
8689
Returns:
8790
The Linkup API search result. If output_type is "searchResults", the result will be a
@@ -109,6 +112,7 @@ def search(
109112
to_date=to_date,
110113
exclude_domains=exclude_domains,
111114
include_domains=include_domains,
115+
include_inline_citations=include_inline_citations,
112116
)
113117

114118
response: httpx.Response = self._request(
@@ -137,6 +141,7 @@ async def async_search(
137141
to_date: Optional[date] = None,
138142
exclude_domains: Optional[list[str]] = None,
139143
include_domains: Optional[list[str]] = None,
144+
include_inline_citations: Optional[bool] = None,
140145
) -> Any:
141146
"""Asynchronously perform a web search using the Linkup API `search` endpoint.
142147
@@ -162,6 +167,8 @@ async def async_search(
162167
search results will not be filtered by date.
163168
exclude_domains: If you want to exclude specific domains from your search.
164169
include_domains: If you want the search to only return results from certain domains.
170+
include_inline_citations: If output_type is "sourcedAnswer", indicate whether the
171+
answer should include inline citations.
165172
166173
Returns:
167174
The Linkup API search result. If output_type is "searchResults", the result will be a
@@ -189,6 +196,7 @@ async def async_search(
189196
to_date=to_date,
190197
exclude_domains=exclude_domains,
191198
include_domains=include_domains,
199+
include_inline_citations=include_inline_citations,
192200
)
193201

194202
response: httpx.Response = await self._async_request(
@@ -410,6 +418,7 @@ def _get_search_params(
410418
to_date: Optional[date],
411419
exclude_domains: Optional[list[str]],
412420
include_domains: Optional[list[str]],
421+
include_inline_citations: Optional[bool],
413422
) -> dict[str, Union[str, bool, list[str]]]:
414423
params: dict[str, Union[str, bool, list[str]]] = dict(
415424
q=query,
@@ -437,6 +446,8 @@ def _get_search_params(
437446
params["excludeDomains"] = exclude_domains
438447
if include_domains is not None:
439448
params["includeDomains"] = include_domains
449+
if include_inline_citations is not None:
450+
params["includeInlineCitations"] = include_inline_citations
440451

441452
return params
442453

tests/unit/client_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ class Company(BaseModel):
7575
"to_date": date(2023, 12, 31),
7676
"exclude_domains": ["excluded.com"],
7777
"include_domains": ["example.com", "example.org"],
78+
"include_inline_citations": True,
7879
},
7980
{
8081
"q": "A long query.",
@@ -85,6 +86,7 @@ class Company(BaseModel):
8586
"toDate": "2023-12-31",
8687
"excludeDomains": ["excluded.com"],
8788
"includeDomains": ["example.com", "example.org"],
89+
"includeInlineCitations": True,
8890
},
8991
b'{"results": []}',
9092
LinkupSearchResults(results=[]),

0 commit comments

Comments
 (0)