Rams901 commited on
Commit
fd77360
1 Parent(s): 3997a11

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -21,7 +21,7 @@ from langchain.llms.base import LLM
21
  from typing import Optional, List, Mapping, Any
22
 
23
  import ast
24
- from utils import ClaudeLLM, extract_website_name, remove_numbers
25
 
26
  embeddings = HuggingFaceEmbeddings()
27
  db = FAISS.load_local('db_full', embeddings)
@@ -70,7 +70,7 @@ def retrieve_thoughts(query, ):
70
  tier_1_adjusted.sort_values("score", inplace = True)
71
  tier_1_adjusted['ref'] = range(1, len(tier_1_adjusted) + 1 )
72
 
73
- return {'tier 1':tier_1_adjusted[:12], 'tier 2': tier_2_adjusted.loc[:5]}
74
 
75
  def get_references(query):
76
  # TO-DO FINSIH UPP.
@@ -207,8 +207,8 @@ def qa_retrieve(query,):
207
  )
208
 
209
 
210
- # llm = BardLLM()
211
- chain = LLMChain(llm=llm_4, prompt = prompt)
212
 
213
  consensus = chain.run(query=query, articles="\n".join(tier_1), session_prompt = session_prompt,).strip()
214
 
@@ -259,7 +259,7 @@ def qa_intro(query, cynthesis, tier_1,):
259
  # llm = BardLLM()
260
  chain = LLMChain(llm=llm_4, prompt = prompt)
261
 
262
- intro = chain.run(query=query, articles="\n".join(tier_1))
263
  return intro.strip()
264
 
265
  def qa_conclusion(query, cynthesis, tier_1,):
@@ -294,7 +294,7 @@ def qa_conclusion(query, cynthesis, tier_1,):
294
  # llm = BardLLM()
295
  chain = LLMChain(llm=llm_4, prompt = prompt)
296
 
297
- conclusion = chain.run(query=query, articles="\n".join(tier_1), cynthesis = cynthesis)
298
  return conclusion.strip()
299
 
300
  def qa_faqs(query):
 
21
  from typing import Optional, List, Mapping, Any
22
 
23
  import ast
24
+ from utils import ClaudeLLM, ClaudeLLM2, extract_website_name, remove_numbers
25
 
26
  embeddings = HuggingFaceEmbeddings()
27
  db = FAISS.load_local('db_full', embeddings)
 
70
  tier_1_adjusted.sort_values("score", inplace = True)
71
  tier_1_adjusted['ref'] = range(1, len(tier_1_adjusted) + 1 )
72
 
73
+ return {'tier 1':tier_1_adjusted[:min(len(tier_1_adjusted), 100)], 'tier 2': tier_2_adjusted.loc[:5]}
74
 
75
  def get_references(query):
76
  # TO-DO FINSIH UPP.
 
207
  )
208
 
209
 
210
+ llm = ClaudeLLM2()
211
+ chain = LLMChain(llm=llm, prompt = prompt)
212
 
213
  consensus = chain.run(query=query, articles="\n".join(tier_1), session_prompt = session_prompt,).strip()
214
 
 
259
  # llm = BardLLM()
260
  chain = LLMChain(llm=llm_4, prompt = prompt)
261
 
262
+ intro = chain.run(query=query, articles="\n".join(tier_1[:15]))
263
  return intro.strip()
264
 
265
  def qa_conclusion(query, cynthesis, tier_1,):
 
294
  # llm = BardLLM()
295
  chain = LLMChain(llm=llm_4, prompt = prompt)
296
 
297
+ conclusion = chain.run(query=query, articles="\n".join(tier_1[:15]), cynthesis = cynthesis)
298
  return conclusion.strip()
299
 
300
  def qa_faqs(query):