Skip to content

Add support for assistant.search.context #1667

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions slack_sdk/web/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2014,6 +2014,45 @@
kwargs.update({"refresh_token": refresh_token})
return await self.api_call("tooling.tokens.rotate", params=kwargs)

async def assistant_search_context(
self,
*,
query: str,
action_token: str,
channel_types: Optional[Union[str, Sequence[str]]] = None,
content_types: Optional[Union[str, Sequence[str]]] = None,
context_channel_id: Optional[str] = None,
cursor: Optional[str] = None,
include_bots: Optional[bool] = None,
limit: Optional[int] = None,
**kwargs,
) -> AsyncSlackResponse:
"""Searches messages across your Slack organization—perfect for broad, specific, and real-time data retrieval.
https://api.slack.com/methods/assistant.search.context
"""
kwargs.update(

Check warning on line 2033 in slack_sdk/web/async_client.py

View check run for this annotation

Codecov / codecov/patch

slack_sdk/web/async_client.py#L2033

Added line #L2033 was not covered by tests
{
"query": query,
"action_token": action_token,
"context_channel_id": context_channel_id,
"cursor": cursor,
"include_bots": include_bots,
"limit": limit,
}
)

if isinstance(channel_types, (list, tuple)):
kwargs.update({"channel_types": ",".join(channel_types)})

Check warning on line 2045 in slack_sdk/web/async_client.py

View check run for this annotation

Codecov / codecov/patch

slack_sdk/web/async_client.py#L2044-L2045

Added lines #L2044 - L2045 were not covered by tests
else:
kwargs.update({"channel_types": channel_types})

Check warning on line 2047 in slack_sdk/web/async_client.py

View check run for this annotation

Codecov / codecov/patch

slack_sdk/web/async_client.py#L2047

Added line #L2047 was not covered by tests

if isinstance(content_types, (list, tuple)):
kwargs.update({"content_types": ",".join(content_types)})

Check warning on line 2050 in slack_sdk/web/async_client.py

View check run for this annotation

Codecov / codecov/patch

slack_sdk/web/async_client.py#L2049-L2050

Added lines #L2049 - L2050 were not covered by tests
else:
kwargs.update({"content_types": content_types})

Check warning on line 2052 in slack_sdk/web/async_client.py

View check run for this annotation

Codecov / codecov/patch

slack_sdk/web/async_client.py#L2052

Added line #L2052 was not covered by tests

return await self.api_call("assistant.search.context", params=kwargs)

Check warning on line 2054 in slack_sdk/web/async_client.py

View check run for this annotation

Codecov / codecov/patch

slack_sdk/web/async_client.py#L2054

Added line #L2054 was not covered by tests

