测试模型
curl -s -X POST http://localhost:8080/embed \
-H "Content-Type: application/json" \
-d '{"inputs":"这是一段测试文本"}' | python3 -m json.tool | head -5
curl -s -X POST http://localhost:8080/embed \
-H "Content-Type: application/json" \
-d '{"inputs":["文本一","文本二","文本三"]}'
curl -s http://localhost:8080/health
单条文本(与 OpenAI SDK 完全兼容):
curl -s -X POST http://localhost:8080/v1/embeddings \
-H "Content-Type: application/json" \
-d '{"input":"这是一段测试文本","model":"bge-m3"}' \
| python3 -m json.tool | head -20
批量文本:
curl -s -X POST http://localhost:8080/v1/embeddings \
-H "Content-Type: application/json" \
-d '{"input":["文本一","文本二","文本三"],"model":"bge-m3"}'
OpenAI 标准响应示例:
{
"object": "list",
"data": [
{
"object": "embedding",
"index": 0,
"embedding": [0.123, -0.456, 0.789, ...]
}
],
"model": "bge-m3",
"usage": {
"prompt_tokens": 8,
"total_tokens": 8
}
}