Skip to content

Commit

Permalink
added tenacity version to correct langchain-ai/langchain#22972
Browse files Browse the repository at this point in the history
  • Loading branch information
kappakpr committed Jun 18, 2024
1 parent f6bafc8 commit 05cf59d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
19 changes: 12 additions & 7 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from dotenv import load_dotenv
import os
load_dotenv()
from pathlib import Path

## load the GROQ And OpenAI API KEY
groq_api_key=os.getenv('GROQ_API_KEY')
Expand All @@ -29,7 +30,6 @@
{context}
<context>
Questions:{input}
"""
)

Expand All @@ -44,21 +44,26 @@ def vector_embedding():
st.session_state.final_documents=st.session_state.text_splitter.split_documents(st.session_state.docs[:20]) #splitting
st.session_state.vectors=FAISS.from_documents(st.session_state.final_documents,st.session_state.embeddings) #vector OpenAI embeddings

uploaded_file = st.file_uploader("Choose a file")
if uploaded_file is not None:
# # To read file as bytes:
# bytes_data = uploaded_file.getvalue()
# st.write(bytes_data)

# Save uploaded file to 'F:/tmp' folder.
save_folder = './us_census'
save_path = Path(save_folder, uploaded_file.name)
with open(save_path, mode='wb') as w:
w.write(uploaded_file.getvalue())



prompt1=st.text_input("Enter Your Question From Doduments")

prompt1=st.text_input("Enter Your Question From Documents")

if st.button("Documents Embedding"):
vector_embedding()
st.write("Vector Store DB Is Ready")

import time



if prompt1:
document_chain=create_stuff_documents_chain(llm,prompt)
retriever=st.session_state.vectors.as_retriever()
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ langchain_community
python-dotenv
pypdf
google-cloud-aiplatform>=1.38
tenacity<8.4.0
5 changes: 5 additions & 0 deletions tenacity_version_error.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
error when deploying to huggingface and streamlit

https://github.com/langchain-ai/langchain/issues/22972
Error : ModuleNotFoundError: No module named 'tenacity.asyncio'
resolution : tenacity just released 8.4.0, so just downgrading to 8.3.0 solves an issue.

0 comments on commit 05cf59d

Please sign in to comment.