Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 = "
|
60 |
-
|
|
|
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 |
-
|
73 |
-
|
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():
|