# Import dependencies import os import gradio as gr from llama_index import GPTVectorStoreIndex from langchain.prompts.prompt import PromptTemplate from langchain.llms import OpenAI from langchain.chains import ChatVectorDBChain from query_data import get_chain from response import get_response _template = """Paraphrase the message and encourage to share more""" PARAPHRASE_MESSAGE_PROMPT= PromptTemplate.from_template(_template) template = """You are an AI psychotherapist. You are empathic and encourage humans to share. If asked for information, provide it and then gently inquire if they want to talk about it. If you don't know the answer, just say "Hmm, I'm not sure." Don't try to make up an answer. If the question is not about mental health or resources, politely inform them that you are tuned to only answer questions about mental health and well being.""" def respond(message, chat_history): bot_message = ["How are you?"] chat_history.append((message, bot_message)) return "", chat_history msg.submit(respond, [msg, chatbot], [msg, chatbot]) # Execute the chat functionality. # output = chain({"message": inp, "chat_history": history})["response"] # history.append((inp, output)) # return history block = gr.Blocks(css=".gradio-container {background-color: lightblue}") with block: chatbot = gr.Chatbot() gr.HTML("