Update utils.py
Browse files
utils.py
CHANGED
@@ -464,6 +464,21 @@ def rag_chain(llm, prompt, retriever):
|
|
464 |
return result
|
465 |
|
466 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
467 |
# Funktion zum Erstellen der Liste von Dictionaries
|
468 |
def extract_document_info(documents):
|
469 |
extracted_info = []
|
@@ -477,7 +492,7 @@ def extract_document_info(documents):
|
|
477 |
}
|
478 |
extracted_info.append(info)
|
479 |
return extracted_info
|
480 |
-
|
481 |
|
482 |
|
483 |
|
|
|
464 |
return result
|
465 |
|
466 |
|
467 |
+
def extract_document_info(documents):
|
468 |
+
extracted_info = []
|
469 |
+
for doc in documents:
|
470 |
+
info = {
|
471 |
+
'content': doc.page_content,
|
472 |
+
'metadata': doc.metadata,
|
473 |
+
'titel': doc.metadata.get("title", "Keine Überschrift"),
|
474 |
+
'seite': doc.metadata.get("page", "Unbekannte Seite"),
|
475 |
+
'pfad': doc.metadata.get("path", "Kein Pfad verfügbar")
|
476 |
+
}
|
477 |
+
extracted_info.append(info)
|
478 |
+
return extracted_info
|
479 |
+
|
480 |
+
|
481 |
+
"""
|
482 |
# Funktion zum Erstellen der Liste von Dictionaries
|
483 |
def extract_document_info(documents):
|
484 |
extracted_info = []
|
|
|
492 |
}
|
493 |
extracted_info.append(info)
|
494 |
return extracted_info
|
495 |
+
"""
|
496 |
|
497 |
|
498 |
|