WebSearchPreviewTool
autogen.tools.experimental.WebSearchPreviewTool #
WebSearchPreviewTool(*, llm_config, search_context_size='medium', user_location=None, instructions=None, text_format=None)
Bases: Tool
WebSearchPreviewTool is a tool that uses OpenAI's web_search_preview tool to perform a search.
Initialize the WebSearchPreviewTool.
| PARAMETER | DESCRIPTION |
|---|---|
llm_config | The LLM configuration to use. This should be a dictionary containing the model name and other parameters. |
search_context_size | The size of the search context. One of TYPE: |
user_location | The location of the user. This should be a dictionary containing the city, country, region, and timezone. |
instructions | Inserts a system (or developer) message as the first item in the model's context. TYPE: |
text_format | The format of the text to be returned. This should be a subclass of TYPE: |
Source code in autogen/tools/experimental/web_search_preview/web_search_preview.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | |
tool_schema property #
Get the schema for the tool.
This is the preferred way of handling function calls with OpeaAI and compatible frameworks.
function_schema property #
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 #
Get the schema for the tool.
This is the preferred way of handling function calls with OpeaAI and compatible frameworks.
web_search_tool_param instance-attribute #
web_search_tool_param = WebSearchToolParam(type='web_search_preview', search_context_size=search_context_size, user_location=UserLocation(**user_location) if user_location else None)
register_for_llm #
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: |
Source code in autogen/tools/tool.py
register_for_execution #
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.
| PARAMETER | DESCRIPTION |
|---|---|
agent | The agent to which the tool will be registered. TYPE: |
Source code in autogen/tools/tool.py
register_tool #
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.
| PARAMETER | DESCRIPTION |
|---|---|
agent | The agent to which the tool will be registered. TYPE: |