Commit 646de298 by 范立洲

fix: check score type

parent 9fe2708d
......@@ -18,7 +18,7 @@ POST_SCHEMA = {
"properties": {
"prompt": {"type": "string"},
"limit": {"type": "integer"},
"score": {"type": "integer"},
"score": {"type": "number"},
"stream": {"type": "boolean"},
},
"required": ["prompt"],
......
......@@ -20,8 +20,8 @@ class IntentBot(BaseQDBot):
# self.data_source = data_source
self.embdder = embedder
self.collection = collection
self.score = float(score)
self.limit = int(limit)
self.score = score
self.limit = limit
def formatter(self, line: List) -> Dict:
# line format: 问题,答案, type, 意图
......
......@@ -12,20 +12,20 @@ class QABot(BaseQDBot):
data_source: QDDataSource,
embedder: Embedding,
collection: str,
score: int,
score: float,
limit: int,
):
super(QABot, self).__init__(data_source)
self.embdder = embedder
self.collection = collection
self.score = float(score)
self.limit = int(limit)
self.score = score
self.limit = limit
def formatter(self, line: List) -> Dict:
# line format: 问题,答案, type, 意图
return BotPayload(question=line[0], answer=line[1], type=line[2]).to_dict()
def complete(self, prompt: str, score: int = 0, limit: int = 0) -> BotPayload:
def complete(self, prompt: str, score: float = 0, limit: int = 0) -> BotPayload:
_limit = self.limit if limit == 0 else limit
_score = self.score if score == 0 else score
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论