search-stream
ai-research-agent / search/search-stream
Search
searchSTREAM()
function searchSTREAM(query, options?): Promise<any[]>
🤖🔎 STREAM: Search with Top Result Extraction & Answer Model
- Searches the Web for the query via metasearch of major engines or custom data.
- Extracts text of top results using Tractor the Text Extractor.
- Implements SEEKTOPIC to extract Keyphrase Topics and Top Sentences that centralize those topics.
- Reranks document chunks based on relevance to the query, using embeddings to
convert text to concept vectors within LLM "concept space", and calculates cosine similarity of query to topic. - Uses a Research Agent prompt with key sentences from relevant sources to generate an answer via Groq Llama, OpenAI, or Anthropic API, and suggests follow-up queries.
Parameters
Parameter | Type | Description |
---|---|---|
|
| The search query string. |
| { | |
|
| default=0 - Index of the search category. |
|
| default=null - Use your custom domain SearXNG |
|
| default=5 - Maximum number of retry attempts for the search. |
|
| default=6 - Maximum number of top results to extract and analyze. |
|
| default=0 - Index representing the recency of results. |
Returns
Promise
<any
[]>
A promise that resolves to an array containing the search results, extracted information, and generated answer.
Example
const advancedResults = await searchSTREAM('Latest developments in quantum computing', {
categoryIndex: 2,
recencyIndex: 1,
maxRetries: 5,
maxTopResultsToExtract: 10
});