GRADE_MODEL_NAME = ApolloClient.get_value(key="GRADE_MODEL_NAME", default_val="",
namespace=SERVICE_NAMESPACE)
XINFERENCE_URL = ApolloClient.get_value(key="XINFERENCE_URL", default_val="",
namespace=SERVICE_NAMESPACE)
client = Client(XINFERENCE_URL)
__reranker:RESTfulRerankModelHandle = client.get_model(GRADE_MODEL_NAME)
query = "介绍一下xxxxx"
docs: List[Document] = []
docs.append(Document(page_content="xxx是xxxx",
metadata={"title": "xxxx工作报告"}))
rerank_list = __reranker.rerank(documents=[item.page_content
for index, item in enumerate(docs)
if index==1
],
query=query,
top_n=1)
print(rerank_list.get("results"))
1.如何使用rerank设置指定层的rerank
2.按照现有的方法进行rerank报错,错误信息如下
File "/usr/local/Galileo/galileo/lib/python3.10/site-packages/xinference/client/restful/restful_client.py", line 181, in rerank
raise RuntimeError(
RuntimeError: Failed to rerank documents, detail: [address=0.0.0.0:43511, pid=90365] 'float' object is not subscriptable
请帮忙协助解决一下?谢谢
2条答案
按热度按时间qncylg1j1#
服务端报错详情,应该是这个:
relevance_score=float(similarity_scores[arg]),
92vpleto2#
这个问题已经过时,因为它已经开放了7天,没有任何活动。