Spaces:
Sleeping
Sleeping
Create Load and Prepare the Dataset
Browse files- Load and Prepare the Dataset +19 -0
Load and Prepare the Dataset
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import datasets
|
2 |
+
from langchain.docstore.document import Document
|
3 |
+
|
4 |
+
# Load the dataset
|
5 |
+
guest_dataset = datasets.load_dataset("agents-course/unit3-invitees", split="train")
|
6 |
+
|
7 |
+
# Convert dataset entries into Document objects
|
8 |
+
docs = [
|
9 |
+
Document(
|
10 |
+
page_content="\n".join([
|
11 |
+
f"Name: {guest['name']}",
|
12 |
+
f"Relation: {guest['relation']}",
|
13 |
+
f"Description: {guest['description']}",
|
14 |
+
f"Email: {guest['email']}"
|
15 |
+
]),
|
16 |
+
metadata={"name": guest["name"]}
|
17 |
+
)
|
18 |
+
for guest in guest_dataset
|
19 |
+
]
|