Spaces:
Sleeping
Sleeping
Update retriever.py
Browse files- retriever.py +9 -4
retriever.py
CHANGED
|
@@ -54,19 +54,24 @@ def load_guest_dataset():
|
|
| 54 |
List of Document objects containing guest information
|
| 55 |
"""
|
| 56 |
# Load the dataset from Hugging Face Hub
|
| 57 |
-
# This dataset contains information about fictional gala guests
|
| 58 |
guest_dataset = datasets.load_dataset(
|
| 59 |
"agents-course/unit3-invitees",
|
| 60 |
split="train"
|
| 61 |
)
|
| 62 |
|
| 63 |
# Convert to Document objects for the retriever
|
|
|
|
| 64 |
docs = [
|
| 65 |
Document(
|
| 66 |
-
page_content=
|
| 67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
)
|
| 69 |
-
for
|
| 70 |
]
|
| 71 |
|
| 72 |
return docs
|
|
|
|
| 54 |
List of Document objects containing guest information
|
| 55 |
"""
|
| 56 |
# Load the dataset from Hugging Face Hub
|
|
|
|
| 57 |
guest_dataset = datasets.load_dataset(
|
| 58 |
"agents-course/unit3-invitees",
|
| 59 |
split="train"
|
| 60 |
)
|
| 61 |
|
| 62 |
# Convert to Document objects for the retriever
|
| 63 |
+
# Dataset has fields: name, relation, description, email
|
| 64 |
docs = [
|
| 65 |
Document(
|
| 66 |
+
page_content="\n".join([
|
| 67 |
+
f"Name: {guest['name']}",
|
| 68 |
+
f"Relation: {guest['relation']}",
|
| 69 |
+
f"Description: {guest['description']}",
|
| 70 |
+
f"Email: {guest['email']}"
|
| 71 |
+
]),
|
| 72 |
+
metadata={"name": guest["name"]}
|
| 73 |
)
|
| 74 |
+
for guest in guest_dataset
|
| 75 |
]
|
| 76 |
|
| 77 |
return docs
|