Skip to content

Commit

Permalink
Update app_faiss.py
Browse files Browse the repository at this point in the history
  • Loading branch information
tractorjuice authored Feb 6, 2024
1 parent 4f40440 commit 4474518
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions app_faiss.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@
DATA_STORE_DIR = "."

if "vector_store" not in st.session_state:
# If the user has provided an API key, use it
# Swap out openai for promptlayer
promptlayer.api_key = st.secrets["PROMPTLAYER"]
openai = promptlayer.openai
openai.api_key = user_openai_api_key

if os.path.exists(DATA_STORE_DIR):
st.session_state.vector_store = FAISS.load_local(
DATA_STORE_DIR,
Expand Down Expand Up @@ -73,12 +79,6 @@
HumanMessagePromptTemplate.from_template(custom_user_template)
]
prompt = ChatPromptTemplate.from_messages(prompt_messages)

# If the user has provided an API key, use it
# Swap out openai for promptlayer
promptlayer.api_key = st.secrets["PROMPTLAYER"]
openai = promptlayer.openai
openai.api_key = user_openai_api_key

if "memory" not in st.session_state:
st.session_state.memory = ConversationBufferWindowMemory(memory_key="chat_history", return_messages=True, output_key='answer')
Expand Down

0 comments on commit 4474518

Please sign in to comment.