devve1 commited on
Commit
a4d7c9d
1 Parent(s): b6bb6da

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -4
app.py CHANGED
@@ -20,7 +20,6 @@ from typing import List, Dict
20
  from ppt_chunker import ppt_chunk
21
  from outlines import models, generate
22
  from qdrant_client import QdrantClient
23
- from outlines.samplers import greedy
24
  from optimum_encoder import OptimumEncoder
25
  from unstructured.cleaners.core import clean
26
  from streamlit_navigation_bar import st_navbar
@@ -109,7 +108,6 @@ def query_hybrid_search(query: str, client: QdrantClient, collection_name: str,
109
 
110
  def build_prompt_conv():
111
  return f"""Generate a short, single-sentence summary of the user's intent or topic based on their question, capturing the main focus of what they want to discuss.
112
- Do not write 'Summary :' before the single-sentence.
113
 
114
  Question : {st.session_state.user_input}
115
  """
@@ -200,7 +198,7 @@ def main(query: str, client: QdrantClient, collection_name: str, llm, dense_mode
200
 
201
  gen_text = outlines.generate.text(llm)
202
 
203
- gen_choice = outlines.generate.choice(llm, choices=['Yes', 'No'], sampler=greedy())
204
  prompt = route_llm(context, 'Is the context relevant to the question ?')
205
  action = gen_choice(prompt, max_tokens=2, sampling_params=SamplingParams(temperature=0))
206
  print(f'Choice: {action}')
@@ -221,7 +219,7 @@ def main(query: str, client: QdrantClient, collection_name: str, llm, dense_mode
221
  if not st.session_state.documents_only:
222
  answer = f'Documents Based :\n\n{answer}'
223
  else:
224
- gen_choice = outlines.generate.choice(llm, choices=['Domain-Specific Question', 'General Question'], sampler=greedy())
225
  prompt = build_initial_prompt(query)
226
  action = gen_choice(prompt, max_tokens=3, sampling_params=SamplingParams(temperature=0))
227
  print(f'Choice 2: {action}')
 
20
  from ppt_chunker import ppt_chunk
21
  from outlines import models, generate
22
  from qdrant_client import QdrantClient
 
23
  from optimum_encoder import OptimumEncoder
24
  from unstructured.cleaners.core import clean
25
  from streamlit_navigation_bar import st_navbar
 
108
 
109
  def build_prompt_conv():
110
  return f"""Generate a short, single-sentence summary of the user's intent or topic based on their question, capturing the main focus of what they want to discuss.
 
111
 
112
  Question : {st.session_state.user_input}
113
  """
 
198
 
199
  gen_text = outlines.generate.text(llm)
200
 
201
+ gen_choice = outlines.generate.choice(llm, choices=['Yes', 'No'])
202
  prompt = route_llm(context, 'Is the context relevant to the question ?')
203
  action = gen_choice(prompt, max_tokens=2, sampling_params=SamplingParams(temperature=0))
204
  print(f'Choice: {action}')
 
219
  if not st.session_state.documents_only:
220
  answer = f'Documents Based :\n\n{answer}'
221
  else:
222
+ gen_choice = outlines.generate.choice(llm, choices=['Domain-Specific Question', 'General Question'])
223
  prompt = build_initial_prompt(query)
224
  action = gen_choice(prompt, max_tokens=3, sampling_params=SamplingParams(temperature=0))
225
  print(f'Choice 2: {action}')