Update app.py
Browse files
app.py
CHANGED
|
@@ -1,33 +1,19 @@
|
|
| 1 |
-
import
|
| 2 |
-
import
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
# Load the guest dataset and initialize the guest info tool
|
| 22 |
-
guest_info_tool = load_guest_dataset()
|
| 23 |
-
|
| 24 |
-
# Create Alfred with all the tools
|
| 25 |
-
alfred = CodeAgent(
|
| 26 |
-
tools=[guest_info_tool, weather_info_tool, hub_stats_tool, search_tool],
|
| 27 |
-
model=model,
|
| 28 |
-
add_base_tools=True, # Add any additional base tools
|
| 29 |
-
planning_interval=3 # Enable planning every 3 steps
|
| 30 |
-
)
|
| 31 |
-
|
| 32 |
-
if __name__ == "__main__":
|
| 33 |
-
GradioUI(alfred).launch()
|
|
|
|
| 1 |
+
import datasets
|
| 2 |
+
from langchain_core.documents 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 |
+
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|