Spaces:
Running
Running
Update bin_public/app/llama_func.py
Browse files
bin_public/app/llama_func.py
CHANGED
@@ -124,7 +124,6 @@ def chat_ai(
|
|
124 |
question,
|
125 |
context,
|
126 |
chatbot,
|
127 |
-
reply_language,
|
128 |
):
|
129 |
os.environ["OPENAI_API_KEY"] = api_key
|
130 |
|
@@ -139,7 +138,6 @@ def chat_ai(
|
|
139 |
SIM_K,
|
140 |
1.0,
|
141 |
context,
|
142 |
-
reply_language,
|
143 |
)
|
144 |
if response is None:
|
145 |
status_text = "查询失败,请换个问法试试"
|
@@ -163,7 +161,6 @@ def ask_ai(
|
|
163 |
sim_k=5,
|
164 |
temprature=0,
|
165 |
prefix_messages=[],
|
166 |
-
reply_language="中文",
|
167 |
):
|
168 |
os.environ["OPENAI_API_KEY"] = api_key
|
169 |
|
@@ -178,13 +175,13 @@ def ask_ai(
|
|
178 |
)
|
179 |
|
180 |
response = None # Initialize response variable to avoid UnboundLocalError
|
181 |
-
qa_prompt = QuestionAnswerPrompt(prompt_tmpl.replace("{reply_language}", reply_language))
|
182 |
-
rf_prompt = RefinePrompt(refine_tmpl.replace("{reply_language}", reply_language))
|
183 |
response = index.query(
|
184 |
question,
|
185 |
similarity_top_k=sim_k,
|
186 |
-
text_qa_template=qa_prompt,
|
187 |
-
refine_template=rf_prompt,
|
188 |
response_mode="compact",
|
189 |
)
|
190 |
|
|
|
124 |
question,
|
125 |
context,
|
126 |
chatbot,
|
|
|
127 |
):
|
128 |
os.environ["OPENAI_API_KEY"] = api_key
|
129 |
|
|
|
138 |
SIM_K,
|
139 |
1.0,
|
140 |
context,
|
|
|
141 |
)
|
142 |
if response is None:
|
143 |
status_text = "查询失败,请换个问法试试"
|
|
|
161 |
sim_k=5,
|
162 |
temprature=0,
|
163 |
prefix_messages=[],
|
|
|
164 |
):
|
165 |
os.environ["OPENAI_API_KEY"] = api_key
|
166 |
|
|
|
175 |
)
|
176 |
|
177 |
response = None # Initialize response variable to avoid UnboundLocalError
|
178 |
+
#qa_prompt = QuestionAnswerPrompt(prompt_tmpl.replace("{reply_language}", reply_language))
|
179 |
+
#rf_prompt = RefinePrompt(refine_tmpl.replace("{reply_language}", reply_language))
|
180 |
response = index.query(
|
181 |
question,
|
182 |
similarity_top_k=sim_k,
|
183 |
+
#text_qa_template=qa_prompt,
|
184 |
+
#refine_template=rf_prompt,
|
185 |
response_mode="compact",
|
186 |
)
|
187 |
|