@@ -1696,8 +1696,8 @@ describe("image tool implicit imageModel config", () => {
|
1696 | 1696 | items: { type: "string" }, |
1697 | 1697 | }, |
1698 | 1698 | model: { type: "string" }, |
1699 | | -maxBytesMb: { type: "number" }, |
1700 | | -maxImages: { type: "number" }, |
| 1699 | +maxBytesMb: { type: "number", exclusiveMinimum: 0 }, |
| 1700 | +maxImages: { type: "integer", minimum: 1 }, |
1701 | 1701 | }, |
1702 | 1702 | }); |
1703 | 1703 | }); |
@@ -2343,6 +2343,40 @@ describe("image tool MiniMax VLM routing", () => {
|
2343 | 2343 | expect(tooManyDetails?.max).toBe(1); |
2344 | 2344 | }); |
2345 | 2345 | |
| 2346 | +it("rejects invalid image cap values before loading images", async () => { |
| 2347 | +const { fetch, tool } = await createMinimaxVlmFixture({ status_code: 0, status_msg: "" }); |
| 2348 | + |
| 2349 | +await expect( |
| 2350 | +tool.execute("t1", { |
| 2351 | +prompt: "Compare these images.", |
| 2352 | +image: `data:image/png;base64,${ONE_PIXEL_PNG_B64}`, |
| 2353 | +maxImages: 1.5, |
| 2354 | +}), |
| 2355 | +).rejects.toThrow("maxImages must be a positive integer"); |
| 2356 | + |
| 2357 | +await expect( |
| 2358 | +tool.execute("t2", { |
| 2359 | +prompt: "Compare these images.", |
| 2360 | +image: `data:image/png;base64,${ONE_PIXEL_PNG_B64}`, |
| 2361 | +maxBytesMb: 0, |
| 2362 | +}), |
| 2363 | +).rejects.toThrow("maxBytesMb must be greater than 0"); |
| 2364 | +expect(fetch).not.toHaveBeenCalled(); |
| 2365 | +}); |
| 2366 | + |
| 2367 | +it("accepts string image caps through shared numeric readers", async () => { |
| 2368 | +const { fetch, tool } = await createMinimaxVlmFixture({ status_code: 0, status_msg: "" }); |
| 2369 | + |
| 2370 | +await tool.execute("t1", { |
| 2371 | +prompt: "Describe this image.", |
| 2372 | +image: `data:image/png;base64,${ONE_PIXEL_PNG_B64}`, |
| 2373 | +maxImages: "1", |
| 2374 | +maxBytesMb: "1", |
| 2375 | +}); |
| 2376 | + |
| 2377 | +expect(fetch).toHaveBeenCalledTimes(1); |
| 2378 | +}); |
| 2379 | + |
2346 | 2380 | it("surfaces MiniMax API errors from /v1/coding_plan/vlm", async () => { |
2347 | 2381 | const { tool } = await createMinimaxVlmFixture({ status_code: 1004, status_msg: "bad key" }); |
2348 | 2382 | |
|