route to different think and prep based on the context from the router

This commit is contained in:
dal 2025-08-05 11:15:59 -06:00
parent 5219cc0004
commit bb07af8cbd
No known key found for this signature in database
GPG Key ID: 16F4B0E1E9F61122
1 changed files with 15 additions and 1 deletions

View File

@ -8,6 +8,7 @@ import { z } from 'zod';
import { getSqlDialectGuidance } from '../agents/shared/sql-dialect-guidance';
import { thinkAndPrepAgent } from '../agents/think-and-prep-agent/think-and-prep-agent';
import { createThinkAndPrepInstructionsWithoutDatasets } from '../agents/think-and-prep-agent/think-and-prep-instructions';
import { createThinkAndPrepInstructionsWithoutDatasets as createInvestigationInstructionsWithoutDatasets } from '../agents/think-and-prep-agent/investigation-instructions';
import type { thinkAndPrepWorkflowInputSchema } from '../schemas/workflow-schemas';
import { ChunkProcessor } from '../utils/database/chunk-processor';
import {
@ -267,11 +268,24 @@ ${databaseContext}
const wrappedStream = wrapTraced(
async () => {
// Get the analysis type from the router step
const analysisType = inputData['analysis-type-router'].analysisType.choice;
console.info('Think and Prep: Using analysis type', {
analysisType,
reasoning: inputData['analysis-type-router'].analysisType.reasoning,
});
// Select the appropriate instructions based on analysis type
const instructions = analysisType === 'investigation'
? createInvestigationInstructionsWithoutDatasets(sqlDialectGuidance)
: createThinkAndPrepInstructionsWithoutDatasets(sqlDialectGuidance);
// Create system messages with dataset context and instructions
const systemMessages: CoreMessage[] = [
{
role: 'system',
content: createThinkAndPrepInstructionsWithoutDatasets(sqlDialectGuidance),
content: instructions,
providerOptions: DEFAULT_CACHE_OPTIONS,
},
{