@plust/datasleuth - v0.2.0
    Preparing search index...

    Function research

    • Main research function - the primary API for the @plust/datasleuth package

      This function orchestrates the entire research process from query to results. It takes a research query, an output schema for validation, and optional configuration parameters to customize the research process.

      Parameters

      • input: ResearchInput

        The research configuration object

        Input for the research function

        • query: string

          The research query

        • outputSchema: ZodType<ResearchResult>

          Schema defining the output structure

        • Optionalsteps?: ResearchStep[]

          Optional custom pipeline steps

        • Optionalconfig?: Partial<PipelineConfig>

          Optional configuration for the pipeline

        • OptionaldefaultLLM?: LanguageModelV1

          Default language model to use for LLM-dependent steps

        • OptionaldefaultSearchProvider?: any

          Default search provider to use for search-dependent steps

      Returns Promise<ResearchResult>

      The research results matching the structure defined by outputSchema

      When configuration is invalid (missing required parameters, etc.)

      When output doesn't match the provided schema

      For other research-related errors

      import { research } from '@plust/datasleuth';
      import { z } from 'zod';
      import { openai } from '@ai-sdk/openai';
      import { google } from '@plust/search-sdk';

      // Define your output schema
      const outputSchema = z.object({
      summary: z.string(),
      keyFindings: z.array(z.string()),
      sources: z.array(z.string().url())
      });

      // Configure your search provider
      const searchProvider = google.configure({
      apiKey: process.env.GOOGLE_API_KEY,
      cx: process.env.GOOGLE_CX
      });

      // Execute research
      const results = await research({
      query: "Latest advancements in quantum computing",
      outputSchema,
      defaultLLM: openai('gpt-4o'),
      defaultSearchProvider: searchProvider
      });