mirror of https://github.com/buster-so/buster.git
identify assumptions fixed
This commit is contained in:
parent
b3cfa35430
commit
c7627b00d6
|
@ -13,11 +13,11 @@ export const identifyAssumptionsStepInputSchema = z.object({
|
||||||
datasets: z.string().describe('Dataset context for analysis'),
|
datasets: z.string().describe('Dataset context for analysis'),
|
||||||
});
|
});
|
||||||
|
|
||||||
// Schema for what the LLM returns
|
// Schema for what the LLM returns - using simple object instead of discriminated union
|
||||||
const identifyAssumptionsLLMOutputSchema = z.discriminatedUnion('type', [
|
const identifyAssumptionsLLMOutputSchema = z.object({
|
||||||
z.object({
|
type: z.enum(['listAssumptions', 'noAssumptions']).describe('Type of result'),
|
||||||
type: z.literal('listAssumptions'),
|
assumptions: z
|
||||||
assumptions: z.array(
|
.array(
|
||||||
z.object({
|
z.object({
|
||||||
descriptive_title: z.string().describe('A clear, descriptive title for the assumption'),
|
descriptive_title: z.string().describe('A clear, descriptive title for the assumption'),
|
||||||
classification: z
|
classification: z
|
||||||
|
@ -58,13 +58,11 @@ const identifyAssumptionsLLMOutputSchema = z.discriminatedUnion('type', [
|
||||||
.enum(['timeRelated', 'vagueRequest', 'major', 'minor'])
|
.enum(['timeRelated', 'vagueRequest', 'major', 'minor'])
|
||||||
.describe('Label indicating the nature and severity of the assumption'),
|
.describe('Label indicating the nature and severity of the assumption'),
|
||||||
})
|
})
|
||||||
),
|
)
|
||||||
}),
|
.optional()
|
||||||
z.object({
|
.describe('List of assumptions (only if listAssumptions)'),
|
||||||
type: z.literal('noAssumptions'),
|
message: z.string().optional().describe('Explanation message (only if noAssumptions)'),
|
||||||
message: z.string().describe('Explanation that no assumptions were identified'),
|
});
|
||||||
}),
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Result schema that includes the structured result
|
// Result schema that includes the structured result
|
||||||
export const identifyAssumptionsResultSchema = z.object({
|
export const identifyAssumptionsResultSchema = z.object({
|
||||||
|
@ -188,11 +186,6 @@ No conversation history available for analysis.`,
|
||||||
messages,
|
messages,
|
||||||
temperature: 0,
|
temperature: 0,
|
||||||
maxOutputTokens: 10000,
|
maxOutputTokens: 10000,
|
||||||
providerOptions: {
|
|
||||||
anthropic: {
|
|
||||||
thinking: { type: 'enabled', budgetTokens: 16000 },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
return object;
|
return object;
|
||||||
},
|
},
|
||||||
|
@ -204,7 +197,7 @@ No conversation history available for analysis.`,
|
||||||
const llmResult = await tracedAssumptionsGeneration();
|
const llmResult = await tracedAssumptionsGeneration();
|
||||||
|
|
||||||
// Convert LLM result to output format
|
// Convert LLM result to output format
|
||||||
if (llmResult.type === 'listAssumptions') {
|
if (llmResult.type === 'listAssumptions' && llmResult.assumptions) {
|
||||||
// Convert snake_case from LLM to camelCase for result
|
// Convert snake_case from LLM to camelCase for result
|
||||||
const assumptions = llmResult.assumptions.map((assumption) => ({
|
const assumptions = llmResult.assumptions.map((assumption) => ({
|
||||||
descriptiveTitle: assumption.descriptive_title,
|
descriptiveTitle: assumption.descriptive_title,
|
||||||
|
|
Loading…
Reference in New Issue