Skip to content

Commit a280007

Browse files
authored
Merge pull request #90 from token-js/sg/mamba
feat: add support for Codestral Mamba
2 parents 329e1d3 + e68abf2 commit a280007

File tree

5 files changed

+12
-1
lines changed

5 files changed

+12
-1
lines changed

.changeset/happy-doors-smash.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'token.js': minor
3+
---
4+
5+
Add support for Codestral Mamba

docs/providers/mistral.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ main()
5454
| mistral-large-2402 |||||||
5555
| codestral-latest |||||||
5656
| codestral-2405 |||||||
57+
| codestral-mamba-2407 |||||||
5758

5859
### Legend
5960
| Symbol | Description |

src/handlers/base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export abstract class BaseHandler<T extends LLMChatModel> {
4242
throw new InputError(`Invalid 'model' field: ${body.model}.`)
4343
}
4444

45-
if (!this.supportsStreaming(body.model)) {
45+
if (body.stream && !this.supportsStreaming(body.model)) {
4646
throw new Error(
4747
`Detected 'stream: true', but the following model does not support streaming: ${body.model}`
4848
)

src/models.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ export const models = {
265265
'mistral-large-2402',
266266
'codestral-latest',
267267
'codestral-2405',
268+
'codestral-mamba-2407',
268269
] as const,
269270
supportsCompletion: true,
270271
supportsStreaming: [
@@ -282,6 +283,7 @@ export const models = {
282283
'mistral-large-2402',
283284
'codestral-latest',
284285
'codestral-2405',
286+
'codestral-mamba-2407',
285287
] as const,
286288
// Mistral claims that all of its models support JSON, but several of their weaker models either
287289
// fail to produce valid JSON or produce very low quality results for the following prompt:
@@ -296,6 +298,7 @@ export const models = {
296298
'mistral-large-2402',
297299
'codestral-latest',
298300
'codestral-2405',
301+
'codestral-mamba-2407',
299302
] as const,
300303
supportsImages: [] as const,
301304
supportsToolCalls: [
@@ -305,6 +308,7 @@ export const models = {
305308
'mistral-small-2402',
306309
'mistral-large-latest',
307310
'mistral-large-2402',
311+
'codestral-mamba-2407',
308312
] as const,
309313
supportsN: false,
310314
},

test/automated/handlers/base.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ describe('Base Handler', () => {
100100
provider: 'openai',
101101
model: 'dummyModel' as any,
102102
messages: getDummyMessages(),
103+
stream: true,
103104
})
104105
).rejects.toThrow(
105106
new InputError(

0 commit comments

Comments
 (0)