from stringdale.tools import google_search,wikipedia_search,run_python_code
Tools
Here are some example tools for LLM agents
google_search
Signature:
google_search(q: str, location: str = 'Austin, Texas', engine: str = 'google_scholar')
Search the web for information using various search engines.
This function performs web searches using the SerpAPI client, allowing access to information from different search engines including Google Scholar. Results include source information for verification.
Parameter | Type | Default | Description |
---|---|---|---|
q | <class ‘str’> | None | The search query string. |
location | <class ‘str’> | Austin, Texas | The location to use for localized search results.Defaults to ‘Austin, Texas’. |
engine | <class ‘str’> | google_scholar | The search engine to use. Defaults to ‘google_scholar’. |
:Returns: | dict | - | A dictionary containing the search results and metadata from the SerpAPI response. |
wikipedia_search
Signature:
wikipedia_search(q: str)
A tool to query wikipedia, useful when you need to find information about a specific topic or person that is well known. Useful when you dont have enough context to reason about how to answer the question.
Parameter | Type | Default | Description |
---|---|---|---|
q | <class ‘str’> | None | The query string to search for |
:Returns: | str | - | The wikipedia search results |
run_python_code
Signature:
run_python_code(code: str)
Execute python code, useful when you need to do a calculation or a simple task Input should be a valid python code. If you want to see the output of a variable, the last line of the code should be that variable name.
Parameter | Type | Default | Description |
---|---|---|---|
code | <class ‘str’> | None | Python code to execute |
:Returns: | str | - | Output from executing the code, either the value of the last line or the error message |
'''
run_python_code(x=2
x*3
''')
6