Skip to content

Commit

Permalink
Merge pull request #4 from adaline/akshay/add_claude_3_5_sonnet
Browse files Browse the repository at this point in the history
chore: add anthropic claude-3.5-sonnet-20241022
  • Loading branch information
adaline-akshay authored Oct 23, 2024
2 parents 243dae4 + a9d7a7e commit 281d950
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { z } from "zod";

import { ChatModelSchema } from "@adaline/provider";

import { AnthropicChatModelConfigs } from "../../configs";
import { BaseChatModel, BaseChatModelOptions } from "./base-chat-model.anthropic";
import {
AnthropicChatModelModalities,
AnthropicChatModelModalitiesEnum,
AnthropicChatModelRoles,
AnthropicChatModelRolesMap,
} from "./types";

const Claude3_5Sonnet20241022Literal = "claude-3-5-sonnet-20241022";
const Claude3_5Sonnet20241022Description = "Most intelligent model. Highest level of intelligence and capability.";

const Claude3_5Sonnet20241022Schema = ChatModelSchema(AnthropicChatModelRoles, AnthropicChatModelModalitiesEnum).parse({
name: Claude3_5Sonnet20241022Literal,
description: Claude3_5Sonnet20241022Description,
maxInputTokens: 200000,
maxOutputTokens: 8192,
roles: AnthropicChatModelRolesMap,
modalities: AnthropicChatModelModalities,
config: {
def: AnthropicChatModelConfigs.base(8192, 4).def,
schema: AnthropicChatModelConfigs.base(8192, 4).schema,
},
});

const Claude3_5Sonnet20241022Options = BaseChatModelOptions;
type Claude3_5Sonnet20241022OptionsType = z.infer<typeof Claude3_5Sonnet20241022Options>;

class Claude3_5Sonnet20241022 extends BaseChatModel {
constructor(options: Claude3_5Sonnet20241022OptionsType) {
super(Claude3_5Sonnet20241022Schema, options);
}
}

export {
Claude3_5Sonnet20241022,
Claude3_5Sonnet20241022Options,
Claude3_5Sonnet20241022Schema,
Claude3_5Sonnet20241022Literal,
type Claude3_5Sonnet20241022OptionsType,
};
1 change: 1 addition & 0 deletions core/providers/anthropic/src/models/chat-models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ export * from "./claude-3-haiku-20240307.anthropic";
export * from "./claude-3-sonnet-20240229.anthropic";
export * from "./claude-3-opus-20240229.anthropic";
export * from "./claude-3-5-sonnet-20240620.anthropic";
export * from "./claude-3-5-sonnet-20241022.anthropic";
5 changes: 5 additions & 0 deletions core/providers/anthropic/src/provider/provider.anthropic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ class Anthropic<C extends Models.BaseChatModelOptionsType, E extends Models.Base
modelOptions: Models.Claude3_5Sonnet20240620Options,
modelSchema: Models.Claude3_5Sonnet20240620Schema,
},
[Models.Claude3_5Sonnet20241022Literal]: {
model: Models.Claude3_5Sonnet20241022,
modelOptions: Models.Claude3_5Sonnet20241022Options,
modelSchema: Models.Claude3_5Sonnet20241022Schema,
},
};

private readonly embeddingModelFactories: Record<
Expand Down

0 comments on commit 281d950

Please sign in to comment.