async def assistant_threads_setStatus(
self,
*,
Expand Down
39 changes: 39 additions & 0 deletions slack_sdk/web/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2004,6 +2004,45 @@
kwargs.update({"refresh_token": refresh_token})
return self.api_call("tooling.tokens.rotate", params=kwargs)

def assistant_search_context(
self,
*,
query: str,
action_token: str,
channel_types: Optional[Union[str, Sequence[str]]] = None,
content_types: Optional[Union[str, Sequence[str]]] = None,
context_channel_id: Optional[str] = None,
cursor: Optional[str] = None,
include_bots: Optional[bool] = None,
limit: Optional[int] = None,
**kwargs,
) -> SlackResponse:
"""Searches messages across your Slack organization—perfect for broad, specific, and real-time data retrieval.
https://api.slack.com/methods/assistant.search.context
"""
kwargs.update(

Check warning on line 2023 in slack_sdk/web/client.py

View check run for this annotation

Codecov / codecov/patch

slack_sdk/web/client.py#L2023

Added line #L2023 was not covered by tests
{
"query": query,
"action_token": action_token,
"context_channel_id": context_channel_id,
"cursor": cursor,
"include_bots": include_bots,
"limit": limit,
}
)

if isinstance(channel_types, (list, tuple)):
kwargs.update({"channel_types": ",".join(channel_types)})

Check warning on line 2035 in slack_sdk/web/client.py

View check run for this annotation

Codecov / codecov/patch

slack_sdk/web/client.py#L2034-L2035

Added lines #L2034 - L2035 were not covered by tests
else:
kwargs.update({"channel_types": channel_types})

Check warning on line 2037 in slack_sdk/web/client.py

View check run for this annotation

Codecov / codecov/patch

slack_sdk/web/client.py#L2037

Added line #L2037 was not covered by tests

if isinstance(content_types, (list, tuple)):
kwargs.update({"content_types": ",".join(content_types)})

Check warning on line 2040 in slack_sdk/web/client.py

View check run for this annotation

Codecov / codecov/patch

slack_sdk/web/client.py#L2039-L2040

Added lines #L2039 - L2040 were not covered by tests
else:
kwargs.update({"content_types": content_types})

Check warning on line 2042 in slack_sdk/web/client.py

View check run for this annotation

Codecov / codecov/patch

slack_sdk/web/client.py#L2042

Added line #L2042 was not covered by tests

return self.api_call("assistant.search.context", params=kwargs)

Check warning on line 2044 in slack_sdk/web/client.py

View check run for this annotation

Codecov / codecov/patch

slack_sdk/web/client.py#L2044

Added line #L2044 was not covered by tests

def assistant_threads_setStatus(
self,
*,
Expand Down
39 changes: 39 additions & 0 deletions slack_sdk/web/legacy_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2016,6 +2016,45 @@
kwargs.update({"refresh_token": refresh_token})
return self.api_call("tooling.tokens.rotate", params=kwargs)

def assistant_search_context(
self,
*,
query: str,
action_token: str,
channel_types: Optional[Union[str, Sequence[str]]] = None,
content_types: Optional[Union[str, Sequence[str]]] = None,
context_channel_id: Optional[str] = None,
cursor: Optional[str] = None,
include_bots: Optional[bool] = None,
limit: Optional[int] = None,
**kwargs,
) -> Union[Future, SlackResponse]:
"""Searches messages across your Slack organization—perfect for broad, specific, and real-time data retrieval.
https://api.slack.com/methods/assistant.search.context
"""
kwargs.update(

Check warning on line 2035 in slack_sdk/web/legacy_client.py

View check run for this annotation

Codecov / codecov/patch

slack_sdk/web/legacy_client.py#L2035

Added line #L2035 was not covered by tests
{
"query": query,
"action_token": action_token,
"context_channel_id": context_channel_id,
"cursor": cursor,
"include_bots": include_bots,
"limit": limit,
}
)

if isinstance(channel_types, (list, tuple)):
kwargs.update({"channel_types": ",".join(channel_types)})

Check warning on line 2047 in slack_sdk/web/legacy_client.py

View check run for this annotation

Codecov / codecov/patch

slack_sdk/web/legacy_client.py#L2046-L2047

Added lines #L2046 - L2047 were not covered by tests
else:
kwargs.update({"channel_types": channel_types})

Check warning on line 2049 in slack_sdk/web/legacy_client.py

View check run for this annotation

Codecov / codecov/patch

slack_sdk/web/legacy_client.py#L2049

Added line #L2049 was not covered by tests

if isinstance(content_types, (list, tuple)):
kwargs.update({"content_types": ",".join(content_types)})

Check warning on line 2052 in slack_sdk/web/legacy_client.py

View check run for this annotation

Codecov / codecov/patch

slack_sdk/web/legacy_client.py#L2051-L2052

Added lines #L2051 - L2052 were not covered by tests
else:
kwargs.update({"content_types": content_types})

Check warning on line 2054 in slack_sdk/web/legacy_client.py

View check run for this annotation

Codecov / codecov/patch

slack_sdk/web/legacy_client.py#L2054

Added line #L2054 was not covered by tests

return self.api_call("assistant.search.context", params=kwargs)

Check warning on line 2056 in slack_sdk/web/legacy_client.py

View check run for this annotation

Codecov / codecov/patch

slack_sdk/web/legacy_client.py#L2056

Added line #L2056 was not covered by tests

def assistant_threads_setStatus(
self,
*,
Expand Down
Loading