From ac0e62d490eb8ee51d126735c710273e6ce2fd76 Mon Sep 17 00:00:00 2001
From: Sean Hatfield <seanhatfield5@gmail.com>
Date: Wed, 13 Mar 2024 17:32:02 -0700
Subject: [PATCH] [FEAT] Anthropic Haiku model support (#901)

add Haiku model support
---
 .../src/components/LLMSelection/AnthropicAiOptions/index.jsx   | 1 +
 frontend/src/hooks/useGetProvidersModels.js                    | 1 +
 server/utils/AiProviders/anthropic/index.js                    | 3 +++
 server/utils/helpers/updateENV.js                              | 1 +
 4 files changed, 6 insertions(+)

diff --git a/frontend/src/components/LLMSelection/AnthropicAiOptions/index.jsx b/frontend/src/components/LLMSelection/AnthropicAiOptions/index.jsx
index 6bc18a5ac..e8c288d60 100644
--- a/frontend/src/components/LLMSelection/AnthropicAiOptions/index.jsx
+++ b/frontend/src/components/LLMSelection/AnthropicAiOptions/index.jsx
@@ -52,6 +52,7 @@ export default function AnthropicAiOptions({ settings, showAlert = false }) {
               "claude-instant-1.2",
               "claude-2.0",
               "claude-2.1",
+              "claude-3-haiku-20240307",
               "claude-3-opus-20240229",
               "claude-3-sonnet-20240229",
             ].map((model) => {
diff --git a/frontend/src/hooks/useGetProvidersModels.js b/frontend/src/hooks/useGetProvidersModels.js
index 57a95ea7a..f578c929f 100644
--- a/frontend/src/hooks/useGetProvidersModels.js
+++ b/frontend/src/hooks/useGetProvidersModels.js
@@ -19,6 +19,7 @@ const PROVIDER_DEFAULT_MODELS = {
     "claude-2.1",
     "claude-3-opus-20240229",
     "claude-3-sonnet-20240229",
+    "claude-3-haiku-20240307",
   ],
   azure: [],
   lmstudio: [],
diff --git a/server/utils/AiProviders/anthropic/index.js b/server/utils/AiProviders/anthropic/index.js
index fea083329..24a07f6e5 100644
--- a/server/utils/AiProviders/anthropic/index.js
+++ b/server/utils/AiProviders/anthropic/index.js
@@ -48,6 +48,8 @@ class AnthropicLLM {
         return 200_000;
       case "claude-3-sonnet-20240229":
         return 200_000;
+      case "claude-3-haiku-20240307":
+        return 200_000;
       default:
         return 100_000; // assume a claude-instant-1.2 model
     }
@@ -60,6 +62,7 @@ class AnthropicLLM {
       "claude-2.1",
       "claude-3-opus-20240229",
       "claude-3-sonnet-20240229",
+      "claude-3-haiku-20240307",
     ];
     return validModels.includes(modelName);
   }
diff --git a/server/utils/helpers/updateENV.js b/server/utils/helpers/updateENV.js
index aa814d690..e46074a7c 100644
--- a/server/utils/helpers/updateENV.js
+++ b/server/utils/helpers/updateENV.js
@@ -365,6 +365,7 @@ function validAnthropicModel(input = "") {
     "claude-2.1",
     "claude-3-opus-20240229",
     "claude-3-sonnet-20240229",
+    "claude-3-haiku-20240307",
   ];
   return validModels.includes(input)
     ? null
-- 
GitLab