Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

提供兼容cohere的rerank接口 #998

Closed
5 tasks done
leoterry-ulrica opened this issue Mar 14, 2024 · 2 comments
Closed
5 tasks done

提供兼容cohere的rerank接口 #998

leoterry-ulrica opened this issue Mar 14, 2024 · 2 comments
Labels
feature New feature or request

Comments

@leoterry-ulrica
Copy link
Contributor

leoterry-ulrica commented Mar 14, 2024

例行检查

  • 我已确认目前没有类似 features
  • 我已确认我已升级到最新版本
  • 我已完整查看过项目 README,已确定现有版本无法满足需求
  • 我理解并愿意跟进此 features,协助测试和提供反馈
  • 我理解并认可上述内容,并理解项目维护者精力有限,不遵循规则的 features 可能会被无视或直接关闭

功能描述
提供兼容cohere的rerank api接口,包含请求参数和响应结果。现在推理框架提供的rerank接口协议一般先兼容cohere的rerank 协议。

应用场景
知识库RAG重排。

相关示例

docs = [
    'Carson City is the capital city of the American state of Nevada.',
    'The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean. Its capital is Saipan.',
    'Washington, D.C. (also known as simply Washington or D.C., and officially as the District of Columbia) is the capital of the United States. It is a federal district.',
    'Capital punishment (the death penalty) has existed in the United States since beforethe United States was a country. As of 2017, capital punishment is legal in 30 of the 50 states.'
]

co_rerank = co.rerank(
    model='rerank-english-v2.0',
    query='What is the capital of the United States?',
    documents=docs
)

print(co_rerank)
[RerankResult<document['text']: Washington, D.C. (also known as simply Washington or D.C., and officially as the District of Columbia) is the capital of the United States. It is a federal district., index: 2, relevance_score: 0.98005307>, RerankResult<document['text']: Capital punishment (the death penalty) has existed in the United States since beforethe United States was a country. As of 2017, capital punishment is legal in 30 of the 50 states., index: 3, relevance_score: 0.27904198>, RerankResult<document['text']: Carson City is the capital city of the American state of Nevada., index: 0, relevance_score: 0.10194652>, RerankResult<document['text']: The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean. Its capital is Saipan., index: 1, relevance_score: 0.0721122>]


@leoterry-ulrica leoterry-ulrica added the feature New feature or request label Mar 14, 2024
@leoterry-ulrica
Copy link
Contributor Author

#961 (comment) 等待合并后对齐。

@c121914yu
Copy link
Collaborator

done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants