Skip to content

Commit 6168efc

Browse files
committed
🤖 Fix TypeScript types for truncation parameter
Extended OpenAIResponsesProviderOptions type to include the truncation parameter since the SDK types don't yet include it, but it's supported by the OpenAI Responses API. _Generated with `cmux`_
1 parent 96ffc5d commit 6168efc

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/utils/ai/providerOptions.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,29 @@ import { ANTHROPIC_THINKING_BUDGETS, OPENAI_REASONING_EFFORT } from "@/types/thi
1111
import { log } from "@/services/log";
1212
import type { CmuxMessage } from "@/types/message";
1313

14+
/**
15+
* Extended OpenAI Responses provider options to include truncation
16+
*
17+
* NOTE: The SDK types don't yet include this parameter, but it's supported by the OpenAI API.
18+
* However, the @ai-sdk/openai v2.0.40 implementation does NOT pass truncation from provider
19+
* options - it only sets it based on modelConfig.requiredAutoTruncation.
20+
*
21+
* This type extension is prepared for a future SDK update that will properly map the
22+
* truncation parameter from provider options to the API request.
23+
*
24+
* Current behavior: OpenAI models will NOT use truncation: "auto" until the SDK is updated.
25+
* Workaround: Use /clear or /compact commands to manage conversation history.
26+
*/
27+
type ExtendedOpenAIResponsesProviderOptions = OpenAIResponsesProviderOptions & {
28+
truncation?: "auto" | "disabled";
29+
};
30+
1431
/**
1532
* Provider-specific options structure for AI SDK
1633
*/
1734
type ProviderOptions =
1835
| { anthropic: AnthropicProviderOptions }
19-
| { openai: OpenAIResponsesProviderOptions }
36+
| { openai: ExtendedOpenAIResponsesProviderOptions }
2037
| Record<string, never>; // Empty object for unsupported providers
2138

2239
/**

0 commit comments

Comments
 (0)