Skip to content

Commit 620cc5e

Browse files
committed
add test unit
1 parent 93c8a5b commit 620cc5e

2 files changed

Lines changed: 80 additions & 0 deletions

File tree

‎packages/types/src/__tests__/deepseek-v4-pro.test.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ describe("DeepSeek V4 Pro 0813 provider catalogs", () => {
3535
})
3636
})
3737

38+
it("marks deepseek-v4-flash-vision-exp as a vision-capable model", () => {
39+
const model = deepSeekModels["deepseek-v4-flash-vision-exp"]
40+
expect(model).toBeDefined()
41+
expect(model.supportsImages).toBe(true)
42+
expect(model.supportsPromptCache).toBe(true)
43+
expect(model.contextWindow).toBeGreaterThanOrEqual(1_000_000)
44+
expect(model.supportsReasoningEffort).toEqual(["disable", "low", "high", "max"])
45+
})
46+
3847
// Self-hosted providers retain separate IDs for the preview weights and 0813 checkpoint.
3948
it.each([
4049
["Fireworks AI", fireworksModels["accounts/fireworks/models/deepseek-v4-pro"]],

‎src/api/providers/__tests__/deepseek.spec.ts‎

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,18 @@ describe("DeepSeekHandler", () => {
249249
expect((model.info as ModelInfo).reasoningEffort).toBe("high")
250250
})
251251

252+
it("should return vision model info for deepseek-v4-flash-vision-exp", () => {
253+
const handlerWithVision = new DeepSeekHandler({
254+
...mockOptions,
255+
apiModelId: "deepseek-v4-flash-vision-exp",
256+
})
257+
const model = handlerWithVision.getModel()
258+
expect(model.id).toBe("deepseek-v4-flash-vision-exp")
259+
expect(model.info.supportsImages).toBe(true)
260+
expect(model.info.supportsPromptCache).toBe(true)
261+
expect((model.info as ModelInfo).preserveReasoning).toBe(true)
262+
})
263+
252264
it("should return provided model ID with default model info if model does not exist", () => {
253265
const handlerWithInvalidModel = new DeepSeekHandler({
254266
...mockOptions,
@@ -412,6 +424,35 @@ describe("DeepSeekHandler", () => {
412424
const reasoningChunks = chunks.filter((chunk) => chunk.type === "reasoning")
413425
expect(reasoningChunks).toEqual([{ type: "reasoning", text: "primary thought" }])
414426
})
427+
428+
it("enables thinking and forwards image_url for the vision model", async () => {
429+
const visionHandler = new DeepSeekHandler({
430+
...mockOptions,
431+
apiModelId: "deepseek-v4-flash-vision-exp",
432+
})
433+
const withImage: Anthropic.Messages.MessageParam[] = [
434+
{
435+
role: "user",
436+
content: [
437+
{ type: "text", text: "Describe:" },
438+
{ type: "image", source: { type: "base64", media_type: "image/png", data: "abc" } },
439+
],
440+
},
441+
]
442+
443+
await collectStream(visionHandler.createMessage(systemPrompt, withImage))
444+
445+
const callArgs = mockCreate.mock.calls[0][0]
446+
expect(callArgs.thinking).toEqual({ type: "enabled" })
447+
expect(callArgs.messages).toEqual(
448+
expect.arrayContaining([
449+
expect.objectContaining({
450+
role: "user",
451+
content: expect.arrayContaining([expect.objectContaining({ type: "image_url" })]),
452+
}),
453+
]),
454+
)
455+
})
415456
})
416457

417458
describe("processUsageMetrics", () => {
@@ -684,6 +725,36 @@ describe("DeepSeekHandler", () => {
684725
rawReasoningEffort: "max",
685726
mappedReasoningEffort: "max",
686727
},
728+
{
729+
modelId: "deepseek-v4-flash-vision-exp",
730+
rawReasoningEffort: "disable",
731+
mappedReasoningEffort: undefined,
732+
},
733+
{
734+
modelId: "deepseek-v4-flash-vision-exp",
735+
rawReasoningEffort: "low",
736+
mappedReasoningEffort: "low",
737+
},
738+
{
739+
modelId: "deepseek-v4-flash-vision-exp",
740+
rawReasoningEffort: "medium",
741+
mappedReasoningEffort: "high",
742+
},
743+
{
744+
modelId: "deepseek-v4-flash-vision-exp",
745+
rawReasoningEffort: "high",
746+
mappedReasoningEffort: "high",
747+
},
748+
{
749+
modelId: "deepseek-v4-flash-vision-exp",
750+
rawReasoningEffort: "xhigh",
751+
mappedReasoningEffort: "high",
752+
},
753+
{
754+
modelId: "deepseek-v4-flash-vision-exp",
755+
rawReasoningEffort: "max",
756+
mappedReasoningEffort: "max",
757+
},
687758
]
688759

689760
for (const { modelId, rawReasoningEffort, mappedReasoningEffort } of mappings) {

0 commit comments

Comments
 (0)