Skip to content
Merged
Show file tree
Hide file tree
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
10 changes: 10 additions & 0 deletions packages/ai-config/src/model-capabilities/model-apis-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@ const MODEL_APIS_CAPABILITIES: Record<string, Partial<ModelInfo>> = {
maxContextLength: 250_000,
maxInputTokens: 250_000,
},
"deepseek-ai/DeepSeek-V4-Flash-0731": {
family: "deepseek-v4",
thinkingEffortLevels: ["off", "low", "high", "max"],
supportsImages: false,
supportsToolResultImages: false,
supportedInputMediaTypes: [],
maxOutputTokens: 384_000,
maxContextLength: 250_000,
maxInputTokens: 250_000,
Comment on lines +55 to +56

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is smaller than the 'real' context length, but artificially bringing this down to help us stay under rate limits.

},
};

/**
Expand Down
14 changes: 14 additions & 0 deletions packages/ai-provider-bridge/src/__tests__/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
buildSnowflakeCortexUrl,
buildSnowflakeCortexUrlFromHost,
normalizeProviderBaseUrl,
positAiThinkingRequestFields,
thinkingRequestFields,
} from "../utils";

Expand All @@ -33,6 +34,19 @@ describe("thinkingRequestFields", () => {
});
});

describe("positAiThinkingRequestFields", () => {
it("maps DeepSeek off to none and reuses named efforts", () => {
expect(
positAiThinkingRequestFields("deepseek-ai/DeepSeek-V4-Flash-0731", "off", false),
).toEqual({
reasoning_effort: "none",
});
expect(
positAiThinkingRequestFields("deepseek-ai/DeepSeek-V4-Flash-0731", "high", false),
).toEqual({ reasoning_effort: "high" });
});
});

describe("normalizeProviderBaseUrl", () => {
const HOST = "https://api.anthropic.com";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
isClaudeModel,
isThinkingEnabled,
joinPath,
thinkingRequestFields,
positAiThinkingRequestFields,
} from "../utils";
import {
convertAiSdkStreamToPlatform,
Expand Down Expand Up @@ -238,7 +238,8 @@ export class PositAiClient implements ModelClient {

return convertAiSdkStreamToPlatform(result.fullStream, cleanup);
} else if (normalizedProtocol === "openai-chat") {
const thinkingFields = thinkingRequestFields(
const thinkingFields = positAiThinkingRequestFields(
params.model,
params.thinkingEffort,
params.requiresChatTemplateKwargs ?? false,
);
Expand Down
11 changes: 11 additions & 0 deletions packages/ai-provider-bridge/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@ export function thinkingRequestFields(
: undefined;
}

export function positAiThinkingRequestFields(
modelId: string,
effort: string | undefined,
requiresChatTemplateKwargs: boolean,
): Record<string, unknown> | undefined {
if (modelId === "deepseek-ai/DeepSeek-V4-Flash-0731" && effort === "off") {
return { reasoning_effort: "none" };
}
return thinkingRequestFields(effort, requiresChatTemplateKwargs);
}

// ---------------------------------------------------------------------------
// Model ID helpers
// ---------------------------------------------------------------------------
Expand Down