SearxngSearchTool - AG2
SearxngSearchTool
autogen.tools.experimental.SearxngSearchTool
SearxngSearchTool(base_url='https://searxng.site/search')
Bases: Tool
SearxngSearchTool is a tool that uses SearxNG to perform a search.
This tool allows agents to leverage the SearxNG search engine for information retrieval. SearxNG does not require an API key by default, making it easy to use.
Initializes the SearxngSearchTool.
| PARAMETER | DESCRIPTION |
|---|---|
base_url |
The SearxNG instance URL. TYPE: str DEFAULT: 'https://searxng.site/search' |
Source code in autogen/tools/experimental/searxng/searxng_search.py
| --- | --- |
| ``` | ``` |
name property
name
description property
description
func property
func
tool_schema property
tool_schema
Get the schema for the tool.
This is the preferred way of handling function calls with OpenAI and compatible frameworks.
function_schema property
function_schema
Get the schema for the function.
This is the old way of handling function calls with OpenAI and compatible frameworks. It is provided for backward compatibility.
realtime_tool_schema property
realtime_tool_schema
Get the schema for the tool.
This is the preferred way of handling function calls with OpenAI and compatible frameworks.
base_url instance-attribute
base_url = base_url
register_for_llm
register_for_llm(agent)
Registers the tool for use with a ConversableAgent's language model (LLM).
This method registers the tool so that it can be invoked by the agent during interactions with the language model.
| PARAMETER | DESCRIPTION |
|---|---|
agent |
The agent to which the tool will be registered. TYPE: ConversableAgent |
Source code in autogen/tools/tool.py
| --- | --- |
| ``` | ``` |
register_for_execution
register_for_execution(agent)
Registers the tool for direct execution by a ConversableAgent.
This method registers the tool so that it can be executed by the agent, typically outside of the context of an LLM interaction.
Source code in autogen/tools/tool.py
| --- | --- |
| ``` | ``` |
register_tool
register_tool(agent)
Register a tool to be both proposed and executed by an agent.
Equivalent to calling both register_for_llm and register_for_execution with the same agent.
Note: This will not make the agent recommend and execute the call in the one step. If the agent recommends the tool, it will need to be the next agent to speak in order to execute the tool.
Source code in autogen/tools/tool.py
| --- | --- |
| ``` | ``` |
searxng_search
searxng_search(query, max_results=5, categories=None, language=None)
Performs a search using the SearxNG API and returns formatted results.
| PARAMETER | DESCRIPTION |
|---|---|
query |
The search query string. TYPE: str |
max_results |
The maximum number of results to return. Defaults to 5. TYPE: int DEFAULT: 5 |
categories |
List of categories to search in. TYPE: `list[str] |
language |
Language code. TYPE: `str |
| RETURNS | DESCRIPTION |
|---|---|
list[dict[str, Any]] |
A list of dictionaries, each containing 'title', 'link', and 'snippet' of a search result. |
Source code in autogen/tools/experimental/searxng/searxng_search.py
| --- | --- |
| ``` | ``` |