Function searchSTREAM

    1. Searches the Web for the query via metasearch of major engines or custom data.
    2. Extracts text of top results using Tractor the Text Extractor.
    3. Implements SEEKTOPIC to extract Keyphrase Topics and Top Sentences that centralize those topics.
    4. 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.
    5. 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

    • query: string

      The search query string.

    • Optionaloptions: {
          categoryIndex: number;
          recencyIndex: number;
          maxRetries: number;
          maxTopResultsToExtract: number;
          customSearxngDomain: string;
      } = {}
      • categoryIndex: number

        default=0 - Index of the search category.

      • recencyIndex: number

        default=0 - Index representing the recency of results.

      • maxRetries: number

        default=5 - Maximum number of retry attempts for the search.

      • maxTopResultsToExtract: number

        default=6 - Maximum number of top results to extract and analyze.

      • customSearxngDomain: string

        default=null - Use your custom domain SearXNG

    Returns Promise<any[]>

    A promise that resolves to an array containing the search results, extracted information, and generated answer.

    const advancedResults = await searchSTREAM('Latest developments in quantum computing', {
    categoryIndex: 2,
    recencyIndex: 1,
    maxRetries: 5,
    maxTopResultsToExtract: 10
    });

    ai-research-agent (2024)