Skip to content

feat: Update Model Names to Jamba-Mini and Jamba-Large #28

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

Merged
merged 4 commits into from
Mar 30, 2025
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const client = new AI21({
});

const response = await client.chat.completions.create({
model: 'jamba-1.5-mini',
model: 'jamba-mini',
messages: [{ role: 'user', content: 'Hello, how are you? tell me a 100 line story about a cat named "Fluffy"' }],
});

Expand All @@ -96,7 +96,7 @@ The client supports streaming responses for real-time processing. Here are examp

```typescript
const streamResponse = await client.chat.completions.create({
model: 'jamba-1.5-mini',
model: 'jamba-mini',
messages: [{ role: 'user', content: 'Write a story about a space cat' }],
stream: true,
});
Expand Down
2 changes: 1 addition & 1 deletion examples/studio/chat/chat-completions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ async function main() {

try {
const response = await client.chat.completions.create({
model: 'jamba-1.5-mini',
model: 'jamba-mini',
messages: [{ role: 'user', content: 'Hello, how are you? tell me a 100 line story about a cat' }],
});
console.log(response);
Expand Down
2 changes: 1 addition & 1 deletion examples/studio/chat/chat-documents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async function main() {

try {
const response = await client.chat.completions.create({
model: 'jamba-1.5-mini',
model: 'jamba-mini',
messages: [
{
role: 'system',
Expand Down
2 changes: 1 addition & 1 deletion examples/studio/chat/chat-response-format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async function main() {
try {
const response = await client.chat.completions.create({
messages,
model: 'jamba-1.5-large',
model: 'jamba-large',
responseFormat,
});

Expand Down
2 changes: 1 addition & 1 deletion examples/studio/chat/stream-chat-completions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ async function main() {

try {
const streamResponse = await client.chat.completions.create({
model: 'jamba-1.5-mini',
model: 'jamba-mini',
messages: [{ role: 'user', content: 'Hello, how are you? tell me a short story' }],
stream: true,
});
Expand Down
4 changes: 2 additions & 2 deletions examples/studio/chat/tools-chat-completions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ async function main() {
try {
// First response with streaming
const response = await client.chat.completions.create({
model: 'jamba-1.5-large',
model: 'jamba-large',
messages,
tools,
});
Expand All @@ -69,7 +69,7 @@ async function main() {

// Get final response
const finalResponse = await client.chat.completions.create({
model: 'jamba-1.5-large',
model: 'jamba-large',
messages,
tools,
});
Expand Down
10 changes: 10 additions & 0 deletions src/resources/chat/completions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import * as Models from '../../types';
import { APIResource } from '../../APIResource';
import { Stream } from '../../streaming';

const deprecatedModels = ['jamba-1.5-mini', 'jamba-1.5-large'];

export class Completions extends APIResource {
create(
body: Models.ChatCompletionCreateParamsNonStreaming,
Expand All @@ -19,6 +21,14 @@ export class Completions extends APIResource {
): Promise<Stream<Models.ChatCompletionChunk> | Models.ChatCompletionResponse>;

create(body: Models.ChatCompletionCreateParams, options?: Models.RequestOptions) {
// Check for deprecated models
if (deprecatedModels.includes(body.model)) {
console.warn(
`Warning: The model "${body.model}" is deprecated and will be removed in a future release.
Please use jamba-mini or jamba-large instead.`,
);
}

return this.client.post<Models.ChatCompletionCreateParams, Models.ChatCompletionResponse>(
'/chat/completions',
{
Expand Down
10 changes: 9 additions & 1 deletion src/types/chat/ChatModel.ts
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
export type ChatModel = 'jamba-1.5-mini' | 'jamba-1.5-large';
export type ChatModel =
| 'jamba-mini'
| 'jamba-large'
| 'jamba-large-1.6-2025-03'
| 'jamba-mini-1.6-2025-03'
| 'jamba-large-1.6'
| 'jamba-mini-1.6'
| 'jamba-1.5-mini'
| 'jamba-1.5-large';
Loading