Unsupported. The entire object is ignored and removed before forwarding; it cannot select an upstream or price tier.
基本請求
1
2
3
4
5
6
7
8
9
10
11
12
13
from openai import OpenAI
client = OpenAI(
base_url="https://api.bazaarlink.ai/v1",
api_key="sk-bl-YOUR_API_KEY",
)
response = client.embeddings.create(
model="openai/text-embedding-3-small",
input="The quick brown fox jumps over the lazy dog",
)
print(response.data[0].embedding) # 1536-dimensional vector
批次處理
傳送字串陣列,可在單一請求中嵌入多筆文字 —— 比逐筆呼叫更便宜也更快。
1
2
3
4
5
6
7
8
9
10
11
response = client.embeddings.create(
model="openai/text-embedding-3-small",
input=[
"Machine learning is a subset of artificial intelligence",
"Deep learning uses neural networks with multiple layers",
"Natural language processing enables computers to understand text",
],
)
for i, item inenumerate(response.data):
print(f"Embedding {i}: {len(item.embedding)} dimensions")