Spaces:
Sleeping
Sleeping
Update chatbot/core.py
Browse files- 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"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
|