mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-12 04:15:30 +00:00
feat(ask_sb): Fallback on fromNodeProviderChain if access key or sessionToken are not provided (#513)
This commit is contained in:
parent
b217fbe07d
commit
f73a425207
4 changed files with 1116 additions and 108 deletions
|
|
@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
- Added fallback to default the Node.JS AWS SDK's `fromNodeProviderChain` when no credentials are provided for a bedrock config. [#513](https://github.com/sourcebot-dev/sourcebot/pull/513)
|
||||
|
||||
### Fixed
|
||||
- Fixed "At least one project, user, or group must be specified" for GitLab configs with `all` in web configurator. [#512](https://github.com/sourcebot-dev/sourcebot/pull/512)
|
||||
|
||||
|
|
|
|||
|
|
@ -12,18 +12,19 @@
|
|||
"stripe:listen": "stripe listen --forward-to http://localhost:3000/api/stripe"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ai-sdk/amazon-bedrock": "^3.0.3",
|
||||
"@ai-sdk/anthropic": "^2.0.1",
|
||||
"@ai-sdk/azure": "^2.0.5",
|
||||
"@ai-sdk/deepseek": "^1.0.2",
|
||||
"@ai-sdk/google": "^2.0.3",
|
||||
"@ai-sdk/google-vertex": "^3.0.4",
|
||||
"@ai-sdk/mistral": "^2.0.1",
|
||||
"@ai-sdk/openai": "^2.0.5",
|
||||
"@ai-sdk/openai-compatible": "^1.0.2",
|
||||
"@ai-sdk/react": "^2.0.8",
|
||||
"@ai-sdk/xai": "^2.0.2",
|
||||
"@ai-sdk/amazon-bedrock": "^3.0.22",
|
||||
"@ai-sdk/anthropic": "^2.0.17",
|
||||
"@ai-sdk/azure": "^2.0.32",
|
||||
"@ai-sdk/deepseek": "^1.0.18",
|
||||
"@ai-sdk/google": "^2.0.14",
|
||||
"@ai-sdk/google-vertex": "^3.0.27",
|
||||
"@ai-sdk/mistral": "^2.0.14",
|
||||
"@ai-sdk/openai": "^2.0.32",
|
||||
"@ai-sdk/openai-compatible": "^1.0.18",
|
||||
"@ai-sdk/react": "^2.0.45",
|
||||
"@ai-sdk/xai": "^2.0.20",
|
||||
"@auth/prisma-adapter": "^2.7.4",
|
||||
"@aws-sdk/credential-providers": "^3.890.0",
|
||||
"@codemirror/commands": "^6.6.0",
|
||||
"@codemirror/lang-cpp": "^6.0.2",
|
||||
"@codemirror/lang-css": "^6.3.0",
|
||||
|
|
@ -109,7 +110,7 @@
|
|||
"@vercel/otel": "^1.13.0",
|
||||
"@viz-js/lang-dot": "^1.0.4",
|
||||
"@xiechao/codemirror-lang-handlebars": "^1.0.4",
|
||||
"ai": "^5.0.8",
|
||||
"ai": "^5.0.45",
|
||||
"ajv": "^8.17.1",
|
||||
"bcryptjs": "^3.0.2",
|
||||
"chokidar": "^4.0.3",
|
||||
|
|
|
|||
|
|
@ -18,17 +18,18 @@ import { createOpenAI, OpenAIResponsesProviderOptions } from "@ai-sdk/openai";
|
|||
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
|
||||
import { LanguageModelV2 as AISDKLanguageModelV2 } from "@ai-sdk/provider";
|
||||
import { createXai } from '@ai-sdk/xai';
|
||||
import { fromNodeProviderChain } from '@aws-sdk/credential-providers';
|
||||
import { createOpenRouter } from '@openrouter/ai-sdk-provider';
|
||||
import { getTokenFromConfig } from "@sourcebot/crypto";
|
||||
import { ChatVisibility, OrgRole, Prisma, PrismaClient } from "@sourcebot/db";
|
||||
import { LanguageModel } from "@sourcebot/schemas/v3/languageModel.type";
|
||||
import { Token } from "@sourcebot/schemas/v3/shared.type";
|
||||
import { loadConfig } from "@sourcebot/shared";
|
||||
import { generateText, JSONValue } from "ai";
|
||||
import fs from 'fs';
|
||||
import { StatusCodes } from "http-status-codes";
|
||||
import path from 'path';
|
||||
import { LanguageModelInfo, SBChatMessage } from "./types";
|
||||
import { Token } from "@sourcebot/schemas/v3/shared.type";
|
||||
|
||||
export const createChat = async (domain: string) => sew(() =>
|
||||
withAuth((userId) =>
|
||||
|
|
@ -396,6 +397,11 @@ export const _getAISDKLanguageModelAndOptions = async (config: LanguageModel, or
|
|||
headers: config.headers
|
||||
? await extractLanguageModelKeyValuePairs(config.headers, orgId, prisma)
|
||||
: undefined,
|
||||
// Fallback to the default Node.js credential provider chain if no credentials are provided.
|
||||
// See: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-credential-providers/#fromnodeproviderchain
|
||||
credentialProvider: !config.accessKeyId && !config.accessKeySecret && !config.sessionToken
|
||||
? fromNodeProviderChain()
|
||||
: undefined,
|
||||
});
|
||||
|
||||
return {
|
||||
|
|
|
|||
Loading…
Reference in a new issue