Jawad138 commited on
Commit
eb42771
·
verified ·
1 Parent(s): 938056b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -56,8 +56,9 @@ def display_chat_history(chain):
56
  def create_conversational_chain(vector_store):
57
  load_dotenv()
58
 
59
- replicate_api_token = "r8_MgTUrfPJIluDoXUhG7JXuPAYr6PonOW4BJCj0"
60
- os.environ["REPLICATE_API_TOKEN"] = replicate_api_token
 
61
 
62
  llm = Replicate(
63
  streaming=True,
@@ -69,8 +70,8 @@ def create_conversational_chain(vector_store):
69
  memory = ConversationBufferMemory(memory_key="chat_history", return_messages=True)
70
 
71
  chain = ConversationalRetrievalChain.from_llm(llm=llm, chain_type='stuff',
72
- retriever=vector_store.as_retriever(search_kwargs={"k": 2}),
73
- memory=memory)
74
  return chain
75
 
76
  def main():
 
56
  def create_conversational_chain(vector_store):
57
  load_dotenv()
58
 
59
+ replicate_api_token = os.getenv("REPLICATE_API_TOKEN")
60
+ if not replicate_api_token:
61
+ raise ValueError("Replicate API token is not set. Please set the REPLICATE_API_TOKEN environment variable.")
62
 
63
  llm = Replicate(
64
  streaming=True,
 
70
  memory = ConversationBufferMemory(memory_key="chat_history", return_messages=True)
71
 
72
  chain = ConversationalRetrievalChain.from_llm(llm=llm, chain_type='stuff',
73
+ retriever=vector_store.as_retriever(search_kwargs={"k": 2}),
74
+ memory=memory)
75
  return chain
76
 
77
  def main():