Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/happy-doors-smash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'token.js': minor
---

Add support for Codestral Mamba
1 change: 1 addition & 0 deletions docs/providers/mistral.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ main()
| mistral-large-2402 |||||||
| codestral-latest |||||||
| codestral-2405 |||||||
| codestral-mamba-2407 |||||||

### Legend
| Symbol | Description |
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export abstract class BaseHandler<T extends LLMChatModel> {
throw new InputError(`Invalid 'model' field: ${body.model}.`)
}

if (!this.supportsStreaming(body.model)) {
if (body.stream && !this.supportsStreaming(body.model)) {
throw new Error(
`Detected 'stream: true', but the following model does not support streaming: ${body.model}`
)
Expand Down
4 changes: 4 additions & 0 deletions src/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ export const models = {
'mistral-large-2402',
'codestral-latest',
'codestral-2405',
'codestral-mamba-2407',
] as const,
supportsCompletion: true,
supportsStreaming: [
Expand All @@ -282,6 +283,7 @@ export const models = {
'mistral-large-2402',
'codestral-latest',
'codestral-2405',
'codestral-mamba-2407',
] as const,
// Mistral claims that all of its models support JSON, but several of their weaker models either
// fail to produce valid JSON or produce very low quality results for the following prompt:
Expand All @@ -296,6 +298,7 @@ export const models = {
'mistral-large-2402',
'codestral-latest',
'codestral-2405',
'codestral-mamba-2407',
] as const,
supportsImages: [] as const,
supportsToolCalls: [
Expand All @@ -305,6 +308,7 @@ export const models = {
'mistral-small-2402',
'mistral-large-latest',
'mistral-large-2402',
'codestral-mamba-2407',
] as const,
supportsN: false,
},
Expand Down
1 change: 1 addition & 0 deletions test/automated/handlers/base.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ describe('Base Handler', () => {
provider: 'openai',
model: 'dummyModel' as any,
messages: getDummyMessages(),
stream: true,
})
).rejects.toThrow(
new InputError(
Expand Down