调用示例(Python)
调用示例(Python)
import cohere
co = cohere.ClientV2("YOUR_API_KEY")
res = co.rerank(
model="rerank-v3.5",
query="如何选择向量数据库",
documents=[d.text for d in candidates],
top_n=8,
)
for r in res.results:
print(r.index, r.relevance_score)托管 API 的文档数量与长度有配额:先看单次调用上限,再决定候选池大小与分批策略。