(config)
| 100 | |
| 101 | |
| 102 | def build_tool(config) -> Tool: |
| 103 | |
| 104 | tool = Tool( |
| 105 | "google_serper", |
| 106 | "Look up for information from Serper.dev Google Search API", |
| 107 | name_for_model="google_serper", |
| 108 | description_for_model=( |
| 109 | "A low-cost Google Search API." |
| 110 | "Useful for when you need to answer questions about current events." |
| 111 | "Input should be a search query. Output is a JSON object of the query results" |
| 112 | ), |
| 113 | logo_url="https://your-app-url.com/.well-known/logo.png", |
| 114 | contact_email="hello@contact.com", |
| 115 | legal_info_url="hello@legal.com" |
| 116 | ) |
| 117 | api_wrapper = GoogleSerperAPIWrapper(config["subscription_key"]) |
| 118 | |
| 119 | @tool.get("/search_general") |
| 120 | def search_general(query : str): |
| 121 | """Run query through GoogleSearch and parse result.""" |
| 122 | return str(api_wrapper.run(query)) |
| 123 | |
| 124 | return tool |
nothing calls this directly
no test coverage detected