deeme commited on
Commit
8ee7966
·
verified ·
1 Parent(s): 6f36198

Upload free_ask_internet.py

Browse files
Files changed (1) hide show
  1. free_ask_internet.py +14 -4
free_ask_internet.py CHANGED
@@ -117,15 +117,25 @@ def gen_prompt(question,content_list, lang="zh-CN", context_length_limit=11000,d
117
 
118
  if len(ref_content) > 0:
119
  prompts = '''
120
- You are a large language AI assistant. You are given a user question, and please write clean, concise and accurate answer to the question. You will be given a set of related contexts to the question. Please use the context. Other than code and specific names and citations, your answer must be written in the same language as the question.
121
  Your answer must be correct, accurate and written by an expert using an unbiased and professional tone. Please limit to 1024 tokens. Do not give any information that is not related to the question, and do not repeat. Say "information is missing on" followed by the related topic, if the given context do not provide sufficient information.
 
 
122
  Here are the set of contexts:
123
- ''' + "\n\n" + "```"
 
 
 
 
 
 
 
 
124
  prompts = prompts + '''
125
  ```
126
- Above is the reference contexts. Remember, don't repeat the context word for word. Answer in ''' + answer_language + '''. If the response is lengthy, structure it in paragraphs and summarize where possible.
127
  Remember, don't blindly repeat the contexts verbatim. And here is the user question:
128
- ''' + question
129
 
130
  else:
131
  prompts = question
 
117
 
118
  if len(ref_content) > 0:
119
  prompts = '''
120
+ You are a large language AI assistant develop by nash_su. You are given a user question, and please write clean, concise and accurate answer to the question. You will be given a set of related contexts to the question. Please use the context to provide accurate information.
121
  Your answer must be correct, accurate and written by an expert using an unbiased and professional tone. Please limit to 1024 tokens. Do not give any information that is not related to the question, and do not repeat. Say "information is missing on" followed by the related topic, if the given context do not provide sufficient information.
122
+
123
+ Other than code and specific names, your answer must be written in the same language as the question.
124
  Here are the set of contexts:
125
+ ''' + "\n\n" + "```"
126
+ ref_index = 1
127
+
128
+ for ref_text in ref_content:
129
+ prompts = prompts + "\n\n" + " [Context {}] ".format(str(ref_index)) + ref_text
130
+ ref_index += 1
131
+
132
+ if len(prompts) >= limit_len:
133
+ prompts = prompts[0:limit_len]
134
  prompts = prompts + '''
135
  ```
136
+ Above is the reference contexts. Remember, don't repeat the context word for word. Answer in ''' + answer_language + '''. If the response is lengthy, structure it in paragraphs and summarize where possible. Don't mention the context numbers in your response.
137
  Remember, don't blindly repeat the contexts verbatim. And here is the user question:
138
+ ''' + question
139
 
140
  else:
141
  prompts = question