gkmgarcia commited on
Commit
f2b264f
·
verified ·
1 Parent(s): 8507438

Update tools.py

Browse files
Files changed (1) hide show
  1. tools.py +23 -0
tools.py CHANGED
@@ -1,3 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  from smolagents import DuckDuckGoSearchTool
2
  from smolagents import Tool
3
  import random
@@ -54,3 +76,4 @@ class HubStatsTool(Tool):
54
  except Exception as e:
55
  return f"Error fetching models for {author}: {str(e)}"
56
 
 
 
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
+ ]
20
+
21
+
22
+ '''
23
  from smolagents import DuckDuckGoSearchTool
24
  from smolagents import Tool
25
  import random
 
76
  except Exception as e:
77
  return f"Error fetching models for {author}: {str(e)}"
78
 
79
+ '''