-
-
Notifications
You must be signed in to change notification settings - Fork 1k
feat: 添加阿里百炼重排序模型适配器 #3706
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
Merged
Merged
feat: 添加阿里百炼重排序模型适配器 #3706
+263
−0
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
你好 - 我已经审阅了你的修改,它们看起来很棒!
AI 代理的提示
请解决此代码审查中的评论:
## 单独评论
### 评论 1
<location> `astrbot/core/provider/sources/bailian_rerank_source.py:142-143` </location>
<code_context>
+
+ # 转换为RerankResult对象
+ rerank_results = []
+ for result in results:
+ rerank_result = RerankResult(
+ index=result["index"], relevance_score=result["relevance_score"]
+ )
</code_context>
<issue_to_address>
**问题:** 假设“index”和“relevance_score”始终存在于结果中。
API 响应中缺少键可能会导致 KeyError。在访问这些字段之前,请使用 .get() 并提供默认值或验证响应。
</issue_to_address>
### 评论 2
<location> `astrbot/core/provider/sources/bailian_rerank_source.py:62` </location>
<code_context>
+
+ logger.info(f"AstrBot 百炼 Rerank 初始化完成。模型: {self.model}")
+
+ async def rerank(
+ self,
+ query: str,
</code_context>
<issue_to_address>
**问题 (复杂性):** 考虑通过提取用于有效载荷构建、响应解析和使用情况日志记录的辅助函数来重构 rerank 方法,以提高清晰度并减少嵌套。
```suggestion
`rerank` 方法仍然承担了过多的职责和嵌套的代码块。考虑至少提取三个辅助函数:有效载荷构建、响应解析和使用情况日志记录。例如:
```python
# inside BailianRerankProvider
def _build_payload(self, query: str, documents: list[str], top_n: int | None) -> dict:
base = {"model": self.model, "input": {"query": query, "documents": documents}}
params = {
k: v
for k, v in [
("top_n", top_n),
("return_documents", True if self.return_documents else None),
("instruct", self.instruct if self.model == "qwen3-rerank" else None),
]
if v is not None
}
if params:
base["parameters"] = params
return base
def _parse_results(self, data: dict) -> list[RerankResult]:
if data.get("code", "200") != "200":
raise Exception(f"百炼 API 错误: {data.get('code')} – {data.get('message', '')}")
results = data.get("output", {}).get("results", [])
return [
RerankResult(index=r["index"], relevance_score=r["relevance_score"])
for r in results
]
def _log_usage(self, data: dict) -> None:
tokens = data.get("usage", {}).get("total_tokens", 0)
if tokens:
logger.debug(f"百炼 Rerank 消耗 Token: {tokens}")
```
然后将 `rerank` 简化为:
```python
async def rerank(...):
# pre‐checks...
payload = self._build_payload(query, documents[:500], final_top_n)
async with self.client.post(self.base_url, json=payload) as resp:
resp.raise_for_status()
data = await resp.json()
results = self._parse_results(data)
self._log_usage(data)
return results
```
这保留了行为,但减少了嵌套并澄清了每个步骤。
</issue_to_address>
### 评论 3
<location> `astrbot/core/provider/sources/bailian_rerank_source.py:24-26` </location>
<code_context>
self.api_key = provider_config.get("rerank_api_key", "")
if not self.api_key:
self.api_key = os.getenv("DASHSCOPE_API_KEY", "")
</code_context>
<issue_to_address>
**建议 (代码质量):** 使用 `or` 提供备用值 ([`use-or-for-fallback`](https://docs.sourcery.ai/Reference/Rules-and-In-Line-Suggestions/Python/Default-Rules/use-or-for-fallback))
```suggestion
self.api_key = provider_config.get("rerank_api_key", "") or os.getenv("DASHSCOPE_API_KEY", "")
```
<br/><details><summary>解释</summary>得益于 Python `or` 运算符的灵活性,您可以使用单个赋值语句,即使变量可以从不同来源获取其值。这比使用多个带有 `if not` 条件的赋值语句更短且更易于阅读。
</details>
</issue_to_address>
### 评论 4
<location> `astrbot/core/provider/sources/bailian_rerank_source.py:128-130` </location>
<code_context>
</code_context>
<issue_to_address>
**问题 (代码质量):** 引发特定错误而不是通用的 `Exception` 或 `BaseException` ([`raise-specific-error`](https://docs.sourcery.ai/Reference/Rules-and-In-Line-Suggestions/Python/Default-Rules/raise-specific-error))
<details><summary>解释</summary>如果一段代码引发特定异常类型而不是通用的 [`BaseException`](https://docs.python.org/3/library/exceptions.html#BaseException) 或 [`Exception`](https://docs.python.org/3/library/exceptions.html#Exception),则调用代码可以:
- 获取有关错误类型的更多信息
- 为其定义特定的异常处理
这样,代码的调用者就可以适当地处理错误。
您如何解决这个问题?
- 使用标准库中的 [内置异常](https://docs.python.org/3/library/exceptions.html)。
- [定义您自己的错误类](https://docs.python.org/3/tutorial/errors.html#tut-userexceptions),它继承自 `Exception`。
因此,与其让代码引发 `Exception` 或 `BaseException`,例如
```python
if incorrect_input(value):
raise Exception("The input is incorrect")
```
您可以让代码引发特定错误,例如
```python
if incorrect_input(value):
raise ValueError("The input is incorrect")
```
或者
```python
class IncorrectInputError(Exception):
pass
if incorrect_input(value):
raise IncorrectInputError("The input is incorrect")
```
</details>
</issue_to_address>
### 评论 5
<location> `astrbot/core/provider/sources/bailian_rerank_source.py:160` </location>
<code_context>
</code_context>
<issue_to_address>
**问题 (代码质量):** 引发特定错误而不是通用的 `Exception` 或 `BaseException` ([`raise-specific-error`](https://docs.sourcery.ai/Reference/Rules-and-In-Line-Suggestions/Python/Default-Rules/raise-specific-error))
<details><summary>解释</summary>如果一段代码引发特定异常类型而不是通用的 [`BaseException`](https://docs.python.org/3/library/exceptions.html#BaseException) 或 [`Exception`](https://docs.python.org/3/library/exceptions.html#Exception),则调用代码可以:
- 获取有关错误类型的更多信息
- 为其定义特定的异常处理
这样,代码的调用者就可以适当地处理错误。
您如何解决这个问题?
- 使用标准库中的 [内置异常](https://docs.python.org/3/library/exceptions.html)。
- [定义您自己的错误类](https://docs.python.org/3/tutorial/errors.html#tut-userexceptions),它继承自 `Exception`。
因此,与其让代码引发 `Exception` 或 `BaseException`,例如
```python
if incorrect_input(value):
raise Exception("The input is incorrect")
```
you can have code raising a specific error like
```python
if incorrect_input(value):
raise ValueError("The input is incorrect")
```
or
```python
class IncorrectInputError(Exception):
pass
if incorrect_input(value):
raise IncorrectInputError("The input is incorrect")
```
</details>
</issue_to_address>
### 评论 6
<location> `astrbot/core/provider/sources/bailian_rerank_source.py:163` </location>
<code_context>
</code_context>
<issue_to_address>
**问题 (代码质量):** 引发特定错误而不是通用的 `Exception` 或 `BaseException` ([`raise-specific-error`](https://docs.sourcery.ai/Reference/Rules-and-In-Line-Suggestions/Python/Default-Rules/raise-specific-error))
<details><summary>解释</summary>如果一段代码引发特定异常类型而不是通用的 [`BaseException`](https://docs.python.org/3/library/exceptions.html#BaseException) 或 [`Exception`](https://docs.python.org/3/library/exceptions.html#Exception),则调用代码可以:
- 获取有关错误类型的更多信息
- 为其定义特定的异常处理
这样,代码的调用者就可以适当地处理错误。
您如何解决这个问题?
- 使用标准库中的 [内置异常](https://docs.python.org/3/library/exceptions.html)。
- [定义您自己的错误类](https://docs.python.org/3/tutorial/errors.html#tut-userexceptions),它继承自 `Exception`。
因此,与其让代码引发 `Exception` 或 `BaseException`,例如
```python
if incorrect_input(value):
raise Exception("The input is incorrect")
```
you can have code raising a specific error like
```python
if incorrect_input(value):
raise ValueError("The input is incorrect")
```
or
```python
class IncorrectInputError(Exception):
pass
if incorrect_input(value):
raise IncorrectInputError("The input is incorrect")
```
</details>
</issue_to_address>
### 评论 7
<location> `astrbot/core/provider/sources/bailian_rerank_source.py:97` </location>
<code_context>
async def rerank(
self,
query: str,
documents: list[str],
top_n: int | None = None,
) -> list[RerankResult]:
"""
对文档进行重排序
Args:
query: 查询文本
documents: 待排序的文档列表
top_n: 返回前N个结果,如果为None则使用配置中的默认值
Returns:
重排序结果列表
"""
if not documents:
logger.warning("文档列表为空,返回空结果")
return []
if not query.strip():
logger.warning("查询文本为空,返回空结果")
return []
# 检查限制
if len(documents) > 500:
logger.warning(
f"文档数量({len(documents)})超过限制(500),将截断前500个文档"
)
documents = documents[:500]
# 优先使用传入的top_n参数(来自知识库配置),如果没有才使用默认配置
final_top_n = top_n if top_n is not None else self.default_top_n
try:
# 构建请求载荷
payload = {
"model": self.model,
"input": {"query": query, "documents": documents},
}
# 添加可选参数
parameters = {}
if final_top_n is not None:
parameters["top_n"] = final_top_n
if self.return_documents:
parameters["return_documents"] = True
if self.instruct and self.model == "qwen3-rerank":
parameters["instruct"] = self.instruct
if parameters:
payload["parameters"] = parameters
logger.debug(
f"百炼 Rerank 请求: query='{query[:50]}...', 文档数量={len(documents)}"
)
# 发送请求
async with self.client.post(self.base_url, json=payload) as response:
response.raise_for_status()
response_data = await response.json()
# 检查响应状态
if "code" in response_data and response_data["code"] != "200":
error_msg = response_data.get("message", "未知错误")
raise Exception(
f"百炼 API 返回错误: {response_data['code']} - {error_msg}"
)
# 解析结果
output = response_data.get("output", {})
results = output.get("results", [])
if not results:
logger.warning(f"百炼 Rerank 返回空结果: {response_data}")
return []
# 转换为RerankResult对象
rerank_results = []
for result in results:
rerank_result = RerankResult(
index=result["index"], relevance_score=result["relevance_score"]
)
rerank_results.append(rerank_result)
logger.debug(f"百炼 Rerank 成功返回 {len(rerank_results)} 个结果")
# 记录使用量信息
usage = response_data.get("usage", {})
total_tokens = usage.get("total_tokens", 0)
if total_tokens > 0:
logger.debug(f"百炼 Rerank 消耗 Token 数量: {total_tokens}")
return rerank_results
except aiohttp.ClientError as e:
logger.error(f"百炼 Rerank 网络请求失败: {e}")
raise Exception(f"网络请求失败: {e}")
except Exception as e:
logger.error(f"百炼 Rerank 处理失败: {e}")
raise Exception(f"重排序失败: {e}")
</code_context>
<issue_to_address>
**问题 (代码质量):** 明确地从之前的错误中引发异常 [×2] ([`raise-from-previous-error`](https://docs.sourcery.ai/Reference/Default-Rules/suggestions/raise-from-previous-error/))
</issue_to_address>帮助我更有用!请点击每个评论上的 👍 或 👎,我将利用这些反馈来改进您的评论。
Original comment in English
Hey there - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `astrbot/core/provider/sources/bailian_rerank_source.py:142-143` </location>
<code_context>
+
+ # 转换为RerankResult对象
+ rerank_results = []
+ for result in results:
+ rerank_result = RerankResult(
+ index=result["index"], relevance_score=result["relevance_score"]
+ )
</code_context>
<issue_to_address>
**issue:** Assumes 'index' and 'relevance_score' are always present in result.
Missing keys in the API response may cause KeyError. Use .get() with default values or validate the response before accessing these fields.
</issue_to_address>
### Comment 2
<location> `astrbot/core/provider/sources/bailian_rerank_source.py:62` </location>
<code_context>
+
+ logger.info(f"AstrBot 百炼 Rerank 初始化完成。模型: {self.model}")
+
+ async def rerank(
+ self,
+ query: str,
</code_context>
<issue_to_address>
**issue (complexity):** Consider refactoring the rerank method by extracting helper functions for payload construction, response parsing, and usage logging to improve clarity and reduce nesting.
```suggestion
The `rerank` method still has too many responsibilities and nested blocks. Consider extracting at least three helpers: payload construction, response parsing, and usage‐logging. For example:
```python
# inside BailianRerankProvider
def _build_payload(self, query: str, documents: list[str], top_n: int | None) -> dict:
base = {"model": self.model, "input": {"query": query, "documents": documents}}
params = {
k: v
for k, v in [
("top_n", top_n),
("return_documents", True if self.return_documents else None),
("instruct", self.instruct if self.model == "qwen3-rerank" else None),
]
if v is not None
}
if params:
base["parameters"] = params
return base
def _parse_results(self, data: dict) -> list[RerankResult]:
if data.get("code", "200") != "200":
raise Exception(f"百炼 API 错误: {data.get('code')} – {data.get('message', '')}")
results = data.get("output", {}).get("results", [])
return [
RerankResult(index=r["index"], relevance_score=r["relevance_score"])
for r in results
]
def _log_usage(self, data: dict) -> None:
tokens = data.get("usage", {}).get("total_tokens", 0)
if tokens:
logger.debug(f"百炼 Rerank 消耗 Token: {tokens}")
```
Then simplify `rerank` to:
```python
async def rerank(...):
# pre‐checks...
payload = self._build_payload(query, documents[:500], final_top_n)
async with self.client.post(self.base_url, json=payload) as resp:
resp.raise_for_status()
data = await resp.json()
results = self._parse_results(data)
self._log_usage(data)
return results
```
This preserves behavior but cuts nesting and clarifies each step.
</issue_to_address>
### Comment 3
<location> `astrbot/core/provider/sources/bailian_rerank_source.py:24-26` </location>
<code_context>
self.api_key = provider_config.get("rerank_api_key", "")
if not self.api_key:
self.api_key = os.getenv("DASHSCOPE_API_KEY", "")
</code_context>
<issue_to_address>
**suggestion (code-quality):** Use `or` for providing a fallback value ([`use-or-for-fallback`](https://docs.sourcery.ai/Reference/Rules-and-In-Line-Suggestions/Python/Default-Rules/use-or-for-fallback))
```suggestion
self.api_key = provider_config.get("rerank_api_key", "") or os.getenv("DASHSCOPE_API_KEY", "")
```
<br/><details><summary>Explanation</summary>Thanks to the flexibility of Python's `or` operator, you can use a single
assignment statement, even if a variable can retrieve its value from various
sources. This is shorter and easier to read than using multiple assignments with
`if not` conditions.
</details>
</issue_to_address>
### Comment 4
<location> `astrbot/core/provider/sources/bailian_rerank_source.py:128-130` </location>
<code_context>
</code_context>
<issue_to_address>
**issue (code-quality):** Raise a specific error instead of the general `Exception` or `BaseException` ([`raise-specific-error`](https://docs.sourcery.ai/Reference/Rules-and-In-Line-Suggestions/Python/Default-Rules/raise-specific-error))
<details><summary>Explanation</summary>If a piece of code raises a specific exception type
rather than the generic
[`BaseException`](https://docs.python.org/3/library/exceptions.html#BaseException)
or [`Exception`](https://docs.python.org/3/library/exceptions.html#Exception),
the calling code can:
- get more information about what type of error it is
- define specific exception handling for it
This way, callers of the code can handle the error appropriately.
How can you solve this?
- Use one of the [built-in exceptions](https://docs.python.org/3/library/exceptions.html) of the standard library.
- [Define your own error class](https://docs.python.org/3/tutorial/errors.html#tut-userexceptions) that subclasses `Exception`.
So instead of having code raising `Exception` or `BaseException` like
```python
if incorrect_input(value):
raise Exception("The input is incorrect")
```
you can have code raising a specific error like
```python
if incorrect_input(value):
raise ValueError("The input is incorrect")
```
or
```python
class IncorrectInputError(Exception):
pass
if incorrect_input(value):
raise IncorrectInputError("The input is incorrect")
```
</details>
</issue_to_address>
### Comment 5
<location> `astrbot/core/provider/sources/bailian_rerank_source.py:160` </location>
<code_context>
</code_context>
<issue_to_address>
**issue (code-quality):** Raise a specific error instead of the general `Exception` or `BaseException` ([`raise-specific-error`](https://docs.sourcery.ai/Reference/Rules-and-In-Line-Suggestions/Python/Default-Rules/raise-specific-error))
<details><summary>Explanation</summary>If a piece of code raises a specific exception type
rather than the generic
[`BaseException`](https://docs.python.org/3/library/exceptions.html#BaseException)
or [`Exception`](https://docs.python.org/3/library/exceptions.html#Exception),
the calling code can:
- get more information about what type of error it is
- define specific exception handling for it
This way, callers of the code can handle the error appropriately.
How can you solve this?
- Use one of the [built-in exceptions](https://docs.python.org/3/library/exceptions.html) of the standard library.
- [Define your own error class](https://docs.python.org/3/tutorial/errors.html#tut-userexceptions) that subclasses `Exception`.
So instead of having code raising `Exception` or `BaseException` like
```python
if incorrect_input(value):
raise Exception("The input is incorrect")
```
you can have code raising a specific error like
```python
if incorrect_input(value):
raise ValueError("The input is incorrect")
```
or
```python
class IncorrectInputError(Exception):
pass
if incorrect_input(value):
raise IncorrectInputError("The input is incorrect")
```
</details>
</issue_to_address>
### Comment 6
<location> `astrbot/core/provider/sources/bailian_rerank_source.py:163` </location>
<code_context>
</code_context>
<issue_to_address>
**issue (code-quality):** Raise a specific error instead of the general `Exception` or `BaseException` ([`raise-specific-error`](https://docs.sourcery.ai/Reference/Rules-and-In-Line-Suggestions/Python/Default-Rules/raise-specific-error))
<details><summary>Explanation</summary>If a piece of code raises a specific exception type
rather than the generic
[`BaseException`](https://docs.python.org/3/library/exceptions.html#BaseException)
or [`Exception`](https://docs.python.org/3/library/exceptions.html#Exception),
the calling code can:
- get more information about what type of error it is
- define specific exception handling for it
This way, callers of the code can handle the error appropriately.
How can you solve this?
- Use one of the [built-in exceptions](https://docs.python.org/3/library/exceptions.html) of the standard library.
- [Define your own error class](https://docs.python.org/3/tutorial/errors.html#tut-userexceptions) that subclasses `Exception`.
So instead of having code raising `Exception` or `BaseException` like
```python
if incorrect_input(value):
raise Exception("The input is incorrect")
```
you can have code raising a specific error like
```python
if incorrect_input(value):
raise ValueError("The input is incorrect")
```
or
```python
class IncorrectInputError(Exception):
pass
if incorrect_input(value):
raise IncorrectInputError("The input is incorrect")
```
</details>
</issue_to_address>
### Comment 7
<location> `astrbot/core/provider/sources/bailian_rerank_source.py:97` </location>
<code_context>
async def rerank(
self,
query: str,
documents: list[str],
top_n: int | None = None,
) -> list[RerankResult]:
"""
对文档进行重排序
Args:
query: 查询文本
documents: 待排序的文档列表
top_n: 返回前N个结果,如果为None则使用配置中的默认值
Returns:
重排序结果列表
"""
if not documents:
logger.warning("文档列表为空,返回空结果")
return []
if not query.strip():
logger.warning("查询文本为空,返回空结果")
return []
# 检查限制
if len(documents) > 500:
logger.warning(
f"文档数量({len(documents)})超过限制(500),将截断前500个文档"
)
documents = documents[:500]
# 优先使用传入的top_n参数(来自知识库配置),如果没有才使用默认配置
final_top_n = top_n if top_n is not None else self.default_top_n
try:
# 构建请求载荷
payload = {
"model": self.model,
"input": {"query": query, "documents": documents},
}
# 添加可选参数
parameters = {}
if final_top_n is not None:
parameters["top_n"] = final_top_n
if self.return_documents:
parameters["return_documents"] = True
if self.instruct and self.model == "qwen3-rerank":
parameters["instruct"] = self.instruct
if parameters:
payload["parameters"] = parameters
logger.debug(
f"百炼 Rerank 请求: query='{query[:50]}...', 文档数量={len(documents)}"
)
# 发送请求
async with self.client.post(self.base_url, json=payload) as response:
response.raise_for_status()
response_data = await response.json()
# 检查响应状态
if "code" in response_data and response_data["code"] != "200":
error_msg = response_data.get("message", "未知错误")
raise Exception(
f"百炼 API 返回错误: {response_data['code']} - {error_msg}"
)
# 解析结果
output = response_data.get("output", {})
results = output.get("results", [])
if not results:
logger.warning(f"百炼 Rerank 返回空结果: {response_data}")
return []
# 转换为RerankResult对象
rerank_results = []
for result in results:
rerank_result = RerankResult(
index=result["index"], relevance_score=result["relevance_score"]
)
rerank_results.append(rerank_result)
logger.debug(f"百炼 Rerank 成功返回 {len(rerank_results)} 个结果")
# 记录使用量信息
usage = response_data.get("usage", {})
total_tokens = usage.get("total_tokens", 0)
if total_tokens > 0:
logger.debug(f"百炼 Rerank 消耗 Token 数量: {total_tokens}")
return rerank_results
except aiohttp.ClientError as e:
logger.error(f"百炼 Rerank 网络请求失败: {e}")
raise Exception(f"网络请求失败: {e}")
except Exception as e:
logger.error(f"百炼 Rerank 处理失败: {e}")
raise Exception(f"重排序失败: {e}")
</code_context>
<issue_to_address>
**issue (code-quality):** Explicitly raise from a previous error [×2] ([`raise-from-previous-error`](https://docs.sourcery.ai/Reference/Default-Rules/suggestions/raise-from-previous-error/))
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Soulter
reviewed
Nov 20, 2025
- 移除未使用的 os 导入 - 简化 API Key 验证逻辑 - 优化 top_n 参数处理,优先使用传入值 - 改进错误处理,使用 RuntimeError 替代通用 Exception - 添加异常链保持原始错误上下文
- 移除不合理的知识库配置读取逻辑 - 添加os模块导入(用于读取环境变量) - 抽取辅助函数:_build_payload()、_parse_results()、_log_usage() - 添加自定义异常类:BailianRerankError、BailianAPIError、BailianNetworkError - 使用.get()安全访问API响应字段,避免KeyError - 使用raise ... from e保持异常链
Contributor
Author
|
之前改错了QAQ |
Soulter
approved these changes
Nov 21, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
添加阿里百炼重排序模型适配器
Modifications / 改动点
添加阿里百炼重排序模型添加bailian_rerank_source.py修改manager.py和default.py添加这个适配器
Screenshots or Test Results / 运行截图或测试结果
Checklist / 检查清单
requirements.txt和pyproject.toml文件相应位置。/ I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations inrequirements.txtandpyproject.toml.Sourcery 总结
通过添加新的提供商适配器、更新提供商管理器以及使用百炼重排序设置扩展默认配置,集成阿里云百炼文本重排序功能。
新功能:
Original summary in English
Summary by Sourcery
Integrate Alibaba Bailian text re-ranking by adding a new provider adapter, updating the provider manager, and extending the default configuration with Bailian re-rank settings.
New Features: