Skip to content

Fix/search suggestions #40

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

Merged
merged 3 commits into from
Mar 20, 2025
Merged
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
12 changes: 6 additions & 6 deletions jigsawstack/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class SearchResponse(TypedDict):
spell_fixed: str


class SearchSuggestionResponse(TypedDict):
class SearchSuggestionsResponse(TypedDict):
success: bool
"""
Indicates whether the translation was successful.
Expand All @@ -29,7 +29,7 @@ class SearchSuggestionResponse(TypedDict):
suggestions: List[str]


class SearchSuggestionParams(TypedDict):
class SearchSuggestionsParams(TypedDict):
query: str
"""
The search value. The maximum query character length is 200.
Expand Down Expand Up @@ -97,7 +97,7 @@ def search(self, params: SearchParams) -> SearchResponse:

return resp

def suggestion(self, params: SearchSuggestionParams) -> SearchSuggestionResponse:
def suggestions(self, params: SearchSuggestionsParams) -> SearchSuggestionsResponse:
query = params["query"]
path = f"/web/search/suggest?query={query}"
resp = Request(
Expand Down Expand Up @@ -147,9 +147,9 @@ async def search(self, params: SearchParams) -> SearchResponse:
).perform_with_content()
return resp

async def suggestion(
self, params: SearchSuggestionParams
) -> SearchSuggestionResponse:
async def suggestions(
self, params: SearchSuggestionsParams
) -> SearchSuggestionsResponse:
query = params["query"]
path = f"/web/search/suggest?query={query}"
resp = await AsyncRequest(
Expand Down
20 changes: 10 additions & 10 deletions jigsawstack/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from .search import (
Search,
SearchParams,
SearchSuggestionParams,
SearchSuggestionResponse,
SearchSuggestionsParams,
SearchSuggestionsResponse,
SearchResponse,
AsyncSearch,
)
Expand Down Expand Up @@ -198,15 +198,15 @@ def search(self, params: SearchParams) -> SearchResponse:
)
return s.search(params)

def search_suggestion(
self, params: SearchSuggestionParams
) -> SearchSuggestionResponse:
def search_suggestions(
self, params: SearchSuggestionsParams
) -> SearchSuggestionsResponse:
s = Search(
self.api_key,
self.api_url,
disable_request_logging=self.config.get("disable_request_logging"),
)
return s.suggestion(params)
return s.suggestions(params)


class AsyncWeb(ClientConfig):
Expand Down Expand Up @@ -276,12 +276,12 @@ async def search(self, params: SearchParams) -> SearchResponse:
)
return await s.search(params)

async def search_suggestion(
self, params: SearchSuggestionParams
) -> SearchSuggestionResponse:
async def search_suggestions(
self, params: SearchSuggestionsParams
) -> SearchSuggestionsResponse:
s = AsyncSearch(
self.api_key,
self.api_url,
disable_request_logging=self.config.get("disable_request_logging"),
)
return await s.suggestion(params)
return await s.suggestions(params)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name="jigsawstack",
version="0.1.30",
version="0.1.31",
description="JigsawStack - The AI SDK for Python",
long_description=open("README.md", encoding="utf8").read(),
long_description_content_type="text/markdown",
Expand Down