mirror of
https://github.com/RYDE-WORK/Langchain-Chatchat.git
synced 2026-01-19 13:23:16 +08:00
fix: set default score_threshold to 1; add weather api key to kb_config
This commit is contained in:
parent
370dbfef37
commit
a5e758bf82
@ -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中进行标记;
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user