fix: set default score_threshold to 1; add weather api key to kb_config

This commit is contained in:
liunux4odoo 2024-01-22 14:36:01 +08:00
parent 370dbfef37
commit a5e758bf82
3 changed files with 11 additions and 6 deletions

View File

@ -21,10 +21,9 @@ OVERLAP_SIZE = 50
# 知识库匹配向量数量
VECTOR_SEARCH_TOP_K = 3
# 知识库匹配的距离阈值取值范围在0-1之间SCORE越小距离越小从而相关度越高
# 取到1相当于不筛选实测bge-large的距离得分大部分在0.01-0.7之间,
# 相似文本的得分最高在0.55左右因此建议针对bge设置得分为0.6
SCORE_THRESHOLD = 0.6
# 知识库匹配的距离阈值一般取值范围在0-1之间SCORE越小距离越小从而相关度越高。
# 但有用户报告遇到过匹配分值超过1的情况为了兼容性默认设为1在WEBUI中调整范围为0-2
SCORE_THRESHOLD = 1.0
# 默认搜索引擎。可选bing, duckduckgo, metaphor
DEFAULT_SEARCH_ENGINE = "duckduckgo"
@ -49,6 +48,8 @@ BING_SUBSCRIPTION_KEY = ""
# metaphor搜索需要KEY
METAPHOR_API_KEY = ""
# 心知天气 API KEY用于天气Agent。申请https://www.seniverse.com/
SENIVERSE_API_KEY = ""
# 是否开启中文标题加强,以及标题增强的相关配置
# 通过增加标题判断判断哪些文本为标题并在metadata中进行标记

View File

@ -201,7 +201,7 @@ MODEL_PATH = {
"agentlm-70b": "THUDM/agentlm-70b",
"falcon-7b": "tiiuae/falcon-7b",
"falcon-40b": "tiiuae/falcon-40,b",
"falcon-40b": "tiiuae/falcon-40b",
"falcon-rw-7b": "tiiuae/falcon-rw-7b",
"aquila-7b": "BAAI/Aquila-7B",

View File

@ -3,6 +3,8 @@
"""
from pydantic import BaseModel, Field
import requests
from configs.kb_config import SENIVERSE_API_KEY
def weather(location: str, api_key: str):
url = f"https://api.seniverse.com/v3/weather/now.json?key={api_key}&location={location}&language=zh-Hans&unit=c"
@ -20,6 +22,8 @@ def weather(location: str, api_key: str):
def weathercheck(location: str):
return weather(location, "your keys")
return weather(location, SENIVERSE_API_KEY)
class WeatherInput(BaseModel):
location: str = Field(description="City name,include city and county")