tools / utils /upload_test /batch_search.py
Adinosaur's picture
Upload folder using huggingface_hub
1c980b1 verified
raw
history blame contribute delete
538 Bytes
import os
from openai import OpenAI
client = OpenAI(
# 若没有配置环境变量,可用阿里云百炼API Key将下行替换为:api_key="sk-xxx"。但不建议在生产环境中直接将API Key硬编码到代码中,以减少API Key泄露风险。
api_key=os.getenv("DASHSCOPE_API_KEY"),
base_url="https://dashscope.aliyuncs.com/compatible-mode/v1", # 阿里云百炼服务的base_url
)
batch = client.batches.retrieve("batch_d76f011f-e7bb-4686-bc6f-de7a202fa9fa") # 将batch_id替换为Batch任务的id
print(batch)