diff --git a/.github/workflows/dev-build.yaml b/.github/workflows/dev-build.yaml index 78730533774..111e38d6ff4 100644 --- a/.github/workflows/dev-build.yaml +++ b/.github/workflows/dev-build.yaml @@ -6,7 +6,7 @@ concurrency: on: push: - branches: ['sharp-pdf-image-converter'] # put your current branch to create a build. Core team only. + branches: ['chore/anthropic-model-endpoint'] # put your current branch to create a build. Core team only. paths-ignore: - '**.md' - 'cloud-deployments/*' diff --git a/frontend/src/components/LLMSelection/AnthropicAiOptions/index.jsx b/frontend/src/components/LLMSelection/AnthropicAiOptions/index.jsx index 026282ea49e..95cda6ef54b 100644 --- a/frontend/src/components/LLMSelection/AnthropicAiOptions/index.jsx +++ b/frontend/src/components/LLMSelection/AnthropicAiOptions/index.jsx @@ -1,4 +1,12 @@ +import { useState, useEffect } from "react"; +import System from "@/models/system"; + export default function AnthropicAiOptions({ settings }) { + const [inputValue, setInputValue] = useState(settings?.AnthropicApiKey); + const [anthropicApiKey, setAnthropicApiKey] = useState( + settings?.AnthropicApiKey + ); + return (
@@ -15,45 +23,117 @@ export default function AnthropicAiOptions({ settings }) { required={true} autoComplete="off" spellCheck={false} + onChange={(e) => setInputValue(e.target.value)} + onBlur={() => setAnthropicApiKey(inputValue)} />
{!settings?.credentialsOnly && ( -
- - -
+ )}
); } + +const DEFAULT_MODELS = [ + { + id: "claude-3-7-sonnet-20250219", + name: "Claude 3.7 Sonnet", + }, + { + id: "claude-3-5-sonnet-20241022", + name: "Claude 3.5 Sonnet (New)", + }, + { + id: "claude-3-5-haiku-20241022", + name: "Claude 3.5 Haiku", + }, + { + id: "claude-3-5-sonnet-20240620", + name: "Claude 3.5 Sonnet (Old)", + }, + { + id: "claude-3-haiku-20240307", + name: "Claude 3 Haiku", + }, + { + id: "claude-3-opus-20240229", + name: "Claude 3 Opus", + }, + { + id: "claude-3-sonnet-20240229", + name: "Claude 3 Sonnet", + }, + { + id: "claude-2.1", + name: "Claude 2.1", + }, + { + id: "claude-2.0", + name: "Claude 2.0", + }, +]; + +function AnthropicModelSelection({ apiKey, settings }) { + const [models, setModels] = useState(DEFAULT_MODELS); + const [loading, setLoading] = useState(true); + + useEffect(() => { + async function findCustomModels() { + setLoading(true); + const { models } = await System.customModels( + "anthropic", + typeof apiKey === "boolean" ? null : apiKey + ); + if (models.length > 0) setModels(models); + setLoading(false); + } + findCustomModels(); + }, [apiKey]); + + if (loading) { + return ( +
+ + +
+ ); + } + + return ( +
+ + +
+ ); +} diff --git a/frontend/src/hooks/useGetProvidersModels.js b/frontend/src/hooks/useGetProvidersModels.js index 2019a19dfca..0b314349073 100644 --- a/frontend/src/hooks/useGetProvidersModels.js +++ b/frontend/src/hooks/useGetProvidersModels.js @@ -25,21 +25,7 @@ const PROVIDER_DEFAULT_MODELS = { "learnlm-1.5-pro-experimental", "gemini-2.0-flash-exp", ], - anthropic: [ - "claude-instant-1.2", - "claude-2.0", - "claude-2.1", - "claude-3-haiku-20240307", - "claude-3-sonnet-20240229", - "claude-3-opus-latest", - "claude-3-5-haiku-latest", - "claude-3-5-haiku-20241022", - "claude-3-5-sonnet-latest", - "claude-3-5-sonnet-20241022", - "claude-3-5-sonnet-20240620", - "claude-3-7-sonnet-20250219", - "claude-3-7-sonnet-latest", - ], + anthropic: [], azure: [], lmstudio: [], localai: [], diff --git a/frontend/src/pages/WorkspaceSettings/ChatSettings/WorkspaceLLMSelection/ChatModelSelection/index.jsx b/frontend/src/pages/WorkspaceSettings/ChatSettings/WorkspaceLLMSelection/ChatModelSelection/index.jsx index 9c794a15ea1..9440cddbc21 100644 --- a/frontend/src/pages/WorkspaceSettings/ChatSettings/WorkspaceLLMSelection/ChatModelSelection/index.jsx +++ b/frontend/src/pages/WorkspaceSettings/ChatSettings/WorkspaceLLMSelection/ChatModelSelection/index.jsx @@ -73,7 +73,7 @@ export default function ChatModelSelection({ )} {Array.isArray(customModels) && customModels.length > 0 && ( - + {customModels.map((model) => { return (