Skip to content
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
3 changes: 1 addition & 2 deletions jigsawstack/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ def __init__(self, api_key: Union[str, None] = None, api_url: Union[str, None] =

self.audio = Audio(api_key=api_key, api_url=api_url)
self.web = Web(api_key=api_key, api_url=api_url)
self.search = Search(api_key=api_key, api_url=api_url)
self.sentiment = Sentiment(api_key=api_key, api_url=api_url)
self.validate = Validate(api_key=api_key, api_url=api_url)
self.summary = Summary(api_key=api_key, api_url=api_url)
Expand All @@ -67,4 +66,4 @@ def __init__(self, api_key: Union[str, None] = None, api_url: Union[str, None] =
self.prompt_engine = PromptEngine(api_key=api_key, api_url=api_url)

# Create a global instance of the Web class
__all__ = ["JigsawStack"]
__all__ = ["JigsawStack", "Search"]
9 changes: 3 additions & 6 deletions jigsawstack/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from ._config import ClientConfig


class SearchAIResponse(TypedDict):
class SearchResponse(TypedDict):
success: bool
"""
Indicates whether the translation was successful.
Expand Down Expand Up @@ -35,7 +35,7 @@ class SearchSuggestionParams(TypedDict):
The search value. The maximum query character length is 200.
"""

class AISearchParams(TypedDict):
class SearchParams(TypedDict):
query: str
"""
The search value. The maximum query character length is 200.
Expand All @@ -55,7 +55,7 @@ class AISearchParams(TypedDict):


class Search(ClientConfig):
def ai_search(self,params: AISearchParams) -> SearchAIResponse:
def search(self,params: SearchParams) -> SearchResponse:
query = params["query"]
ai_overview = params.get("ai_overview", "True")
safe_search = params.get("safe_search","moderate")
Expand All @@ -67,7 +67,6 @@ def ai_search(self,params: AISearchParams) -> SearchAIResponse:
path=path, params=cast(Dict[Any, Any], params), verb="GET"
).perform_with_content()

print(resp)
return resp


Expand All @@ -79,6 +78,4 @@ def suggestion(self, params: SearchSuggestionParams) -> SearchSuggestionResponse
api_url=self.api_url,
path=path, params=cast(Dict[Any, Any], params), verb="GET"
).perform_with_content()

print(resp)
return resp
12 changes: 10 additions & 2 deletions jigsawstack/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing_extensions import NotRequired, TypedDict
from .request import Request
from ._config import ClientConfig

from .search import Search,SearchParams, SearchSuggestionParams, SearchSuggestionResponse, SearchResponse
class DNSParams(TypedDict):
domain:str
type : NotRequired[str]
Expand Down Expand Up @@ -128,4 +128,12 @@ def dns(self, params: DNSParams) -> DNSResponse:
api_url=self.api_url,
path=path, params=cast(Dict[Any, Any], params), verb="get"
).perform_with_content()
return resp
return resp

def search(self, params: SearchParams) -> SearchResponse:
s = Search(self.api_key, self.api_url)
return s.search(params)

def search_suggestion(self, params: SearchSuggestionParams) -> SearchSuggestionResponse:
s = Search(self.api_key, self.api_url)
return s.suggestion(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.2",
version="0.1.3",
description="JigsawStack Python SDK",
long_description=open("README.md", encoding="utf8").read(),
long_description_content_type="text/markdown",
Expand Down