Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -21,15 +21,19 @@ llm = ChatGoogleGenerativeAI(model="gemini-pro",
|
|
21 |
|
22 |
|
23 |
|
24 |
-
template = """You are a friendly chatbot
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
{
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
|
|
33 |
|
34 |
|
35 |
prompt = PromptTemplate(
|
@@ -52,7 +56,7 @@ def conversational_chat(query):
|
|
52 |
global previous_response, provided_docs,extracted_text
|
53 |
for i in st.session_state['history']:
|
54 |
if i is not None:
|
55 |
-
previous_response += f"
|
56 |
provided_docs = "".join(st.session_state["docs"])
|
57 |
extracted_text = "".join(st.session_state["extracted_text"])
|
58 |
|
|
|
21 |
|
22 |
|
23 |
|
24 |
+
template = """You are Chatto, a friendly chatbot created by Suriya, an AI enthusiast. Your goal is to assist users by providing relevant information from both general knowledge and provided documents.
|
25 |
+
|
26 |
+
If the user asks about a specific document, try to use the extracted text from that document in your response. If the question is not related to any specific document, rely on your general knowledge. If the user asks about a link, respond with the extracted text from that link.
|
27 |
+
|
28 |
+
Conversation Context:
|
29 |
+
Chat History: {chat_history}
|
30 |
+
Provided Documents: {provided_docs}
|
31 |
+
Extracted Text from Links: {extracted_text}
|
32 |
+
User Input: {user_input}
|
33 |
+
|
34 |
+
User: {user_question}
|
35 |
+
Chatto:
|
36 |
+
"""
|
37 |
|
38 |
|
39 |
prompt = PromptTemplate(
|
|
|
56 |
global previous_response, provided_docs,extracted_text
|
57 |
for i in st.session_state['history']:
|
58 |
if i is not None:
|
59 |
+
previous_response += f"User: {i[0]}\n Chatto: {i[1]}\n"
|
60 |
provided_docs = "".join(st.session_state["docs"])
|
61 |
extracted_text = "".join(st.session_state["extracted_text"])
|
62 |
|