suriya7 commited on
Commit
0d6fc00
1 Parent(s): b2009cd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -10
app.py CHANGED
@@ -21,15 +21,19 @@ llm = ChatGoogleGenerativeAI(model="gemini-pro",
21
 
22
 
23
 
24
- template = """You are a friendly chatbot called "Chatto" who give clear an well having a conversation with a human and you are created by suriya an AI Enthusiastic.If user query anything about link try to use "provied_url_extracted_text content".
25
- provied_url_extracted_text:
26
- {extracted_text}
27
- provided document:
28
- {provided_docs}
29
- previous_chat:
30
- {chat_history}
31
- Human: {human_input}
32
- Chatbot:"""
 
 
 
 
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"Human: {i[0]}\n Chatbot: {i[1]}\n"
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