diff --git a/packages/types/src/providers/zai.ts b/packages/types/src/providers/zai.ts index 3dcc352b1d0..e21fcc698bf 100644 --- a/packages/types/src/providers/zai.ts +++ b/packages/types/src/providers/zai.ts @@ -17,7 +17,6 @@ export const internationalZAiModels = { supportsImages: false, supportsPromptCache: true, supportsNativeTools: true, - supportsReasoningBinary: true, inputPrice: 0.6, outputPrice: 2.2, cacheWritesPrice: 0, @@ -94,7 +93,6 @@ export const internationalZAiModels = { supportsImages: false, supportsPromptCache: true, supportsNativeTools: true, - supportsReasoningBinary: true, inputPrice: 0.6, outputPrice: 2.2, cacheWritesPrice: 0, @@ -125,7 +123,6 @@ export const mainlandZAiModels = { supportsImages: false, supportsPromptCache: true, supportsNativeTools: true, - supportsReasoningBinary: true, inputPrice: 0.29, outputPrice: 1.14, cacheWritesPrice: 0, @@ -202,7 +199,6 @@ export const mainlandZAiModels = { supportsImages: false, supportsPromptCache: true, supportsNativeTools: true, - supportsReasoningBinary: true, inputPrice: 0.29, outputPrice: 1.14, cacheWritesPrice: 0, diff --git a/src/api/providers/__tests__/zai.spec.ts b/src/api/providers/__tests__/zai.spec.ts index b292b486136..083fdc13ef8 100644 --- a/src/api/providers/__tests__/zai.spec.ts +++ b/src/api/providers/__tests__/zai.spec.ts @@ -295,143 +295,5 @@ describe("ZAiHandler", () => { undefined, ) }) - - describe("Reasoning functionality", () => { - it("should include thinking parameter when enableReasoningEffort is true and model supports reasoning in createMessage", async () => { - const handlerWithReasoning = new ZAiHandler({ - apiModelId: "glm-4.6", // GLM-4.6 has supportsReasoningBinary: true - zaiApiKey: "test-zai-api-key", - zaiApiLine: "international_coding", - enableReasoningEffort: true, - }) - - mockCreate.mockImplementationOnce(() => { - return { - [Symbol.asyncIterator]: () => ({ - async next() { - return { done: true } - }, - }), - } - }) - - const systemPrompt = "Test system prompt" - const messages: Anthropic.Messages.MessageParam[] = [{ role: "user", content: "Test message" }] - - const messageGenerator = handlerWithReasoning.createMessage(systemPrompt, messages) - await messageGenerator.next() - - expect(mockCreate).toHaveBeenCalledWith( - expect.objectContaining({ - thinking: { type: "enabled" }, - }), - undefined, - ) - }) - - it("should not include thinking parameter when enableReasoningEffort is false in createMessage", async () => { - const handlerWithoutReasoning = new ZAiHandler({ - apiModelId: "glm-4.6", // GLM-4.6 has supportsReasoningBinary: true - zaiApiKey: "test-zai-api-key", - zaiApiLine: "international_coding", - enableReasoningEffort: false, - }) - - mockCreate.mockImplementationOnce(() => { - return { - [Symbol.asyncIterator]: () => ({ - async next() { - return { done: true } - }, - }), - } - }) - - const systemPrompt = "Test system prompt" - const messages: Anthropic.Messages.MessageParam[] = [{ role: "user", content: "Test message" }] - - const messageGenerator = handlerWithoutReasoning.createMessage(systemPrompt, messages) - await messageGenerator.next() - - expect(mockCreate).toHaveBeenCalledWith( - expect.not.objectContaining({ - thinking: expect.anything(), - }), - undefined, - ) - }) - - it("should not include thinking parameter when model does not support reasoning in createMessage", async () => { - const handlerWithNonReasoningModel = new ZAiHandler({ - apiModelId: "glm-4-32b-0414-128k", // This model doesn't have supportsReasoningBinary: true - zaiApiKey: "test-zai-api-key", - zaiApiLine: "international_coding", - enableReasoningEffort: true, - }) - - mockCreate.mockImplementationOnce(() => { - return { - [Symbol.asyncIterator]: () => ({ - async next() { - return { done: true } - }, - }), - } - }) - - const systemPrompt = "Test system prompt" - const messages: Anthropic.Messages.MessageParam[] = [{ role: "user", content: "Test message" }] - - const messageGenerator = handlerWithNonReasoningModel.createMessage(systemPrompt, messages) - await messageGenerator.next() - - expect(mockCreate).toHaveBeenCalledWith( - expect.not.objectContaining({ - thinking: expect.anything(), - }), - undefined, - ) - }) - - it("should include thinking parameter when enableReasoningEffort is true and model supports reasoning in completePrompt", async () => { - const handlerWithReasoning = new ZAiHandler({ - apiModelId: "glm-4.5", // GLM-4.5 has supportsReasoningBinary: true - zaiApiKey: "test-zai-api-key", - zaiApiLine: "international_coding", - enableReasoningEffort: true, - }) - - const expectedResponse = "This is a test response" - mockCreate.mockResolvedValueOnce({ choices: [{ message: { content: expectedResponse } }] }) - - await handlerWithReasoning.completePrompt("test prompt") - - expect(mockCreate).toHaveBeenCalledWith( - expect.objectContaining({ - thinking: { type: "enabled" }, - }), - ) - }) - - it("should not include thinking parameter when enableReasoningEffort is false in completePrompt", async () => { - const handlerWithoutReasoning = new ZAiHandler({ - apiModelId: "glm-4.5", // GLM-4.5 has supportsReasoningBinary: true - zaiApiKey: "test-zai-api-key", - zaiApiLine: "international_coding", - enableReasoningEffort: false, - }) - - const expectedResponse = "This is a test response" - mockCreate.mockResolvedValueOnce({ choices: [{ message: { content: expectedResponse } }] }) - - await handlerWithoutReasoning.completePrompt("test prompt") - - expect(mockCreate).toHaveBeenCalledWith( - expect.not.objectContaining({ - thinking: expect.anything(), - }), - ) - }) - }) }) })