Skip to content

Commit ce8926d

Browse files
feat: add Amazon Bedrock support with API key authentication
Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
1 parent b6051ce commit ce8926d

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

apps/desktop/src/components/settings/ai/llm/configure.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ function ProviderContext({
105105
? "We filter out models from the combobox based on heuristics like **input modalities** and **tool support**."
106106
: providerId === "google_generative_ai"
107107
? "Visit [AI Studio](https://aistudio.google.com/api-keys) to create an API key."
108-
: "";
108+
: providerId === "amazon_bedrock"
109+
? "Generate an API key in the [AWS Console](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_bedrock.html?icmpid=docs_iam_console)."
110+
: "";
109111

110112
if (providerId === "hyprnote" && !isPro) {
111113
return (

apps/desktop/src/components/settings/ai/llm/shared.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Icon } from "@iconify-icon/react";
22
import {
33
Anthropic,
4+
Aws,
45
LmStudio,
56
Mistral,
67
Ollama,
@@ -94,6 +95,14 @@ const _PROVIDERS = [
9495
baseUrl: "https://generativelanguage.googleapis.com/v1beta",
9596
requirements: [{ kind: "requires_config", fields: ["api_key"] }],
9697
},
98+
{
99+
id: "amazon_bedrock",
100+
displayName: "Amazon Bedrock",
101+
badge: null,
102+
icon: <Aws size={16} />,
103+
baseUrl: undefined,
104+
requirements: [{ kind: "requires_config", fields: ["api_key"] }],
105+
},
97106
{
98107
id: "custom",
99108
displayName: "Custom",

apps/desktop/src/hooks/useLLMConnection.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { createAmazonBedrock } from "@ai-sdk/amazon-bedrock";
12
import { createAnthropic } from "@ai-sdk/anthropic";
23
import { createGoogleGenerativeAI } from "@ai-sdk/google";
34
import { createOpenAI } from "@ai-sdk/openai";
@@ -268,6 +269,14 @@ const createLanguageModel = (
268269
return wrapWithThinkingMiddleware(provider(conn.modelId));
269270
}
270271

272+
case "amazon_bedrock": {
273+
const provider = createAmazonBedrock({
274+
apiKey: conn.apiKey,
275+
region: "us-east-1",
276+
});
277+
return wrapWithThinkingMiddleware(provider(conn.modelId));
278+
}
279+
271280
case "ollama": {
272281
const ollamaOrigin = new URL(conn.baseUrl.replace(/\/v1\/?$/, "")).origin;
273282
const ollamaFetch: typeof fetch = async (input, init) => {

0 commit comments

Comments
 (0)