feat(providers): fix loading issues

This commit is contained in:
ItzCrazyKns
2024-07-08 15:39:27 +05:30
parent 3b4b8a8b02
commit 8539ce82ad
5 changed files with 27 additions and 11 deletions

View File

@ -5,6 +5,8 @@ import logger from '../../utils/logger';
export const loadOpenAIChatModels = async () => {
const openAIApiKey = getOpenaiApiKey();
if (!openAIApiKey) return {};
try {
const chatModels = {
'GPT-3.5 turbo': new ChatOpenAI({
@ -36,9 +38,11 @@ export const loadOpenAIChatModels = async () => {
}
};
export const loadOpenAIEmbeddingsModel = async () => {
export const loadOpenAIEmbeddingsModels = async () => {
const openAIApiKey = getOpenaiApiKey();
if (!openAIApiKey) return {};
try {
const embeddingModels = {
'Text embedding 3 small': new OpenAIEmbeddings({