Skip to content
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
2 changes: 1 addition & 1 deletion src/zai/api_resource/web_search/web_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def web_search(
)
return self._post(
'/web_search',
body=maybe_transform(body, web_search_create_params.WebSearchCreatParams),
body=maybe_transform(body, web_search_create_params.WebSearchCreateParams),
options=make_request_options(extra_headers=extra_headers, extra_body=extra_body, timeout=timeout),
cast_type=WebSearchResp,
)
4 changes: 2 additions & 2 deletions src/zai/types/web_search/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .web_search_create_params import WebSearchCreatParams
from .web_search_create_params import WebSearchCreatParams, WebSearchCreateParams
from .web_search_resp import SearchIntentResp, SearchResultResp, WebSearchResp

__all__ = ['WebSearchCreatParams', 'WebSearchResp', 'SearchIntentResp', 'SearchResultResp']
__all__ = ['WebSearchCreateParams', 'WebSearchCreatParams', 'WebSearchResp', 'SearchIntentResp', 'SearchResultResp']
56 changes: 37 additions & 19 deletions src/zai/types/web_search/web_search_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,40 @@
from zai.types.sensitive_word_check import SensitiveWordCheckRequest


class WebSearchCreatParams(TypedDict):
"""
Web search creation parameters

Attributes:
search_engine (str): Search engine
search_query (str): Search query text
request_id (str): Passed by the user, must be unique; used to distinguish the unique identifier
of each request, the platform will generate it by default when the user does not
pass it.
user_id (str): User side.
sensitive_word_check (Optional[SensitiveWordCheckRequest]): Sensitive word check configuration
"""

search_engine: str
search_query: str
request_id: str
user_id: str
sensitive_word_check: Optional[SensitiveWordCheckRequest]
class WebSearchCreateParams(TypedDict, total=False):
"""
Web search creation parameters

Attributes:
search_engine (str): Search engine
search_query (str): Search query text
request_id (str): Passed by the user, must be unique; used to distinguish the unique identifier
of each request, the platform will generate it by default when the user does not
pass it.
user_id (str): User side.
sensitive_word_check (Optional[SensitiveWordCheckRequest]): Sensitive word check configuration
count (Optional[int]): Number of returned results, range 1-50, default 10
search_domain_filter (Optional[str]): Only access content from specified domain
search_recency_filter (Optional[str]): Search content within specified time range
(e.g. "noLimit", "oneDay", "oneWeek", "oneMonth", "oneYear")
content_size (Optional[str]): Control the word count of web page summaries
(e.g. "low", "medium", "high")
search_intent (Optional[bool]): Whether to return search intent analysis
include_image (Optional[bool]): Whether to include images in search results
"""

search_engine: str
search_query: str
request_id: str
user_id: str
sensitive_word_check: Optional[SensitiveWordCheckRequest]
count: Optional[int]
search_domain_filter: Optional[str]
search_recency_filter: Optional[str]
content_size: Optional[str]
search_intent: Optional[bool]
include_image: Optional[bool]


# Backward-compatible alias (misspelled original name)
WebSearchCreatParams = WebSearchCreateParams
97 changes: 49 additions & 48 deletions src/zai/types/web_search/web_search_resp.py
Original file line number Diff line number Diff line change
@@ -1,61 +1,62 @@
from typing import Optional,List
from typing import List, Optional

from zai.core import BaseModel


class SearchIntentResp(BaseModel):
"""
Search intent response
"""
Search intent response

Attributes:
query (str): Search optimized query
intent (str): Determined intent type
keywords (str): Search keywords
"""
Attributes:
query (str): Search optimized query
intent (str): Determined intent type
keywords (str): Search keywords
"""

query: str
intent: str
keywords: str
query: str
intent: str
keywords: str


class SearchResultResp(BaseModel):
"""
Search result response

Attributes:
title (str): Title
link (str): Link
content (str): Content
icon (str): Icon
media (str): Source media
refer (str): Reference number [ref_1]
publish_date (str): Publish date
"""

title: str
link: str
content: str
icon: str
media: str
refer: str
publish_date: str
images: List[str]
"""
Search result response

Attributes:
title (str): Title
link (str): Link
content (str): Content
icon (Optional[str]): Icon
media (Optional[str]): Source media
refer (Optional[str]): Reference number [ref_1]
publish_date (Optional[str]): Publish date
images (Optional[List[str]]): Image URLs associated with the result
"""

title: str
link: str
content: str
icon: Optional[str] = None
media: Optional[str] = None
refer: Optional[str] = None
publish_date: Optional[str] = None
images: Optional[List[str]] = None


class WebSearchResp(BaseModel):
"""
Web search response

Attributes:
created (Optional[int]): Creation timestamp
request_id (Optional[str]): Request identifier
id (Optional[str]): Response identifier
search_intent (Optional[SearchIntentResp]): Search intent response
search_result (Optional[SearchResultResp]): Search result response
"""

created: Optional[int] = None
request_id: Optional[str] = None
id: Optional[str] = None
search_intent: Optional[SearchIntentResp]
search_result: Optional[SearchResultResp]
"""
Web search response

Attributes:
created (Optional[int]): Creation timestamp
request_id (Optional[str]): Request identifier
id (Optional[str]): Response identifier
search_intent (Optional[SearchIntentResp]): Search intent response
search_result (Optional[List[SearchResultResp]]): List of search result responses
"""

created: Optional[int] = None
request_id: Optional[str] = None
id: Optional[str] = None
search_intent: Optional[SearchIntentResp] = None
search_result: Optional[List[SearchResultResp]] = None
Loading