[Feature] support reward model (#5301)

* Your commit message here

* add test

* update develop

* support reward

* support enable_chunk_prefill

* support bingfa

* support convert is reward

* update test

* delete print

* fix enable_thinking

* add document

* fix place

* fix test

* fix

* support enable_prefix_caching

* add no-enable_prefix-caching test

* fix

* support enable_prefix_caching

* delete print

* fix document

* fix

* fix test

* fix document and delete chinese

* udpate

* enable_thinking

* fix test
This commit is contained in:
lizexu123
2025-12-02 14:55:31 +08:00
committed by GitHub
parent 2e1680838f
commit c563eca791
17 changed files with 636 additions and 58 deletions

View File

@@ -920,16 +920,6 @@ class EmbeddingChatRequest(BaseModel):
user: Optional[str] = None
truncate_prompt_tokens: Optional[Annotated[int, Field(ge=-1)]] = None
# --8<-- [start:chat-embedding-extra-params]
add_generation_prompt: bool = Field(
default=False,
description=(
"If true, the generation prompt will be added to the chat template. "
"This is a parameter used by chat template in tokenizer config of the "
"model."
),
)
add_special_tokens: bool = Field(
default=False,
description=(
@@ -1013,9 +1003,9 @@ PoolingChatRequest = EmbeddingChatRequest
class ChatRewardRequest(BaseModel):
model: Optional[str] = None # 指定模型,例如 "default" 或支持 embedding 的 chat 模型
messages: Union[List[Any], List[int]] # 聊天消息列表(必选)
user: Optional[str] = None # 调用方标识符
model: Optional[str] = None
messages: Union[List[Any], List[int]]
user: Optional[str] = None
dimensions: Optional[int] = None
truncate_prompt_tokens: Optional[Annotated[int, Field(ge=-1)]] = None
@@ -1084,15 +1074,15 @@ class ChatRewardRequest(BaseModel):
class ChatRewardData(BaseModel):
index: Optional[int] = None # 数据索引(可选)
object: str = "reward" # 固定为 "reward"
score: List[float] # reward 分数(浮点数列表)
index: Optional[int] = None
object: str = "reward"
score: List[float]
class ChatRewardResponse(BaseModel):
id: str # 响应 ID例如 chat-reward-<uuid>
object: str = "object" # 固定为 "object"
created: int # 创建时间Unix 时间戳)
model: str # 使用的模型名
data: List[ChatRewardData] # reward 结果列表
usage: Optional[UsageInfo] = None # Token 使用情况
id: str
object: str = "object"
created: int
model: str
data: List[ChatRewardData]
usage: Optional[UsageInfo] = None