Spaces:
				
			
			
	
			
			
		Sleeping
		
	
	
	
			
			
	
	
	
	
		
		
		Sleeping
		
	Update agent.py
Browse files
    	
        agent.py
    CHANGED
    
    | @@ -97,6 +97,7 @@ def modulus(a: int, b: int) -> int: | |
| 97 | 
             
                """
         | 
| 98 | 
             
                return a % b
         | 
| 99 |  | 
|  | |
| 100 | 
             
            @tool
         | 
| 101 | 
             
            def wiki_search(query: str) -> str:
         | 
| 102 | 
             
                """Search Wikipedia for a query and return maximum 2 results.
         | 
| @@ -111,6 +112,22 @@ def wiki_search(query: str) -> str: | |
| 111 | 
             
                    ])
         | 
| 112 | 
             
                return {"wiki_results": formatted_search_docs}
         | 
| 113 |  | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 114 | 
             
            @tool
         | 
| 115 | 
             
            def web_search(query: str) -> str:
         | 
| 116 | 
             
                """Search Tavily for a query and return maximum 3 results.
         | 
| @@ -260,6 +277,7 @@ tool_map = { | |
| 260 | 
             
                "get_youtube_transcript": get_youtube_transcript,
         | 
| 261 | 
             
                "extract_video_id": extract_video_id,
         | 
| 262 | 
             
                "analyze_attachment": analyze_attachment,
         | 
|  | |
| 263 |  | 
| 264 | 
             
            }
         | 
| 265 |  | 
|  | |
| 97 | 
             
                """
         | 
| 98 | 
             
                return a % b
         | 
| 99 |  | 
| 100 | 
            +
             | 
| 101 | 
             
            @tool
         | 
| 102 | 
             
            def wiki_search(query: str) -> str:
         | 
| 103 | 
             
                """Search Wikipedia for a query and return maximum 2 results.
         | 
|  | |
| 112 | 
             
                    ])
         | 
| 113 | 
             
                return {"wiki_results": formatted_search_docs}
         | 
| 114 |  | 
| 115 | 
            +
             | 
| 116 | 
            +
                
         | 
| 117 | 
            +
            @tool
         | 
| 118 | 
            +
            def wikidata_query(query: str) -> str:
         | 
| 119 | 
            +
                """
         | 
| 120 | 
            +
                Run a SPARQL query on Wikidata and return results.
         | 
| 121 | 
            +
                """
         | 
| 122 | 
            +
                endpoint_url = "https://query.wikidata.org/sparql"
         | 
| 123 | 
            +
                headers = {
         | 
| 124 | 
            +
                    "Accept": "application/sparql-results+json"
         | 
| 125 | 
            +
                }
         | 
| 126 | 
            +
                response = requests.get(endpoint_url, headers=headers, params={"query": query})
         | 
| 127 | 
            +
                data = response.json()
         | 
| 128 | 
            +
                return json.dumps(data, indent=2)
         | 
| 129 | 
            +
             | 
| 130 | 
            +
             | 
| 131 | 
             
            @tool
         | 
| 132 | 
             
            def web_search(query: str) -> str:
         | 
| 133 | 
             
                """Search Tavily for a query and return maximum 3 results.
         | 
|  | |
| 277 | 
             
                "get_youtube_transcript": get_youtube_transcript,
         | 
| 278 | 
             
                "extract_video_id": extract_video_id,
         | 
| 279 | 
             
                "analyze_attachment": analyze_attachment,
         | 
| 280 | 
            +
                "wikidata_query": wikidata_query
         | 
| 281 |  | 
| 282 | 
             
            }
         | 
| 283 |  | 
