Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 8 additions & 13 deletions e2e/perstack-cli/reasoning-budget.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ describe("Reasoning Budget", () => {
// Extended thinking should produce reasoning tokens or thinking text
// Note: AI SDK currently doesn't report reasoningTokens for Anthropic,
// but we can verify thinking content is generated
const hasThinking =
result.reasoningTokens > 0 || (result.thinking && result.thinking.length > 0)
const hasThinking = result.reasoningTokens > 0 || (result.thinking?.length ?? 0) > 0
expect(hasThinking).toBe(true)
},
LLM_TIMEOUT,
Expand Down Expand Up @@ -166,10 +165,9 @@ describe("Reasoning Budget", () => {
// Both should produce reasoning tokens or thinking text
// Note: AI SDK currently doesn't report reasoningTokens for Anthropic
const minimalHasThinking =
minimalResult.reasoningTokens > 0 ||
(minimalResult.thinking && minimalResult.thinking.length > 0)
minimalResult.reasoningTokens > 0 || (minimalResult.thinking?.length ?? 0) > 0
const highHasThinking =
highResult.reasoningTokens > 0 || (highResult.thinking && highResult.thinking.length > 0)
highResult.reasoningTokens > 0 || (highResult.thinking?.length ?? 0) > 0
expect(minimalHasThinking).toBe(true)
expect(highHasThinking).toBe(true)
},
Expand Down Expand Up @@ -202,8 +200,7 @@ describe("Reasoning Budget", () => {
expect(result.success).toBe(true)
// OpenAI reasoning models may not always surface reasoning token counts,
// so verify either tokens or thinking text is present
const hasReasoning =
result.reasoningTokens > 0 || (result.thinking && result.thinking.length > 0)
const hasReasoning = result.reasoningTokens > 0 || (result.thinking?.length ?? 0) > 0
expect(hasReasoning).toBe(true)
},
LLM_TIMEOUT,
Expand All @@ -221,7 +218,7 @@ describe("Reasoning Budget", () => {

// At least one budget level should produce reasoning tokens or thinking text
const highHasReasoning =
highResult.reasoningTokens > 0 || (highResult.thinking && highResult.thinking.length > 0)
highResult.reasoningTokens > 0 || (highResult.thinking?.length ?? 0) > 0
expect(highHasReasoning).toBe(true)
},
LLM_TIMEOUT * 2, // Two API calls
Expand Down Expand Up @@ -252,8 +249,7 @@ describe("Reasoning Budget", () => {

expect(result.success).toBe(true)
// Flash thinking should produce reasoning tokens or thinking text
const hasThinking =
result.reasoningTokens > 0 || (result.thinking && result.thinking.length > 0)
const hasThinking = result.reasoningTokens > 0 || (result.thinking?.length ?? 0) > 0
expect(hasThinking).toBe(true)
},
LLM_TIMEOUT,
Expand All @@ -271,10 +267,9 @@ describe("Reasoning Budget", () => {

// Both should produce reasoning tokens or thinking text
const minimalHasThinking =
minimalResult.reasoningTokens > 0 ||
(minimalResult.thinking && minimalResult.thinking.length > 0)
minimalResult.reasoningTokens > 0 || (minimalResult.thinking?.length ?? 0) > 0
const highHasThinking =
highResult.reasoningTokens > 0 || (highResult.thinking && highResult.thinking.length > 0)
highResult.reasoningTokens > 0 || (highResult.thinking?.length ?? 0) > 0
expect(minimalHasThinking).toBe(true)
expect(highHasThinking).toBe(true)
},
Expand Down