From a9d7a7e7b9cd47ee5d53fb97a17850f2b35febad Mon Sep 17 00:00:00 2001 From: Akshay Gulati Date: Tue, 22 Oct 2024 23:24:03 -0700 Subject: [PATCH] chore: add anthropic claude-3.5-sonnet-20241022 --- .../claude-3-5-sonnet-20241022.anthropic.ts | 45 +++++++++++++++++++ .../anthropic/src/models/chat-models/index.ts | 1 + .../src/provider/provider.anthropic.ts | 5 +++ 3 files changed, 51 insertions(+) create mode 100644 core/providers/anthropic/src/models/chat-models/claude-3-5-sonnet-20241022.anthropic.ts diff --git a/core/providers/anthropic/src/models/chat-models/claude-3-5-sonnet-20241022.anthropic.ts b/core/providers/anthropic/src/models/chat-models/claude-3-5-sonnet-20241022.anthropic.ts new file mode 100644 index 0000000..d5c12fb --- /dev/null +++ b/core/providers/anthropic/src/models/chat-models/claude-3-5-sonnet-20241022.anthropic.ts @@ -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; + +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, +}; diff --git a/core/providers/anthropic/src/models/chat-models/index.ts b/core/providers/anthropic/src/models/chat-models/index.ts index 6c74629..311609e 100644 --- a/core/providers/anthropic/src/models/chat-models/index.ts +++ b/core/providers/anthropic/src/models/chat-models/index.ts @@ -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"; \ No newline at end of file diff --git a/core/providers/anthropic/src/provider/provider.anthropic.ts b/core/providers/anthropic/src/provider/provider.anthropic.ts index 2eabeac..a74a869 100644 --- a/core/providers/anthropic/src/provider/provider.anthropic.ts +++ b/core/providers/anthropic/src/provider/provider.anthropic.ts @@ -39,6 +39,11 @@ class Anthropic