火山引擎AI服务SDK
Project description
ark_sdk_test - 火山方舟API SDK
ark_sdk_test是火山方舟平台的Python SDK,提供了对文本生成、文生图和视频生成API的封装。
安装
从PyPI安装(推荐)
pip install ark_sdk_test
从源码安装
pip install -r requirements.txt
安装
从PyPI安装(推荐)
pip install ark_sdk_test
从源码安装
pip install .
使用说明
- 克隆项目到本地
- 安装依赖:
pip install -r requirements.txt - 在代码中导入SDK并使用
运行测试
# 运行测试
pytest
# 或者运行测试并生成覆盖率报告
pytest --cov=ark_sdk_test --cov-report=html
初始化SDK
from ark_sdk_test import VolcEngineSDK
# 使用您的API密钥初始化SDK
sdk = VolcEngineSDK("YOUR_API_KEY")
文本生成 (Chat)
# 调用文本生成接口
response = sdk.chat.chat(
model="doubao-1-5-pro-32k-250115",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"}
]
)
print(response)
文生图 (Image Generation)
# 调用文生图接口
response = sdk.image.generate_image(
prompt="一只可爱的猫咪",
model="doubao-seedream-3-0-t2i-250415",
size="1024x1024"
)
print(response)
视频生成 (Video Generation)
# 创建视频生成任务
response = sdk.video.create_video_task(
model="doubao-seedance-1-0-pro-250528",
content=[
{
"type": "text",
"text": "多个镜头。一名侦探进入一间光线昏暗的房间。他检查桌上的线索,手里拿起桌上的某个物品。镜头转向他正在思索。 --ratio 16:9"
}
]
)
task_id = response["id"]
print(f"任务ID: {task_id}")
# 查询任务状态
status = sdk.video.get_video_task(task_id)
print(status)
模块说明
VolcEngineSDK: SDK主类,提供对所有API的访问TextGenerationClient: 文本生成API客户端ImageGenerationClient: 文生图API客户端VideoGenerationClient: 视频生成API客户端
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ark_sdk_test-1.0.1.tar.gz
(6.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ark_sdk_test-1.0.1.tar.gz.
File metadata
- Download URL: ark_sdk_test-1.0.1.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8ae8dd9e92eda8bf0ceb2dd50608e4319c865b3879529cf21b65de892b40cdb
|
|
| MD5 |
d2233d827ac0cb95ceb7eca8ad1562cd
|
|
| BLAKE2b-256 |
4485b835bff7e0f6d2b5ff7189973c3253129a04d2150b0dccbf709c5ecbea50
|
File details
Details for the file ark_sdk_test-1.0.1-py2.py3-none-any.whl.
File metadata
- Download URL: ark_sdk_test-1.0.1-py2.py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a35a70ae2854291da19ade83902b73e7840ce5422ae22e48d0ebeeb359f5c414
|
|
| MD5 |
22ec42a4b1b639fd94744e6506fd56ac
|
|
| BLAKE2b-256 |
e25774a4b57ce5b4974fc3bf444309e8e5f0a201805753f549981a07002b0fa5
|