-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat: add GLM-4.6-turbo model to Chutes provider #8516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
1f3ad22
ab87040
eb45e7c
97de0c0
52fc407
9dea255
002796b
557ab70
dbb527c
70ee1a5
2e1c5c6
1c80935
3d9add9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -492,4 +492,76 @@ describe("ChutesHandler", () => { | |
| const model = handlerWithModel.getModel() | ||
| expect(model.info.temperature).toBe(0.5) | ||
| }) | ||
|
|
||
| it("should return zai-org/GLM-4.6-turbo model with correct configuration", () => { | ||
| const testModelId: ChutesModelId = "zai-org/GLM-4.6-turbo" | ||
| const handlerWithModel = new ChutesHandler({ | ||
| apiModelId: testModelId, | ||
| chutesApiKey: "test-chutes-api-key", | ||
| }) | ||
| const model = handlerWithModel.getModel() | ||
| expect(model.id).toBe(testModelId) | ||
| expect(model.info).toEqual( | ||
| expect.objectContaining({ | ||
| maxTokens: 32768, | ||
| contextWindow: 202752, | ||
| supportsImages: false, | ||
| supportsPromptCache: false, | ||
| inputPrice: 1.15, | ||
| outputPrice: 3.25, | ||
| description: "GLM-4.6-turbo model with 200K+ token context window, optimized for fast inference.", | ||
| temperature: 0.5, // Default temperature for non-DeepSeek models | ||
| }), | ||
| ) | ||
| // Strengthen test by also asserting the selected model.info matches the static config to catch mapping/regression errors beyond temperature | ||
| expect(model.info).toEqual(expect.objectContaining(chutesModels[testModelId])) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P3] Test duplication: the GLM-4.6-turbo config assertions repeat patterns used elsewhere. Consider a small helper to keep assertions consistent and reduce noise across tests (e.g., expectModelInfo(model.info, chutesModels[testModelId])). |
||
| }) | ||
|
|
||
| it("should have correct pricing and context for zai-org/GLM-4.6-turbo", () => { | ||
| // This test ensures the GLM-4.6-turbo model has the expected pricing and context window | ||
| // Assert exact values and capabilities to catch regressions | ||
| const model = chutesModels["zai-org/GLM-4.6-turbo"] | ||
| expect(model.maxTokens).toBe(32768) | ||
raulcorreia7 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| expect(model.contextWindow).toBe(202752) | ||
| expect(model.supportsImages).toBe(false) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P3] Test coverage: Add a createMessage param-passthrough test specifically for "zai-org/GLM-4.6-turbo". The suite already verifies DeepSeek R1 and a generic non‑DeepSeek model; asserting this model’s call (model id, max_tokens 32768, temperature 0.5, stream true, stream_options { include_usage: true }) would catch mapping regressions that the generic case might miss. |
||
| expect(model.supportsPromptCache).toBe(false) | ||
| expect(model.inputPrice).toBe(1.15) | ||
| expect(model.outputPrice).toBe(3.25) | ||
| }) | ||
|
|
||
| it("createMessage should pass correct parameters to Chutes client for GLM-4.6-turbo model", async () => { | ||
| const modelId: ChutesModelId = "zai-org/GLM-4.6-turbo" | ||
| const modelInfo = chutesModels[modelId] | ||
| const handlerWithModel = new ChutesHandler({ apiModelId: modelId, chutesApiKey: "test-chutes-api-key" }) | ||
|
|
||
| mockCreate.mockImplementationOnce(() => { | ||
| return { | ||
| [Symbol.asyncIterator]: () => ({ | ||
| async next() { | ||
| return { done: true } | ||
| }, | ||
| }), | ||
| } | ||
| }) | ||
|
|
||
| const systemPrompt = "Test system prompt for GLM-4.6-turbo" | ||
| const messages: Anthropic.Messages.MessageParam[] = [ | ||
| { role: "user", content: "Test message for GLM-4.6-turbo" }, | ||
| ] | ||
|
|
||
| const messageGenerator = handlerWithModel.createMessage(systemPrompt, messages) | ||
| await messageGenerator.next() | ||
|
|
||
| expect(mockCreate).toHaveBeenCalledWith( | ||
| expect.objectContaining({ | ||
| model: modelId, | ||
| max_tokens: modelInfo.maxTokens, // Should be 32768 | ||
| temperature: 0.5, // Default temperature for non-DeepSeek models | ||
| messages: expect.arrayContaining([{ role: "system", content: systemPrompt }]), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P3] Strengthen assertion: also verify the user message is passed through to the OpenAI client to catch regressions in message composition for non-DeepSeek models (in addition to the system prompt). Consider asserting arrayContaining includes both the system and user entries. |
||
| stream: true, | ||
| stream_options: { include_usage: true }, | ||
| }), | ||
| undefined, | ||
| ) | ||
| }) | ||
| }) | ||
Uh oh!
There was an error while loading. Please reload this page.