Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,7 +19,7 @@ from langchain.schema import AIMessage, HumanMessage, SystemMessage
|
|
| 19 |
embeddings = OpenAIEmbeddings()
|
| 20 |
|
| 21 |
# Loads database from persisted directory
|
| 22 |
-
db_directory = "./docs/
|
| 23 |
db = Chroma(persist_directory=db_directory, embedding_function=embeddings)
|
| 24 |
|
| 25 |
# This is code that retrieves relevant documents based on a similarity search (in this case, it grabs the top 2 relevant documents or chunks)
|
|
@@ -74,11 +74,11 @@ def predict(history, input):
|
|
| 74 |
global is_first_run # Use the global flag
|
| 75 |
if is_first_run:
|
| 76 |
context = get_full_context(input)
|
| 77 |
-
print(context) # For debugging
|
| 78 |
is_first_run = False # Set the flag to False after the first run
|
| 79 |
else:
|
| 80 |
context = ""
|
| 81 |
-
|
| 82 |
history_langchain_format = []
|
| 83 |
history_langchain_format.append(SystemMessage(content=f"{ORIG_SYSTEM_MESSAGE_PROMPT}, here is the user information: {user_info_simulated}"))
|
| 84 |
for human, ai in history:
|
|
|
|
| 19 |
embeddings = OpenAIEmbeddings()
|
| 20 |
|
| 21 |
# Loads database from persisted directory
|
| 22 |
+
db_directory = "./docs/2023_12_05_chroma_db_v2"
|
| 23 |
db = Chroma(persist_directory=db_directory, embedding_function=embeddings)
|
| 24 |
|
| 25 |
# This is code that retrieves relevant documents based on a similarity search (in this case, it grabs the top 2 relevant documents or chunks)
|
|
|
|
| 74 |
global is_first_run # Use the global flag
|
| 75 |
if is_first_run:
|
| 76 |
context = get_full_context(input)
|
| 77 |
+
print(f"Context is as follows: {context}") # For debugging
|
| 78 |
is_first_run = False # Set the flag to False after the first run
|
| 79 |
else:
|
| 80 |
context = ""
|
| 81 |
+
|
| 82 |
history_langchain_format = []
|
| 83 |
history_langchain_format.append(SystemMessage(content=f"{ORIG_SYSTEM_MESSAGE_PROMPT}, here is the user information: {user_info_simulated}"))
|
| 84 |
for human, ai in history:
|