new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

AI SDK · Providers · all subjects

ai gateway/tools

11 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

AI Gateway Perplexity Search tool

Use gateway.tools.perplexitySearch() to enable models to search the web using Perplexity's search API. This tool is executed by the AI Gateway and returns web search results that the model can use. Works with both generateText and streamText.

AI Gateway Perplexity Search tool options

gateway.tools.perplexitySearch() accepts optional configuration: maxResults (number, 1-20, default: 10), maxTokensPerPage (number, 256-2048, default: 2048), maxTokens (number, default: 25000, max: 1000000), searchLanguageFilter (string[] using ISO 639-1 codes), country (string using ISO 3166-1 alpha-2 codes), searchDomainFilter (string[] of domains), searchRecencyFilter ('day' | 'week' | 'month' | 'year').

AI Gateway Exa Search tool

Use gateway.tools.exaSearch() to enable models to search the web using Exa's Search API. This tool is executed by the AI Gateway and returns token-efficient web excerpts for agent workflows. Works with both generateText and streamText.

AI Gateway Exa Search tool options

gateway.tools.exaSearch() accepts optional configuration: type ('auto' | 'fast' | 'instant', 'auto' is default), numResults (number, 1-100, default: 10), category ('company' | 'people' | 'research paper' | 'news' | 'personal site' | 'financial report'), includeDomains/excludeDomains (string[]), startPublishedDate/endPublishedDate (string, ISO 8601), contents object with: text (optionally capped with maxCharacters), highlights, maxAgeHours, livecrawlTimeout, subpages/subpageTarget, extras.links/extras.imageLinks.

AI Gateway Parallel Search tool

Use gateway.tools.parallelSearch() to enable models to search the web using Parallel AI's Search API. This tool is optimized for LLM consumption and returns relevant excerpts from web pages. Works with both generateText and streamText.

AI Gateway Parallel Search tool options

gateway.tools.parallelSearch() accepts optional configuration: mode ('one-shot' | 'agentic', default behavior is 'one-shot'), maxResults (number, 1-20, default: 10), sourcePolicy object with includeDomains/excludeDomains (string[]), afterDate (ISO 8601 format), excerpts object with maxCharsPerResult and maxCharsTotal, fetchPolicy object with maxAgeSeconds.

AI Gateway example: Perplexity Search with options

Example showing Perplexity Search with configuration: import { gateway, generateText } from 'ai'; const result = await generateText({ model: 'openai/gpt-5.4-nano', prompt: 'Search for news about AI regulations from the first week of January 2025.', tools: { perplexity_search: gateway.tools.perplexitySearch({ maxResults: 5, searchLanguageFilter: ['en'], country: 'US', searchDomainFilter: ['reuters.com', 'bbc.com', 'nytimes.com'], }), }, }); console.log(result.text); console.log('Tool calls:', JSON.stringify(result.toolCalls, null, 2)); console.log('Tool results:', JSON.stringify(result.toolResults, null, 2));

AI Gateway example: Exa Search tool

Example showing Exa Search tool: import { gateway, generateText } from 'ai'; const result = await generateText({ model: 'openai/gpt-5.4-nano', prompt: 'Find the latest AI regulation updates and summarize the key changes.', tools: { exa_search: gateway.tools.exaSearch(), }, }); console.log(result.text); console.log('Tool calls:', JSON.stringify(result.toolCalls, null, 2)); console.log('Tool results:', JSON.stringify(result.toolResults, null, 2));

AI Gateway example: Exa Search with options

Example showing Exa Search with configuration: import { gateway, generateText } from 'ai'; const result = await generateText({ model: 'openai/gpt-5.4-nano', prompt: 'Find recent AI regulation news from trusted sources.', tools: { exa_search: gateway.tools.exaSearch({ type: 'fast', numResults: 5, category: 'news', includeDomains: ['reuters.com', 'bbc.com', 'nytimes.com'], contents: { highlights: true, maxAgeHours: 24, }, }), }, }); console.log(result.text); console.log('Tool calls:', JSON.stringify(result.toolCalls, null, 2)); console.log('Tool results:', JSON.stringify(result.toolResults, null, 2));

AI Gateway example: Parallel Search tool

Example showing Parallel Search tool: import { gateway, generateText } from 'ai'; const result = await generateText({ model: 'openai/gpt-5.4-nano', prompt: 'Research the latest developments in quantum computing.', tools: { parallel_search: gateway.tools.parallelSearch(), }, }); console.log(result.text); console.log('Tool calls:', JSON.stringify(result.toolCalls, null, 2)); console.log('Tool results:', JSON.stringify(result.toolResults, null, 2));

AI Gateway example: Parallel Search with options

Example showing Parallel Search with configuration: import { gateway, generateText } from 'ai'; const result = await generateText({ model: 'openai/gpt-5.4-nano', prompt: 'Find detailed information about TypeScript 5.0 features.', tools: { parallel_search: gateway.tools.parallelSearch({ mode: 'agentic', maxResults: 5, sourcePolicy: { includeDomains: ['typescriptlang.org', 'github.com'], }, excerpts: { maxCharsPerResult: 8000, }, }), }, }); console.log(result.text); console.log('Tool calls:', JSON.stringify(result.toolCalls, null, 2)); console.log('Tool results:', JSON.stringify(result.toolResults, null, 2));

Give your agent this brain