anhkhoiphan commited on
Commit
b3960d9
verified
1 Parent(s): 4e5f2a6

Update chatbot/core.py

Browse files
Files changed (1) hide show
  1. chatbot/core.py +9 -1
chatbot/core.py CHANGED
@@ -9,7 +9,15 @@ from langchain.schema import BaseRetriever, Document
9
 
10
  def translate_to_english(text: str) -> str:
11
  """Use Gemini LLM to translate text to English."""
12
- prompt = f"Translate the following text to English:\n\n{text}"
 
 
 
 
 
 
 
 
13
  response = gemini_llm.invoke(prompt) # Invoke Gemini for translation
14
  return response # Assuming `gemini_llm.invoke()` returns plain text
15
 
 
9
 
10
  def translate_to_english(text: str) -> str:
11
  """Use Gemini LLM to translate text to English."""
12
+ prompt = f"""
13
+ You are an assistant for Wikipedia searches.
14
+ The query may be in any language.
15
+ Extract and return only the most relevant keyword (e.g. a person's name, city, or key term) in English/international form.
16
+ Return only the keyword鈥攏o explanations.
17
+
18
+ Query:
19
+ {text}
20
+ """
21
  response = gemini_llm.invoke(prompt) # Invoke Gemini for translation
22
  return response # Assuming `gemini_llm.invoke()` returns plain text
23