向量生成
curl --request POST \
--url https://api.hubto.ai/v1/embeddings \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"input": "<string>"
}
'import requests
url = "https://api.hubto.ai/v1/embeddings"
payload = {
"model": "<string>",
"input": "<string>"
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: '<string>', input: '<string>'})
};
fetch('https://api.hubto.ai/v1/embeddings', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": [
{}
]
}接口示例
向量生成
文本向量生成接口。
POST
/
v1
/
embeddings
向量生成
curl --request POST \
--url https://api.hubto.ai/v1/embeddings \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"input": "<string>"
}
'import requests
url = "https://api.hubto.ai/v1/embeddings"
payload = {
"model": "<string>",
"input": "<string>"
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: '<string>', input: '<string>'})
};
fetch('https://api.hubto.ai/v1/embeddings', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": [
{}
]
}用途
用于把文本转换为向量,适合检索、召回和语义相似度场景。请求头
string
默认值:"Bearer YOUR_API_KEY"
必填
Bearer 鉴权请求头。
请求体
string
默认值:"text-embedding-3-small"
必填
向量模型名称。
string
默认值:"HubTo 是统一的大模型接口网关。"
必填
待向量化文本。
string
默认值:"float"
可选,向量编码格式。
示例请求体
{
"model": "text-embedding-3-small",
"input": "HubTo 是统一的大模型接口网关。"
}
响应
object[]
向量结果数组,通常位于
data[0].embedding。⌘I