diff --git a/bun.lockb b/bun.lockb index 49b0418..01789b7 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 663183c..7ff16ac 100644 --- a/package.json +++ b/package.json @@ -82,6 +82,7 @@ }, "optionalDependencies": { "langsmith": "^0.1.41", - "@langchain/mistralai": "^0.0.28" + "@langchain/mistralai": "^0.0.28", + "@langchain/anthropic": "^0.2.15" } } diff --git a/src/models.ts b/src/models.ts index d48abfa..db12e9e 100644 --- a/src/models.ts +++ b/src/models.ts @@ -3,6 +3,7 @@ import { ChatOpenAI } from "@langchain/openai"; import { Client as LangsmithClient } from "langsmith"; import type { OLLAMA_MODELS } from "./constants"; import { ChatMistralAI } from "@langchain/mistralai"; +import { ChatAnthropic } from "@langchain/anthropic"; // Initialize global Langsmith tracer // We use a global variable because: @@ -263,3 +264,10 @@ export const mistralai = (model: string, options?: Omit ...options, }); }; + +export const antrophic = (model: string, options?: Omit) => { + return new ChatAnthropic({ + model, + ...options, + }); +}; diff --git a/src/types.ts b/src/types.ts index 48ecac8..14455f7 100644 --- a/src/types.ts +++ b/src/types.ts @@ -5,6 +5,7 @@ import type { Redis } from "@upstash/redis"; import type { Index } from "@upstash/vector"; import type { CustomPrompt } from "./rag-chat"; import type { ChatMistralAI } from "@langchain/mistralai"; +import type { ChatAnthropic } from "@langchain/anthropic"; declare const __brand: unique symbol; type Brand = { [__brand]: B }; @@ -96,7 +97,7 @@ export type RAGChatConfig = { */ // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents - model?: ChatOpenAI | ChatMistralAI | OpenAIChatLanguageModel; + model?: ChatOpenAI | ChatMistralAI | ChatAnthropic | OpenAIChatLanguageModel; /** * Ratelimit instance * @example new Ratelimit({