mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-18 16:27:31 +00:00
fix:url embedding
This commit is contained in:
parent
45a3a8a696
commit
8dd25815e1
@ -31,7 +31,7 @@ prompt = PromptTemplate(
|
|||||||
template_scene=ChatScene.ChatNewKnowledge.value,
|
template_scene=ChatScene.ChatNewKnowledge.value,
|
||||||
input_variables=["context", "question"],
|
input_variables=["context", "question"],
|
||||||
response_format=None,
|
response_format=None,
|
||||||
template_define=None,
|
template_define=PROMPT_SCENE_DEFINE,
|
||||||
template=_DEFAULT_TEMPLATE,
|
template=_DEFAULT_TEMPLATE,
|
||||||
stream_out=PROMPT_NEED_NEED_STREAM_OUT,
|
stream_out=PROMPT_NEED_NEED_STREAM_OUT,
|
||||||
output_parser=NormalChatOutputParser(
|
output_parser=NormalChatOutputParser(
|
||||||
|
@ -11,6 +11,10 @@ from pilot.scene.chat_normal.out_parser import NormalChatOutputParser
|
|||||||
|
|
||||||
CFG = Config()
|
CFG = Config()
|
||||||
|
|
||||||
|
PROMPT_SCENE_DEFINE = """A chat between a curious user and an artificial intelligence assistant, who very familiar with database related knowledge.
|
||||||
|
The assistant gives helpful, detailed, professional and polite answers to the user's questions. """
|
||||||
|
|
||||||
|
|
||||||
_DEFAULT_TEMPLATE = """ 基于以下已知的信息, 专业、简要的回答用户的问题,
|
_DEFAULT_TEMPLATE = """ 基于以下已知的信息, 专业、简要的回答用户的问题,
|
||||||
如果无法从提供的内容中获取答案, 请说: "知识库中提供的内容不足以回答此问题" 禁止胡乱编造。
|
如果无法从提供的内容中获取答案, 请说: "知识库中提供的内容不足以回答此问题" 禁止胡乱编造。
|
||||||
已知内容:
|
已知内容:
|
||||||
@ -28,7 +32,7 @@ prompt = PromptTemplate(
|
|||||||
template_scene=ChatScene.ChatKnowledge.value,
|
template_scene=ChatScene.ChatKnowledge.value,
|
||||||
input_variables=["context", "question"],
|
input_variables=["context", "question"],
|
||||||
response_format=None,
|
response_format=None,
|
||||||
template_define=None,
|
template_define=PROMPT_SCENE_DEFINE,
|
||||||
template=_DEFAULT_TEMPLATE,
|
template=_DEFAULT_TEMPLATE,
|
||||||
stream_out=PROMPT_NEED_NEED_STREAM_OUT,
|
stream_out=PROMPT_NEED_NEED_STREAM_OUT,
|
||||||
output_parser=NormalChatOutputParser(
|
output_parser=NormalChatOutputParser(
|
||||||
|
@ -11,10 +11,21 @@ from pilot.scene.chat_normal.out_parser import NormalChatOutputParser
|
|||||||
|
|
||||||
CFG = Config()
|
CFG = Config()
|
||||||
|
|
||||||
_DEFAULT_TEMPLATE = """ Based on the known information, provide professional and concise answers to the user's questions. If the answer cannot be obtained from the provided content, please say: 'The information provided in the knowledge base is not sufficient to answer this question.' Fabrication is prohibited.。
|
PROMPT_SCENE_DEFINE = """A chat between a curious user and an artificial intelligence assistant, who very familiar with database related knowledge.
|
||||||
known information:
|
The assistant gives helpful, detailed, professional and polite answers to the user's questions. """
|
||||||
|
|
||||||
|
|
||||||
|
# _DEFAULT_TEMPLATE = """ Based on the known information, provide professional and concise answers to the user's questions. If the answer cannot be obtained from the provided content, please say: 'The information provided in the knowledge base is not sufficient to answer this question.' Fabrication is prohibited.。
|
||||||
|
# known information:
|
||||||
|
# {context}
|
||||||
|
# question:
|
||||||
|
# {question}
|
||||||
|
# """
|
||||||
|
_DEFAULT_TEMPLATE = """ 基于以下已知的信息, 专业、简要的回答用户的问题,
|
||||||
|
如果无法从提供的内容中获取答案, 请说: "知识库中提供的内容不足以回答此问题" 禁止胡乱编造。
|
||||||
|
已知内容:
|
||||||
{context}
|
{context}
|
||||||
question:
|
问题:
|
||||||
{question}
|
{question}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -27,7 +38,7 @@ prompt = PromptTemplate(
|
|||||||
template_scene=ChatScene.ChatUrlKnowledge.value,
|
template_scene=ChatScene.ChatUrlKnowledge.value,
|
||||||
input_variables=["context", "question"],
|
input_variables=["context", "question"],
|
||||||
response_format=None,
|
response_format=None,
|
||||||
template_define=None,
|
template_define=PROMPT_SCENE_DEFINE,
|
||||||
template=_DEFAULT_TEMPLATE,
|
template=_DEFAULT_TEMPLATE,
|
||||||
stream_out=PROMPT_NEED_NEED_STREAM_OUT,
|
stream_out=PROMPT_NEED_NEED_STREAM_OUT,
|
||||||
output_parser=NormalChatOutputParser(
|
output_parser=NormalChatOutputParser(
|
||||||
|
@ -23,7 +23,7 @@ class URLEmbedding(SourceEmbedding):
|
|||||||
"""Load from url path."""
|
"""Load from url path."""
|
||||||
loader = WebBaseLoader(web_path=self.file_path)
|
loader = WebBaseLoader(web_path=self.file_path)
|
||||||
text_splitor = CharacterTextSplitter(
|
text_splitor = CharacterTextSplitter(
|
||||||
chunk_size=1000, chunk_overlap=20, length_function=len
|
chunk_size=100, chunk_overlap=20, length_function=len
|
||||||
)
|
)
|
||||||
return loader.load_and_split(text_splitor)
|
return loader.load_and_split(text_splitor)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user