PerplexitySearchToolkit
autogen.beta.tools.search.perplexity.PerplexitySearchToolkit #
Bases: Toolkit
Toolkit that exposes the Perplexity search APIs as two related tools sharing one HTTP client.
The two tools mirror Perplexity's primary search endpoints: - perplexity_search: raw web search via the Search API - perplexity_answer: LLM-generated answer with citations via Sonar Chat Completions
By default, passing the whole toolkit to an agent registers both tools. To use a subset, or to customise per-tool parameters, call the factory methods directly and pass the returned tools to the agent::
toolkit = PerplexitySearchToolkit(api_key=...)
# both tools
agent = Agent("a", config=config, tools=[toolkit])
# only one, with custom parameters
agent = Agent(
"a",
config=config,
tools=[toolkit.search(max_results=5)],
)
The constructor reads PERPLEXITY_API_KEY from the environment when api_key is omitted (handled by the underlying perplexity.Perplexity SDK).
Source code in autogen/beta/tools/search/perplexity.py
search #
search(*, max_results=None, max_tokens_per_page=None, search_domain_filter=None, search_recency_filter=None, search_after_date_filter=None, search_before_date_filter=None, name='perplexity_search', description="Search the web with the Perplexity Search API. Returns ranked results with title, URL, snippet, and date. Supports domain allow/deny filters (prefix a domain with '-' to exclude it) and recency / date-range filters.", middleware=())
Source code in autogen/beta/tools/search/perplexity.py
answer #
answer(*, model=None, max_tokens=None, search_domain_filter=None, search_context_size=None, search_mode=None, search_recency_filter=None, return_images=None, return_related_questions=None, name='perplexity_answer', description='Ask Perplexity AI for an LLM-generated answer with web citations. Useful for conversational questions, in-depth research, and analysis. Returns content text plus ranked search results and citations.', middleware=())
Source code in autogen/beta/tools/search/perplexity.py
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | |
set_provider #
schemas async #
register #
tool #
tool(function=None, *, name=None, description=None, schema=None, sync_to_thread=True, middleware=())