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: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ from arkruntime import AsyncArk

client = AsyncArk.volc()


async def main():
response = await client.responses.create(
model=os.environ.get("ARK_MODEL", "doubao-seed-2-1-pro-260628"),
Expand All @@ -138,6 +139,7 @@ async def main():
if content.type == "output_text":
print(content.text)


asyncio.run(main())
```

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.7.0
0.8.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.7.0"
version = "0.8.0"
description = "Ark runtime SDK for Python"
readme = "README.md"
requires-python = ">=3.8"
Expand Down
13 changes: 11 additions & 2 deletions src/arkruntime/resources/files/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from ...pagination import AsyncCursorPage, SyncCursorPage

# AUTOGEN-START create-imports
from ...types.file.description_param import DescriptionParam
from ...types.file.file_create_request_param import FileCreateRequestParam
from ...types.file.file_deleted import FileDeleted
from ...types.file.file_object import FileObject
Expand Down Expand Up @@ -61,6 +62,8 @@ def create(
file: Optional[FileTypes] = None,
# AUTOGEN-START create-kwargs
purpose: Purpose,
model: Optional[str] = None,
description: Optional[DescriptionParam] = None,
preprocess_configs: Optional[PreprocessConfigsParam] = None,
expire_at: Optional[int] = None,
url: Optional[str] = None,
Expand Down Expand Up @@ -91,6 +94,8 @@ def create(
{
# AUTOGEN-START create-body
"purpose": purpose,
"model": model,
"description": description,
"preprocess_configs": preprocess_configs,
"expire_at": expire_at,
"url": url,
Expand Down Expand Up @@ -141,7 +146,7 @@ def list(
self,
*,
# AUTOGEN-START list-kwargs
purpose: Optional[Literal["user_data", "agent"]] = None,
purpose: Optional[Literal["user_data", "agent", "voice"]] = None,
after: Optional[str] = None,
limit: Optional[int] = None,
order: Optional[Literal["asc", "desc"]] = None,
Expand Down Expand Up @@ -232,6 +237,8 @@ async def create(
file: Optional[FileTypes] = None,
# AUTOGEN-START create-kwargs
purpose: Purpose,
model: Optional[str] = None,
description: Optional[DescriptionParam] = None,
preprocess_configs: Optional[PreprocessConfigsParam] = None,
expire_at: Optional[int] = None,
url: Optional[str] = None,
Expand All @@ -249,6 +256,8 @@ async def create(
{
# AUTOGEN-START create-body
"purpose": purpose,
"model": model,
"description": description,
"preprocess_configs": preprocess_configs,
"expire_at": expire_at,
"url": url,
Expand Down Expand Up @@ -299,7 +308,7 @@ def list(
self,
*,
# AUTOGEN-START list-kwargs
purpose: Optional[Literal["user_data", "agent"]] = None,
purpose: Optional[Literal["user_data", "agent", "voice"]] = None,
after: Optional[str] = None,
limit: Optional[int] = None,
order: Optional[Literal["asc", "desc"]] = None,
Expand Down
2 changes: 1 addition & 1 deletion src/arkruntime/types/agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Agent(BaseModel):

id: str
"""
Agent ID,格式 `agent_<opaque>`。对外暴露给 session 引用。
Agent ID,形如 `agent-...`。对外暴露给 session 引用。
"""
type: Literal["agent"]
"""
Expand Down
2 changes: 1 addition & 1 deletion src/arkruntime/types/agent/agent_skill_ref.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class AgentSkillRef(BaseModel):
"""
skill_id: Optional[str] = None
"""
Skill ID,形如 `skill_01XJ5...`。
Skill ID,形如 `skill-...`。
"""
version: Optional[str] = None
"""
Expand Down
2 changes: 1 addition & 1 deletion src/arkruntime/types/agent/model_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ModelConfig(BaseModel):

id: str
"""
模型 ID,例如 `claude-opus-4-7` / `claude-sonnet-4-6` / `claude-haiku-4-5`。
模型 ID,例如 `doubao-seed-2-1`。
"""
speed: Optional[ModelSpeed] = None
"""
Expand Down
2 changes: 1 addition & 1 deletion src/arkruntime/types/agent/skill_ref_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ class SkillRefType(str, Enum):
Skill 引用类型。
"""

anthropic = "anthropic"
custom = "custom"
skill_hub = "skill_hub"
ark = "ark"
25 changes: 21 additions & 4 deletions src/arkruntime/types/chat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,16 @@
from .chat_completion_request_assistant_message import (
ChatCompletionRequestAssistantMessage,
)
from .chat_completion_request_developer_message import (
ChatCompletionRequestDeveloperMessage,
)
from .chat_completion_request_message import ChatCompletionRequestMessage
from .chat_completion_request_message_tool_call import (
ChatCompletionRequestMessageToolCall,
)
from .chat_completion_request_message_tool_call_function import (
ChatCompletionRequestMessageToolCallFunction,
)
from .chat_completion_request_system_message import ChatCompletionRequestSystemMessage
from .chat_completion_request_tool_message import ChatCompletionRequestToolMessage
from .chat_completion_request_user_message import ChatCompletionRequestUserMessage
Expand Down Expand Up @@ -104,7 +113,10 @@
"ChatCompletionNamedToolChoice",
"ChatCompletionRequest",
"ChatCompletionRequestAssistantMessage",
"ChatCompletionRequestDeveloperMessage",
"ChatCompletionRequestMessage",
"ChatCompletionRequestMessageToolCall",
"ChatCompletionRequestMessageToolCallFunction",
"ChatCompletionRequestSystemMessage",
"ChatCompletionRequestToolMessage",
"ChatCompletionRequestUserMessage",
Expand Down Expand Up @@ -172,15 +184,20 @@
ChatCompletionContentPartVideoVideoUrlParam,
)
from .chat_completion_message_content_param import ChatCompletionMessageContentParam
from .chat_completion_message_tool_call_function_param import (
ChatCompletionMessageToolCallFunctionParam,
)
from .chat_completion_message_tool_call_param import ChatCompletionMessageToolCallParam
from .chat_completion_named_tool_choice_param import ChatCompletionNamedToolChoiceParam
from .chat_completion_request_assistant_message_param import (
ChatCompletionRequestAssistantMessageParam,
)
from .chat_completion_request_developer_message_param import (
ChatCompletionRequestDeveloperMessageParam,
)
from .chat_completion_request_message_param import ChatCompletionRequestMessageParam
from .chat_completion_request_message_tool_call_function_param import (
ChatCompletionRequestMessageToolCallFunctionParam,
)
from .chat_completion_request_message_tool_call_param import (
ChatCompletionRequestMessageToolCallParam,
)
from .chat_completion_request_param import ChatCompletionRequestParam
from .chat_completion_request_system_message_param import (
ChatCompletionRequestSystemMessageParam,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from __future__ import annotations

from typing import Literal
from typing import Literal, Union

from arkruntime._models import BaseModel

Expand All @@ -20,4 +20,7 @@ class ChatCompletionContentPartImage(BaseModel):
"""
The type of the content part. Always `image_url`.
"""
image_url: ChatCompletionContentPartImageImageUrl
image_url: Union[str, ChatCompletionContentPartImageImageUrl]
"""
An image URL or base64 data string, or an object with image options.
"""
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from __future__ import annotations

from typing import Literal
from typing import Literal, Union

from typing_extensions import Required, TypedDict

Expand All @@ -19,4 +19,5 @@ class ChatCompletionContentPartImageParam(TypedDict, total=False):
type: Required[Literal["image_url"]]
"""The type of the content part. Always `image_url`."""

image_url: Required[ChatCompletionContentPartImageImageUrlParam]
image_url: Required[Union[str, ChatCompletionContentPartImageImageUrlParam]]
"""An image URL or base64 data string, or an object with image options."""

This file was deleted.

14 changes: 7 additions & 7 deletions src/arkruntime/types/chat/chat_completion_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
class ChatCompletionRequest(BaseModel):
messages: List[ChatCompletionRequestMessage]
"""
A list of messages comprising the conversation so far.
A non-empty list of messages comprising the conversation so far.
"""
model: str
"""
Expand Down Expand Up @@ -57,16 +57,16 @@ class ChatCompletionRequest(BaseModel):
top_logprobs: Optional[int] = None
"""
Number of most-likely tokens to return at each position when
`logprobs` is true. Range 0-20.
`logprobs` is true. The allowed range is model-dependent (default 0-20).
"""
max_tokens: Optional[int] = None
"""
The maximum number of tokens that can be generated in the
completion.
The non-negative maximum number of tokens that can be generated in
the completion.
"""
max_completion_tokens: Optional[int] = None
"""
Upper bound on completion tokens, including reasoning tokens.
Non-negative upper bound on completion tokens, including reasoning tokens.
"""
n: Optional[int] = None
"""
Expand All @@ -79,8 +79,8 @@ class ChatCompletionRequest(BaseModel):
"""
stop: Optional[ChatCompletionStop] = None
"""
Up to 4 sequences where the API will stop generating further
tokens.
Sequences where the API will stop generating further tokens. The
count limit is model-dependent (default 4). Null means no stop sequences.
"""
stream: Optional[bool] = None
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
from arkruntime._models import BaseModel

from .chat_completion_message_content import ChatCompletionMessageContent
from .chat_completion_message_tool_call import ChatCompletionMessageToolCall
from .chat_completion_request_message_tool_call import (
ChatCompletionRequestMessageToolCall,
)


class ChatCompletionRequestAssistantMessage(BaseModel):
Expand All @@ -21,8 +23,8 @@ class ChatCompletionRequestAssistantMessage(BaseModel):
"""
content: Optional[ChatCompletionMessageContent] = None
"""
The contents of the assistant message. Required unless `tool_calls`
is specified.
The contents of the assistant message. Missing, null, or empty content
is normalized to an empty string, including when no tools are called.
"""
reasoning_content: Optional[ChatCompletionMessageContent] = None
"""
Expand All @@ -32,7 +34,7 @@ class ChatCompletionRequestAssistantMessage(BaseModel):
"""
Encrypted form of the reasoning content, when redaction is enabled.
"""
tool_calls: Optional[List[ChatCompletionMessageToolCall]] = None
tool_calls: Optional[List[ChatCompletionRequestMessageToolCall]] = None
"""
The tool calls generated by the model, such as function calls.
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,28 @@
from typing_extensions import Required, TypedDict

from .chat_completion_message_content_param import ChatCompletionMessageContentParam
from .chat_completion_message_tool_call_param import ChatCompletionMessageToolCallParam
from .chat_completion_request_message_tool_call_param import (
ChatCompletionRequestMessageToolCallParam,
)


class ChatCompletionRequestAssistantMessageParam(TypedDict, total=False):
role: Required[Literal["assistant"]]
"""The role of the messages author. Always `assistant`."""

content: Optional[ChatCompletionMessageContentParam]
content: Optional[Optional[ChatCompletionMessageContentParam]]
"""
The contents of the assistant message. Required unless `tool_calls`
is specified.
The contents of the assistant message. Missing, null, or empty content
is normalized to an empty string, including when no tools are called.
"""

reasoning_content: Optional[ChatCompletionMessageContentParam]
reasoning_content: Optional[Optional[ChatCompletionMessageContentParam]]
"""The reasoning content emitted by the assistant alongside `content`."""

encrypted_content: Optional[str]
"""Encrypted form of the reasoning content, when redaction is enabled."""

tool_calls: Optional[List[ChatCompletionMessageToolCallParam]]
tool_calls: Optional[List[ChatCompletionRequestMessageToolCallParam]]
"""The tool calls generated by the model, such as function calls."""

name: Optional[str]
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 Literal, Optional

from arkruntime._models import BaseModel

from .chat_completion_message_content import ChatCompletionMessageContent


class ChatCompletionRequestDeveloperMessage(BaseModel):
"""
Developer instructions are treated as system messages.
"""

role: Literal["developer"]
"""
The role of the message author. Always `developer`.
"""
content: ChatCompletionMessageContent
"""
The contents of the developer message.
"""
name: Optional[str] = None
Loading
Loading