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
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.19.0
0.20.0
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "arkruntime"
version = "0.19.0"
version = "0.20.0"
description = "Ark runtime SDK for Python"
readme = "README.md"
requires-python = ">=3.8"
Expand Down
4 changes: 4 additions & 0 deletions src/arkruntime/resources/chat/completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def create(
tools: Optional[List[ChatCompletionToolParam]] = None,
parallel_tool_calls: Optional[bool] = None,
user: Optional[str] = None,
prompt_cache_key: Optional[str] = None,
service_tier: Optional[RequestServiceTier] = None,
reasoning_effort: Optional[ReasoningEffort] = None,
thinking: Optional[ThinkingParam] = None,
Expand Down Expand Up @@ -114,6 +115,7 @@ def create(
"tools": tools,
"parallel_tool_calls": parallel_tool_calls,
"user": user,
"prompt_cache_key": prompt_cache_key,
"service_tier": service_tier,
"reasoning_effort": reasoning_effort,
"thinking": thinking,
Expand Down Expand Up @@ -167,6 +169,7 @@ async def create(
tools: Optional[List[ChatCompletionToolParam]] = None,
parallel_tool_calls: Optional[bool] = None,
user: Optional[str] = None,
prompt_cache_key: Optional[str] = None,
service_tier: Optional[RequestServiceTier] = None,
reasoning_effort: Optional[ReasoningEffort] = None,
thinking: Optional[ThinkingParam] = None,
Expand Down Expand Up @@ -201,6 +204,7 @@ async def create(
"tools": tools,
"parallel_tool_calls": parallel_tool_calls,
"user": user,
"prompt_cache_key": prompt_cache_key,
"service_tier": service_tier,
"reasoning_effort": reasoning_effort,
"thinking": thinking,
Expand Down
4 changes: 4 additions & 0 deletions src/arkruntime/types/chat/chat_completion_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ class ChatCompletionRequest(BaseModel):
"""
A unique identifier representing your end-user.
"""
prompt_cache_key: Optional[str] = None
"""
A routing hint for prompt cache affinity.
"""
service_tier: Optional[RequestServiceTier] = None
"""
The service tier to use for the request.
Expand Down
3 changes: 3 additions & 0 deletions src/arkruntime/types/chat/chat_completion_request_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ class ChatCompletionRequestParam(TypedDict, total=False):
user: Optional[str]
"""A unique identifier representing your end-user."""

prompt_cache_key: Optional[str]
"""A routing hint for prompt cache affinity."""

service_tier: Optional[RequestServiceTier]
"""The service tier to use for the request."""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@
class ContentBlockStartContentBlockThinking(BaseModel):
type: Literal["thinking"]
thinking: Optional[str] = None
signature: Optional[str] = None
"""
Initial signature placeholder. May be empty; signature deltas provide the final value.
"""
4 changes: 3 additions & 1 deletion src/arkruntime/types/messages/messages_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@
class MessagesMetadata(BaseModel):
user_id: Optional[str] = None
"""
An external identifier for the user associated with the request.
An external identifier for the user associated with the request. When
set to a JSON object string containing a non-empty `session_id` string,
`session_id` is used as a routing hint for prompt cache affinity.
"""
3 changes: 3 additions & 0 deletions src/arkruntime/types/responses/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@
from .url_citation import UrlCitation
from .user_location import UserLocation
from .web_search_action import WebSearchAction
from .web_search_filters import WebSearchFilters
from .web_search_source import WebSearchSource
from .web_search_tool import WebSearchTool

Expand Down Expand Up @@ -458,6 +459,7 @@
"UrlCitation",
"UserLocation",
"WebSearchAction",
"WebSearchFilters",
"WebSearchSource",
"WebSearchTool",
]
Expand Down Expand Up @@ -539,6 +541,7 @@
from .typed_tool_choice_param import TypedToolChoiceParam
from .url_citation_param import UrlCitationParam
from .user_location_param import UserLocationParam
from .web_search_filters_param import WebSearchFiltersParam
from .web_search_tool_param import WebSearchToolParam

# Hand-written extras (preserved across regen via Makefile rsync --exclude=*_shim.py).
Expand Down
2 changes: 1 addition & 1 deletion src/arkruntime/types/responses/item_reasoning.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
class ItemReasoning(BaseModel):
id: Optional[str] = None
type: Literal["reasoning"]
status: ItemStatus
status: Optional[ItemStatus] = None
summary: Optional[List[ReasoningSummaryPart]] = None
content: Optional[List[OutputContentItem]] = None
encrypted_content: Optional[str] = None
2 changes: 1 addition & 1 deletion src/arkruntime/types/responses/item_reasoning_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ItemReasoningParam(TypedDict, total=False):

type: Required[Literal["reasoning"]]

status: Required[ItemStatus]
status: Optional[ItemStatus]

summary: Optional[List[ReasoningSummaryPartParam]]

Expand Down
3 changes: 3 additions & 0 deletions src/arkruntime/types/responses/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,6 @@ class Response(BaseModel):
session: Optional[Session] = None
safety_identifier: Optional[str] = None
prompt_cache_key: Optional[str] = None
"""
A routing hint for prompt cache affinity.
"""
3 changes: 3 additions & 0 deletions src/arkruntime/types/responses/responses_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,7 @@ class ResponsesRequest(BaseModel):
context_management: Optional[ContextManagement] = None
session: Optional[Session] = None
prompt_cache_key: Optional[str] = None
"""
A routing hint for prompt cache affinity.
"""
safety_identifier: Optional[str] = None
1 change: 1 addition & 0 deletions src/arkruntime/types/responses/responses_request_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,6 @@ class ResponsesRequestParam(TypedDict, total=False):
session: Optional[SessionParam]

prompt_cache_key: Optional[str]
"""A routing hint for prompt cache affinity."""

safety_identifier: Optional[str]
31 changes: 31 additions & 0 deletions src/arkruntime/types/responses/web_search_filters.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Generated by datamodel-code-generator from ark-apis typespec/openapi.
# DO NOT EDIT — regenerate with `make gen-py-<api>` in ark-apis.
#
# Copyright (c) 2026 ByteDance Ltd. and/or its affiliates.
# SPDX-License-Identifier: Apache-2.0

from __future__ import annotations

from typing import List, Optional

from arkruntime._models import BaseModel


class WebSearchFilters(BaseModel):
"""
Per-search restrictions applied by the doubao source.
"""

allowed_domains: Optional[List[str]] = None
"""
Full domains the search is restricted to. At most 20.
"""
blocked_domains: Optional[List[str]] = None
"""
Full domains excluded from the search. At most 5.
"""
auth_info_level: Optional[int] = None
"""
0 (default) does not restrict authority; 1 returns only very
authoritative content, which may reduce the number of results.
"""
29 changes: 29 additions & 0 deletions src/arkruntime/types/responses/web_search_filters_param.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Generated by datamodel-code-generator from ark-apis typespec/openapi.
# DO NOT EDIT — regenerate with `make gen-py-<api>` in ark-apis.
#
# Copyright (c) 2026 ByteDance Ltd. and/or its affiliates.
# SPDX-License-Identifier: Apache-2.0

from __future__ import annotations

from typing import List, Optional

from typing_extensions import TypedDict


class WebSearchFiltersParam(TypedDict, total=False):
"""
Per-search restrictions applied by the doubao source.
"""

allowed_domains: Optional[List[str]]
"""Full domains the search is restricted to. At most 20."""

blocked_domains: Optional[List[str]]
"""Full domains excluded from the search. At most 5."""

auth_info_level: Optional[int]
"""
0 (default) does not restrict authority; 1 returns only very
authoritative content, which may reduce the number of results.
"""
1 change: 1 addition & 0 deletions src/arkruntime/types/responses/web_search_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ class WebSearchSource(str, Enum):
douyin = "douyin"
moji = "moji"
search_engine = "search_engine"
doubao = "doubao"
11 changes: 11 additions & 0 deletions src/arkruntime/types/responses/web_search_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from arkruntime._models import BaseModel

from .user_location import UserLocation
from .web_search_filters import WebSearchFilters
from .web_search_source import WebSearchSource


Expand All @@ -20,3 +21,13 @@ class WebSearchTool(BaseModel):
user_location: Optional[UserLocation] = None
sources: Optional[List[WebSearchSource]] = None
max_keyword: Optional[int] = None
filters: Optional[WebSearchFilters] = None
"""
Domain and authority filters. Only supported with the doubao source.
"""
time_range: Optional[str] = None
"""
Publish time range of the results: `OneDay`, `OneWeek`, `OneMonth`,
`OneYear`, or an inclusive date range `YYYY-MM-DD..YYYY-MM-DD`. Empty
means unrestricted. Only supported with the doubao source.
"""
11 changes: 11 additions & 0 deletions src/arkruntime/types/responses/web_search_tool_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from typing_extensions import Required, TypedDict

from .user_location_param import UserLocationParam
from .web_search_filters_param import WebSearchFiltersParam
from .web_search_source import WebSearchSource


Expand All @@ -24,3 +25,13 @@ class WebSearchToolParam(TypedDict, total=False):
sources: Optional[List[WebSearchSource]]

max_keyword: Optional[int]

filters: Optional[WebSearchFiltersParam]
"""Domain and authority filters. Only supported with the doubao source."""

time_range: Optional[str]
"""
Publish time range of the results: `OneDay`, `OneWeek`, `OneMonth`,
`OneYear`, or an inclusive date range `YYYY-MM-DD..YYYY-MM-DD`. Empty
means unrestricted. Only supported with the doubao source.
"""
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading