Spaces:
Sleeping
Sleeping
arman77mxx
commited on
Commit
•
088dc12
1
Parent(s):
70b9f54
up
Browse files
app.py
CHANGED
@@ -70,7 +70,12 @@ if OPENAI_API_KEY:
|
|
70 |
|
71 |
# Definición del pipeline de procesamiento
|
72 |
def rag_pipeline(question):
|
73 |
-
|
|
|
|
|
|
|
|
|
|
|
74 |
context = "\n\n".join(doc.text for doc in context_docs)
|
75 |
prompt = f"Contexto:\n{context}\n\nPregunta: {question}\nRespuesta:"
|
76 |
response = llm(prompt)
|
|
|
70 |
|
71 |
# Definición del pipeline de procesamiento
|
72 |
def rag_pipeline(question):
|
73 |
+
response = query_engine.query(question)
|
74 |
+
if hasattr(response, 'documents'):
|
75 |
+
context_docs = response.documents
|
76 |
+
else:
|
77 |
+
context_docs = response # En caso de que response ya sea una lista de documentos
|
78 |
+
|
79 |
context = "\n\n".join(doc.text for doc in context_docs)
|
80 |
prompt = f"Contexto:\n{context}\n\nPregunta: {question}\nRespuesta:"
|
81 |
response = llm(prompt)
|