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
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ from arkruntime import Ark
client = Ark()

response = client.responses.create(
model=os.environ.get("ARK_MODEL", "doubao-seed-1-6"),
model=os.environ.get("ARK_MODEL", "doubao-seed-2-1-pro-260628"),
input="Explain how large language models work in three sentences.",
)
print(response.output_text)
Expand All @@ -43,7 +43,7 @@ from arkruntime import Ark
client = Ark()

completion = client.chat.completions.create(
model=os.environ.get("ARK_MODEL", "doubao-seed-1-6"),
model=os.environ.get("ARK_MODEL", "doubao-seed-2-1-pro-260628"),
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Write a haiku about programming."},
Expand All @@ -65,7 +65,7 @@ from arkruntime import Ark
client = Ark()

stream = client.responses.create(
model=os.environ.get("ARK_MODEL", "doubao-seed-1-6"),
model=os.environ.get("ARK_MODEL", "doubao-seed-2-1-pro-260628"),
input="Count from 1 to 10 slowly.",
stream=True,
)
Expand All @@ -82,7 +82,7 @@ from arkruntime import Ark
client = Ark()

stream = client.chat.completions.create(
model=os.environ.get("ARK_MODEL", "doubao-seed-1-6"),
model=os.environ.get("ARK_MODEL", "doubao-seed-2-1-pro-260628"),
messages=[{"role": "user", "content": "Count from 1 to 10 slowly."}],
stream=True,
)
Expand All @@ -104,7 +104,7 @@ client = AsyncArk()

async def main():
response = await client.responses.create(
model=os.environ.get("ARK_MODEL", "doubao-seed-1-6"),
model=os.environ.get("ARK_MODEL", "doubao-seed-2-1-pro-260628"),
input="Explain quantum computing briefly.",
)
print(response.output_text)
Expand All @@ -123,7 +123,7 @@ from arkruntime import Ark
client = Ark()

completion = client.chat.completions.create(
model=os.environ.get("ARK_MODEL", "doubao-seed-1-6"),
model=os.environ.get("ARK_MODEL", "doubao-seed-2-1-pro-260628"),
messages=[
{
"role": "user",
Expand Down Expand Up @@ -164,7 +164,7 @@ tools = [
]

completion = client.chat.completions.create(
model=os.environ.get("ARK_MODEL", "doubao-seed-1-6"),
model=os.environ.get("ARK_MODEL", "doubao-seed-2-1-pro-260628"),
messages=[{"role": "user", "content": "What is the weather in Beijing?"}],
tools=tools,
)
Expand Down Expand Up @@ -205,7 +205,7 @@ client = Ark()

try:
client.chat.completions.create(
model="doubao-seed-1-6",
model="doubao-seed-2-1-pro-260628",
messages=[{"role": "user", "content": "Hello"}],
)
except ArkRateLimitError:
Expand Down Expand Up @@ -253,7 +253,7 @@ Per-request overrides are also supported:

```python
client.chat.completions.create(
model="doubao-seed-1-6",
model="doubao-seed-2-1-pro-260628",
messages=[{"role": "user", "content": "Hello"}],
timeout=30.0,
)
Expand All @@ -269,7 +269,7 @@ from arkruntime import Ark
client = Ark(timeout=24 * 3600)

result = client.batch.chat.completions.create(
model="doubao-seed-1-6",
model="doubao-seed-2-1-pro-260628",
messages=[{"role": "user", "content": "Hello"}],
)
print(result)
Expand Down
2 changes: 1 addition & 1 deletion examples/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Runs against the outward /api/v3/agents endpoint.

export ARK_API_KEY=...
export ARK_MODEL_ID=doubao-seed-1-8-251228 # or whatever you have access to
export ARK_MODEL_ID=doubao-seed-2-1-pro-260628 # or whatever you have access to
python examples/agents.py
"""

Expand Down
2 changes: 1 addition & 1 deletion examples/chat/completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# To get your ak&sk, please refer to this document(https://www.volcengine.com/docs/6291/65568)
# For more information,please check this document(https://www.volcengine.com/docs/82379/1263279)
client = Ark()
MODEL = os.environ.get("ENDPOINT_ID", "doubao-seed-1-6")
MODEL = os.environ.get("ENDPOINT_ID", "doubao-seed-2-1-pro-260628")


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion examples/chat/function_call.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# Authentication
# 1.If you authorize your endpoint using an API key, you can set your api key to environment variable "ARK_API_KEY"
client = Ark()
MODEL = os.environ.get("ENDPOINT_ID", "doubao-seed-1-6")
MODEL = os.environ.get("ENDPOINT_ID", "doubao-seed-2-1-pro-260628")

WEATHER_TOOL = {
"type": "function",
Expand Down
2 changes: 1 addition & 1 deletion examples/chat/reasoning_completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Authentication
# 1.If you authorize your endpoint using an API key, you can set your api key to environment variable "ARK_API_KEY"
client = Ark()
MODEL = os.environ.get("ENDPOINT_ID", "doubao-seed-1-6")
MODEL = os.environ.get("ENDPOINT_ID", "doubao-seed-2-1-pro-260628")

if __name__ == "__main__":
# Streaming:
Expand Down
2 changes: 1 addition & 1 deletion examples/chat/structured_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# Authentication
# 1.If you authorize your endpoint using an API key, you can set your api key to environment variable "ARK_API_KEY"
client = Ark()
MODEL = os.environ.get("ENDPOINT_ID", "doubao-seed-1-6")
MODEL = os.environ.get("ENDPOINT_ID", "doubao-seed-2-1-pro-260628")


class MeetingInfo(BaseModel):
Expand Down
2 changes: 1 addition & 1 deletion examples/chat/vision_completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# 1.If you authorize your endpoint using an API key, you can set your api key to environment variable "ARK_API_KEY"
# or specify api key by Ark(api_key="${YOUR_API_KEY}").
client = Ark()
MODEL = os.environ.get("ENDPOINT_ID", "doubao-seed-1-6")
MODEL = os.environ.get("ENDPOINT_ID", "doubao-seed-2-1-pro-260628")

# Image input:
response = client.chat.completions.create(
Expand Down
14 changes: 7 additions & 7 deletions examples/responses/async_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async def main():
# ---------- 第 1 轮 ----------
# 说明:开启 caching,store=True 表示把对话存储在服务端,以便后续引用
stream = await client.responses.create(
model="doubao-seed-1-6",
model="doubao-seed-2-1-pro-260628",
input=[
{
"role": "system",
Expand Down Expand Up @@ -61,7 +61,7 @@ async def main():
# ---------- 第 2 轮 ----------
# 说明:通过 previous_response_id 关联上一轮的上下文
stream = await client.responses.create(
model="doubao-seed-1-6",
model="doubao-seed-2-1-pro-260628",
previous_response_id=response_id,
input=[
{"role": "user", "content": "上一轮对话里图里的内容是"},
Expand All @@ -83,7 +83,7 @@ async def main():
# ---------- 第 1 轮 ----------
# 用户询问北京天气,模型会触发工具调用
stream = await client.responses.create(
model="doubao-seed-1-6",
model="doubao-seed-2-1-pro-260628",
input=[
{"role": "user", "content": "请问北京今天天气怎么样"},
],
Expand Down Expand Up @@ -126,7 +126,7 @@ async def main():
# ---------- 第 2 轮 ----------
# 把函数返回结果传回模型,让它继续生成最终回答
stream = await client.responses.create(
model="doubao-seed-1-6",
model="doubao-seed-2-1-pro-260628",
previous_response_id=response_id,
input=[
{
Expand All @@ -149,7 +149,7 @@ async def main():
# ==========================================================
print("Example 3: Use responses API for web search")
stream = await client.responses.create(
model="doubao-seed-1-6",
model="doubao-seed-2-1-pro-260628",
input=[
{"role": "user", "content": "今天的新闻"},
],
Expand Down Expand Up @@ -178,7 +178,7 @@ async def main():
# ---------- 第 1 轮 ----------
# 用户询问repo信息,模型会触发mcp工具调用
stream = await client.responses.create(
model="doubao-seed-1-6",
model="doubao-seed-2-1-pro-260628",
input=[
{
"role": "user",
Expand Down Expand Up @@ -213,7 +213,7 @@ async def main():
# ---------- 第 2 轮 ----------
# 用户同意mcp工具调用,模型会继续生成最终回答
stream = await client.responses.create(
model="doubao-seed-1-6",
model="doubao-seed-2-1-pro-260628",
input=[
{
"type": "mcp_approval_response",
Expand Down
4 changes: 2 additions & 2 deletions examples/responses/async_doubao_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async def main():
# ---------- 第 1 轮 ----------
# 选择一种feature 测试
stream = await client.responses.create(
model="doubao-seed-1-6",
model="doubao-seed-2-1-pro-260628",
input=[
{"role": "user", "content": "你好请你介绍你自己"},
],
Expand Down Expand Up @@ -48,7 +48,7 @@ async def main():
# ---------- 第 2 轮 ----------
# 说明:通过 previous_response_id 关联上一轮的上下文
stream = await client.responses.create(
model="doubao-seed-1-6",
model="doubao-seed-2-1-pro-260628",
previous_response_id=response_id,
input=[
{"role": "user", "content": "上一轮对话里我们说了什么"},
Expand Down
4 changes: 2 additions & 2 deletions examples/responses/async_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ async def main() -> None:
# ==========================================================
print("\nTurn 1: ask the model to analyze the video frame-by-frame")
stream = await client.responses.create(
model="doubao-seed-1-6",
model="doubao-seed-2-1-pro-260628",
input=[
{"role": "system", "content": "你是豆包,是由字节跳动开发的 AI 人工智能助手"},
{
Expand All @@ -87,7 +87,7 @@ async def main() -> None:
# ==========================================================
print("\nTurn 2: follow-up referencing prior turn's response")
stream = await client.responses.create(
model="doubao-seed-1-6",
model="doubao-seed-2-1-pro-260628",
previous_response_id=response_id,
input=[
{"role": "user", "content": "上一轮对话里视频里的内容是"},
Expand Down
2 changes: 1 addition & 1 deletion examples/sessions_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
examples/sessions_loop/main.go 1:1.

export ARK_API_KEY=...
export ARK_MODEL_ID=doubao-seed-2-1-pro
export ARK_MODEL_ID=doubao-seed-2-1-pro-260628
python examples/sessions_loop.py
"""

Expand Down
2 changes: 1 addition & 1 deletion examples/tokenization.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from arkruntime import Ark

client = Ark()
MODEL = os.environ.get("ENDPOINT_ID", "doubao-seed-1-6")
MODEL = os.environ.get("ENDPOINT_ID", "doubao-seed-2-1-pro-260628")

print("----- tokenization request -----")
resp = client.tokenization.create(
Expand Down
Loading