refactor(fireworks): flatten Kimi stream wrapper

This commit is contained in:
Amp
2026-08-12 15:20:43 +00:00
committed by Peter Steinberger
parent 72f4ee2274
commit 91197bf8d1
2 changed files with 9 additions and 13 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ function capturePayload(params: {
return captured;
}
describe("createFireworksKimiThinkingDisabledWrapper", () => {
describe("wrapFireworksProviderStream", () => {
it("forces thinking disabled for Fireworks Kimi models", () => {
expect(
capturePayload({
+8 -12
View File
@@ -10,17 +10,6 @@ function isFireworksProviderId(providerId: string): boolean {
return normalized === "fireworks" || normalized === "fireworks-ai";
}
function createFireworksKimiThinkingDisabledWrapper(baseStreamFn: StreamFn | undefined): StreamFn {
return createPayloadPatchStreamWrapper(baseStreamFn, ({ payload }) => {
// Fireworks Kimi can emit chain-of-thought in visible `content` unless
// the Anthropic-style thinking toggle is explicitly disabled.
payload.thinking = { type: "disabled" };
delete payload.reasoning;
delete payload.reasoning_effort;
delete payload.reasoningEffort;
});
}
export function wrapFireworksProviderStream(
ctx: ProviderWrapStreamFnContext,
): StreamFn | undefined {
@@ -31,5 +20,12 @@ export function wrapFireworksProviderStream(
) {
return undefined;
}
return createFireworksKimiThinkingDisabledWrapper(ctx.streamFn);
return createPayloadPatchStreamWrapper(ctx.streamFn, ({ payload }) => {
// Fireworks Kimi can emit chain-of-thought in visible `content` unless
// the Anthropic-style thinking toggle is explicitly disabled.
payload.thinking = { type: "disabled" };
delete payload.reasoning;
delete payload.reasoning_effort;
delete payload.reasoningEffort;
});
}