Samarth991 commited on
Commit
de997fa
1 Parent(s): 5443811

Addind Chat functions to QA retrival chain

Browse files
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -61,10 +61,18 @@ def youtube_chat(youtube_link,API_key,llm='HuggingFace',temperature=0.1,max_toke
61
  global vector_db
62
  vector_db = FAISS.from_documents(documents=texts, embedding= embedding_model)
63
  global qa
64
- qa = RetrievalQA.from_chain_type(llm=chatops.chat_application(llm_service=llm,key=API_key,
65
- temperature=temperature,
66
- max_tokens=max_tokens
67
- ),
 
 
 
 
 
 
 
 
68
  chain_type='stuff',
69
  retriever=vector_db.as_retriever(),
70
  # chain_type_kwargs=chain_type_kwargs,
 
61
  global vector_db
62
  vector_db = FAISS.from_documents(documents=texts, embedding= embedding_model)
63
  global qa
64
+
65
+ if llm == 'HuggingFace':
66
+ chat = chatops.get_hugging_face_model(
67
+ model_id="tiiuae/falcon-7b-instruct",
68
+ key=API_key,
69
+ temperature=temperature,
70
+ max_tokens=max_tokens
71
+ )
72
+ else:
73
+ chat = chatops.get_openai_chat_model(API_key=API_key)
74
+
75
+ qa = RetrievalQA.from_chain_type(llm=chat,
76
  chain_type='stuff',
77
  retriever=vector_db.as_retriever(),
78
  # chain_type_kwargs=chain_type_kwargs,