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

    Function plan

    • Creates a planning step for the research pipeline

      This step uses an LLM to generate a structured research plan based on the query. The plan includes objectives, search queries, relevant factors, data gathering strategy, and expected outcomes.

      Parameters

      • options: PlanOptions = {}

        Configuration options for the planning step

        Configuration options for the research planning step

        This interface defines all the configurable aspects of the planning step, including the language model to use, prompt customization, and result handling.

        PlanOptions

        • OptionalcustomPrompt?: string

          Custom system prompt to override the default

        • Optionalllm?: LanguageModelV1

          Language model to use for generating the plan (falls back to state.defaultLLM if not provided)

        • Optionaltemperature?: number

          Temperature setting for the language model (0.0-1.0)

        • OptionalincludeInResults?: boolean

          Whether to include the plan in the final research results

        • Optionalretry?: { maxRetries?: number; baseDelay?: number }

          Retry configuration for language model calls Useful for handling transient errors in LLM services

          • OptionalmaxRetries?: number

            Maximum number of retries (default: 2)

          • OptionalbaseDelay?: number

            Base delay between retries in ms (default: 1000)

      Returns ResearchStep

      A planning step for the research pipeline

      import { research, plan } from '@plust/datasleuth';
      import { openai } from '@ai-sdk/openai';

      const results = await research({
      query: "Renewable energy trends",
      steps: [
      plan({
      llm: openai('gpt-4o'),
      temperature: 0.5,
      includeInResults: true
      }),
      // Additional steps...
      ],
      outputSchema
      });

      When the language model fails to generate a plan

      When the generated plan doesn't match the expected schema

      When required configuration is missing