added prompt
Browse files
app.py
CHANGED
|
@@ -81,10 +81,23 @@ llm = TogetherLLM(
|
|
| 81 |
temperature = 0.1,
|
| 82 |
max_tokens = 1024)
|
| 83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
# chain
|
| 85 |
chain = load_qa_chain(llm=llm, chain_type="stuff")
|
| 86 |
query1= "what is this story about?"
|
| 87 |
-
chain.run(input_documents=documents, question=query1)
|
| 88 |
|
| 89 |
|
| 90 |
# gradio
|
|
@@ -101,7 +114,7 @@ def greet(query1,history):
|
|
| 101 |
if query1.lower() in list_greet:
|
| 102 |
return "Hello. How can I assist you today?"
|
| 103 |
else:
|
| 104 |
-
return chain.run(input_documents=documents, question=
|
| 105 |
except:
|
| 106 |
return "API error"
|
| 107 |
|
|
|
|
| 81 |
temperature = 0.1,
|
| 82 |
max_tokens = 1024)
|
| 83 |
|
| 84 |
+
#prompt
|
| 85 |
+
def prompt_add(question):
|
| 86 |
+
prompt = f"""
|
| 87 |
+
this data is about my resume.
|
| 88 |
+
answer as if person responding. do not ask question back.
|
| 89 |
+
i have information about my education, work experience, skills, and contact information.
|
| 90 |
+
do not generate random response
|
| 91 |
+
always answer from give text context only.
|
| 92 |
+
if answer is not available respond, 'No information available'
|
| 93 |
+
Answer to given question: {question}
|
| 94 |
+
"""
|
| 95 |
+
return prompt
|
| 96 |
+
|
| 97 |
# chain
|
| 98 |
chain = load_qa_chain(llm=llm, chain_type="stuff")
|
| 99 |
query1= "what is this story about?"
|
| 100 |
+
chain.run(input_documents=documents, question=prompt_add(query1))
|
| 101 |
|
| 102 |
|
| 103 |
# gradio
|
|
|
|
| 114 |
if query1.lower() in list_greet:
|
| 115 |
return "Hello. How can I assist you today?"
|
| 116 |
else:
|
| 117 |
+
return chain.run(input_documents=documents, question= prompt_add(query1).lower())
|
| 118 |
except:
|
| 119 |
return "API error"
|
| 120 |
|