Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -143,14 +143,14 @@ Here are some documents that are relevant to the question.
|
|
143 |
{question}
|
144 |
```
|
145 |
"""
|
146 |
-
# Define the predict function
|
147 |
def predict(user_input, company):
|
148 |
filter = f"dataset/{company}-10-k-2023.pdf"
|
149 |
relevant_document_chunks = vectorstore_persisted.similarity_search(user_input, k=5, filter={"source": filter})
|
150 |
|
151 |
# Create context for query
|
152 |
context_list = [d.page_content for d in relevant_document_chunks]
|
153 |
-
context_for_query = ".".join(context_list)
|
154 |
|
155 |
# Create messages
|
156 |
prompt = [
|
@@ -172,9 +172,6 @@ def predict(user_input, company):
|
|
172 |
|
173 |
return prediction
|
174 |
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
examples = [
|
179 |
["What are the company's policies and frameworks regarding AI ethics, governance, and responsible AI use as detailed in their 10-K reports?", "AWS"],
|
180 |
["What are the primary business segments of the company, and how does each segment contribute to the overall revenue and profitability?", "AWS"],
|
|
|
143 |
{question}
|
144 |
```
|
145 |
"""
|
146 |
+
# Define the predict function
|
147 |
def predict(user_input, company):
|
148 |
filter = f"dataset/{company}-10-k-2023.pdf"
|
149 |
relevant_document_chunks = vectorstore_persisted.similarity_search(user_input, k=5, filter={"source": filter})
|
150 |
|
151 |
# Create context for query
|
152 |
context_list = [d.page_content for d in relevant_document_chunks]
|
153 |
+
context_for_query = ".".join(context_list) # Ensure this is inside the function
|
154 |
|
155 |
# Create messages
|
156 |
prompt = [
|
|
|
172 |
|
173 |
return prediction
|
174 |
|
|
|
|
|
|
|
175 |
examples = [
|
176 |
["What are the company's policies and frameworks regarding AI ethics, governance, and responsible AI use as detailed in their 10-K reports?", "AWS"],
|
177 |
["What are the primary business segments of the company, and how does each segment contribute to the overall revenue and profitability?", "AWS"],
|