Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -55,11 +55,16 @@ def respond(
|
|
| 55 |
temperature,
|
| 56 |
top_p,
|
| 57 |
):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
# Use the RAG model to retrieve relevant context and answer the question
|
| 59 |
response = chain.invoke({"input": message})
|
| 60 |
|
| 61 |
# Extract the answer from the response
|
| 62 |
-
answer = response['answer']
|
| 63 |
|
| 64 |
# Ensure that the answer is a string
|
| 65 |
if isinstance(answer, list):
|
|
|
|
| 55 |
temperature,
|
| 56 |
top_p,
|
| 57 |
):
|
| 58 |
+
# Check if message is a list and convert it to the first element as a string
|
| 59 |
+
if isinstance(message, list):
|
| 60 |
+
message = str(message[0]) # Convert the first element to a string
|
| 61 |
+
|
| 62 |
+
|
| 63 |
# Use the RAG model to retrieve relevant context and answer the question
|
| 64 |
response = chain.invoke({"input": message})
|
| 65 |
|
| 66 |
# Extract the answer from the response
|
| 67 |
+
answer = str(response['answer'])
|
| 68 |
|
| 69 |
# Ensure that the answer is a string
|
| 70 |
if isinstance(answer, list):
|