Amirizaniani commited on
Commit
f163cb3
1 Parent(s): 2626039

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -6,9 +6,9 @@ from sentence_transformers import SentenceTransformer
6
 
7
 
8
  def generate_prompts(user_input):
9
- prompt_template = PromptTemplate.from_template(
10
  input_variables=["Question"],
11
- template=f"Just list 10 quetion prompts for {user_input} and don't put number before each of the prompts."
12
  )
13
  config = {'max_new_tokens': 2048, 'temperature': 0.7, 'context_length': 4096}
14
  llm = CTransformers(model="TheBloke/Mistral-7B-Instruct-v0.1-GGUF",
@@ -17,11 +17,16 @@ def generate_prompts(user_input):
17
  hub_chain = LLMChain(prompt = prompt_template, llm = llm)
18
 
19
  input_data = {"Question": user_input}
20
-
 
 
21
  generated_prompts = hub_chain.run(input_data)
22
  questions_list = generated_prompts.split('\n')
 
 
23
  formatted_questions = "\n".join(f"Question: {question}" for i, question in enumerate(questions_list) if question.strip())
24
  questions_list = formatted_questions.split("Question:")[1:]
 
25
  return questions_list
26
 
27
  def answer_question(prompt):
 
6
 
7
 
8
  def generate_prompts(user_input):
9
+ prompt_template = PromptTemplate(
10
  input_variables=["Question"],
11
+ template= f"Your task is to formulate 5 unique queries for each given question. These queries must adhere to the criteria of relevance and diversity.write the questions in seperate lines.{user_input} "
12
  )
13
  config = {'max_new_tokens': 2048, 'temperature': 0.7, 'context_length': 4096}
14
  llm = CTransformers(model="TheBloke/Mistral-7B-Instruct-v0.1-GGUF",
 
17
  hub_chain = LLMChain(prompt = prompt_template, llm = llm)
18
 
19
  input_data = {"Question": user_input}
20
+
21
+ # Here you would integrate your prompt template with your model
22
+ # For demonstration, this is just a placeholder
23
  generated_prompts = hub_chain.run(input_data)
24
  questions_list = generated_prompts.split('\n')
25
+
26
+
27
  formatted_questions = "\n".join(f"Question: {question}" for i, question in enumerate(questions_list) if question.strip())
28
  questions_list = formatted_questions.split("Question:")[1:]
29
+
30
  return questions_list
31
 
32
  def answer_question(prompt):