patti-j commited on
Commit
232bfe2
1 Parent(s): fa8dfd1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -1
app.py CHANGED
@@ -2,12 +2,27 @@
2
  import os
3
  import gradio as gr
4
  from llama_index import GPTVectorStoreIndex
 
 
 
5
 
6
  # from query_data import get_chain
7
  # from response import get_response
8
 
9
- openai_api_key = os.getenv('OPENAI_API_KEY')
 
 
 
 
 
10
 
 
 
 
 
 
 
 
11
 
12
  class ChatWrapper:
13
 
 
2
  import os
3
  import gradio as gr
4
  from llama_index import GPTVectorStoreIndex
5
+ from langchain.prompts.prompt import PromptTemplate
6
+ from langchain.llms import OpenAI
7
+ from langchain.chains import ChatVectorDBChain
8
 
9
  # from query_data import get_chain
10
  # from response import get_response
11
 
12
+ _template = """Given the following conversation and a follow up question, rephrase the follow up question to be a standalone question.
13
+ Chat History:
14
+ {chat_history}
15
+ Follow Up Input: {question}
16
+ Standalone question:"""
17
+ CONDENSE_QUESTION_PROMPT = PromptTemplate.from_template(_template)
18
 
19
+ template = """You are an AI psychotherapist for answering questions about various mental health conditions.
20
+ You are given the following extracted parts of a long document and a question. Provide a conversational answer.
21
+ If you don't know the answer, just say "Hmm, I'm not sure." Don't try to make up an answer.
22
+ If the question is not about mental health or resources , politely inform them that you are tuned to only answer questions about mental health
23
+ and well being."""
24
+
25
+ Question: {question}
26
 
27
  class ChatWrapper:
28