Spaces:
Sleeping
Sleeping
Update tools.py
Browse filesAdded loading the dataset
tools.py
CHANGED
|
@@ -29,8 +29,17 @@ class GuestInfoRetrieverTool(Tool):
|
|
| 29 |
else:
|
| 30 |
return "No matching guest information found."
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
# Initialize the tool
|
| 33 |
-
|
| 34 |
|
| 35 |
|
| 36 |
|
|
|
|
| 29 |
else:
|
| 30 |
return "No matching guest information found."
|
| 31 |
|
| 32 |
+
from datasets import load_dataset
|
| 33 |
+
from langchain_core.documents import Document
|
| 34 |
+
|
| 35 |
+
# Load the dataset from Hugging Face
|
| 36 |
+
dataset = load_dataset("agents-course/unit3-invitees")["train"]
|
| 37 |
+
|
| 38 |
+
# Create Document objects from the "info" column
|
| 39 |
+
docs = [Document(page_content=row["info"]) for row in dataset]
|
| 40 |
+
|
| 41 |
# Initialize the tool
|
| 42 |
+
guest_info_tool = GuestInfoRetrieverTool(docs)
|
| 43 |
|
| 44 |
|
| 45 |
|