rnrahate007 commited on
Commit
2f893db
·
verified ·
1 Parent(s): ebb36cd

Create gaia_search.py

Browse files
Files changed (1) hide show
  1. tools/gaia_search.py +37 -0
tools/gaia_search.py ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from smolagents import tool
2
+
3
+ from gaia_loader import search_examples
4
+
5
+
6
+ @tool
7
+ def search_gaia_examples(query: str) -> str:
8
+ """
9
+ Search similar GAIA benchmark questions.
10
+
11
+ Args:
12
+ query: User question
13
+ """
14
+
15
+ docs = search_examples(query)
16
+
17
+ result = ""
18
+
19
+ for i, doc in enumerate(docs, 1):
20
+
21
+ result += f"""
22
+
23
+ ===========================
24
+
25
+ Example {i}
26
+
27
+ Question
28
+
29
+ {doc["question"]}
30
+
31
+ Reference Answer
32
+
33
+ {doc["answer"]}
34
+
35
+ """
36
+
37
+ return result