diff --git a/app/ui/package.json b/app/ui/package.json index 2c3c63b7..3efd7857 100644 --- a/app/ui/package.json +++ b/app/ui/package.json @@ -1,7 +1,7 @@ { "name": "app", "private": true, - "version": "1.7.6", + "version": "1.7.7", "type": "module", "scripts": { "dev": "vite", diff --git a/app/ui/src/components/Settings/Model/EMForm.tsx b/app/ui/src/components/Settings/Model/EMForm.tsx index adeb8035..96f08266 100644 --- a/app/ui/src/components/Settings/Model/EMForm.tsx +++ b/app/ui/src/components/Settings/Model/EMForm.tsx @@ -124,7 +124,7 @@ export const EMForm: React.FC = ({ setOpenAddEmbeddingModel }) => { {embeddingType === "openai" && (
{ - fetchLocalModels(value); + saveEmbeddingModel(value); }} form={embeddingForm} layout="vertical" diff --git a/package.json b/package.json index 4f253b61..4b308806 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dialoqbase", - "version": "1.7.6", + "version": "1.7.7", "description": "Create chatbots with ease", "scripts": { "ui:dev": "pnpm run --filter ui dev", diff --git a/server/package.json b/server/package.json index 33073d73..7768d30c 100644 --- a/server/package.json +++ b/server/package.json @@ -45,6 +45,7 @@ "@langchain/cohere": "^0.0.5", "@langchain/community": "^0.0.35", "@langchain/google-genai": "^0.0.10", + "@langchain/groq": "^0.0.3", "@langchain/openai": "^0.0.18", "@prisma/client": "^5.9.1", "@slack/bolt": "^3.13.2", diff --git a/server/prisma/seed.ts b/server/prisma/seed.ts index 51610bdc..d42a0ba6 100644 --- a/server/prisma/seed.ts +++ b/server/prisma/seed.ts @@ -289,6 +289,33 @@ const LLMS: { local_model: false, config: "{}", }, + { + name: "LLaMA2-70b (Groq)", + model_id: "llama2-70b-4096-dbase", + model_type: "chat", + model_provider: "Groq", + stream_available: true, + local_model: false, + config: "{}", + }, + { + name: "Mixtral-8x7b (Groq)", + model_id: "mixtral-8x7b-32768-dbase", + model_type: "chat", + model_provider: "Groq", + stream_available: true, + local_model: false, + config: "{}", + }, + { + name: "Gemma-7b-it (Groq)", + model_id: "gemma-7b-it-dbase", + model_type: "chat", + model_provider: "Groq", + stream_available: true, + local_model: false, + config: "{}", + } ]; const EMBEDDING_MODELS: { diff --git a/server/src/utils/models.ts b/server/src/utils/models.ts index 71966955..3d26b958 100644 --- a/server/src/utils/models.ts +++ b/server/src/utils/models.ts @@ -7,6 +7,7 @@ import { OpenAI } from "@langchain/openai"; import { ChatGoogleGenerativeAI } from "@langchain/google-genai"; import { ChatOllama } from "@langchain/community/chat_models/ollama"; import { Replicate } from "@langchain/community/llms/replicate"; +import { ChatGroq } from "@langchain/groq" export const chatModelProvider = ( provider: string, @@ -65,7 +66,7 @@ export const chatModelProvider = ( return new ChatOpenAI({ modelName: modelName, temperature: temperature, - openAIApiKey: otherFields.apiKey || process.env.OPENAI_API_KEY , + openAIApiKey: otherFields.apiKey || process.env.OPENAI_API_KEY, ...otherFields, configuration: { baseURL: otherFields.baseURL, @@ -97,6 +98,12 @@ export const chatModelProvider = ( apiKey: otherFields.apiKey, ...otherFields, }); + case "groq": + return new ChatGroq({ + model: modelName, + temperature: temperature, + ...otherFields, + }); default: console.log("using default"); return new ChatOpenAI({ diff --git a/server/src/utils/validate.ts b/server/src/utils/validate.ts index cc46c75a..052757a6 100644 --- a/server/src/utils/validate.ts +++ b/server/src/utils/validate.ts @@ -45,6 +45,10 @@ export const apiKeyValidaton = (modelType: string) => { return process.env.FIREWORKS_API_KEY ? process.env.FIREWORKS_API_KEY.length > 0 : false; + case "groq": + return process.env.GROQ_API_KEY + ? process.env.GROQ_API_KEY.length > 0 + : false; default: return false; } @@ -72,6 +76,8 @@ export const apiKeyValidatonMessage = (modelType: string) => { return "Please add FIREWORKS_API_KEY to your .env file"; case "jina-api": return "Please add JINA_API_KEY to your .env file"; + case "groq": + return "Please add GROQ_API_KEY to your .env file"; // case "replicate": // return "Please add REPLICATE_API_TOKEN to your .env file"; default: diff --git a/server/yarn.lock b/server/yarn.lock index 51eac1e5..0fe20c49 100644 --- a/server/yarn.lock +++ b/server/yarn.lock @@ -708,7 +708,7 @@ uuid "^9.0.0" zod "^3.22.3" -"@langchain/core@0.1.43", "@langchain/core@~0.1", "@langchain/core@~0.1.36", "@langchain/core@~0.1.41", "@langchain/core@~0.1.5": +"@langchain/core@0.1.43", "@langchain/core@~0.1", "@langchain/core@~0.1.13", "@langchain/core@~0.1.36", "@langchain/core@~0.1.41", "@langchain/core@~0.1.5": version "0.1.43" resolved "https://registry.yarnpkg.com/@langchain/core/-/core-0.1.43.tgz#2d0af42817f8d431bba5252b2ff667a9cb3a25e5" integrity sha512-owE+UU38e4TsUq5yoaKCF+ag6u0ppwgdaqEt2Q57pdcr9nEcy8/PgTunxB10Vksq4fTJgnwWEYf/wMGZnFlRow== @@ -733,6 +733,26 @@ "@google/generative-ai" "^0.1.3" "@langchain/core" "~0.1.5" +"@langchain/groq@^0.0.3": + version "0.0.3" + resolved "https://registry.yarnpkg.com/@langchain/groq/-/groq-0.0.3.tgz#0f890501e308d86b2ccc08be4bbe4591d697dd3a" + integrity sha512-VJc0madTIsTr+bu/RXHg3ZN0TuUdunESNh39TtctrS/mJvgQXOCA1GDe5kTqv5naegFJh4oO3noR+4DbfDtrUA== + dependencies: + "@langchain/core" "~0.1" + "@langchain/openai" "^0.0.14" + groq-sdk "^0.3.0" + +"@langchain/openai@^0.0.14": + version "0.0.14" + resolved "https://registry.yarnpkg.com/@langchain/openai/-/openai-0.0.14.tgz#27a6ba83f6b754391868b22f3b90cd440038acf0" + integrity sha512-co6nRylPrLGY/C3JYxhHt6cxLq07P086O7K3QaZH7SFFErIN9wSzJonpvhZR07DEUq6eK6wKgh2ORxA/NcjSRQ== + dependencies: + "@langchain/core" "~0.1.13" + js-tiktoken "^1.0.7" + openai "^4.26.0" + zod "^3.22.4" + zod-to-json-schema "^3.22.3" + "@langchain/openai@^0.0.18", "@langchain/openai@~0.0.14": version "0.0.18" resolved "https://registry.yarnpkg.com/@langchain/openai/-/openai-0.0.18.tgz#57db3984a82424bbedc94925c3f9b629458ea519" @@ -3441,6 +3461,21 @@ grammy@^1.16.2: debug "^4.3.4" node-fetch "^2.6.9" +groq-sdk@^0.3.0: + version "0.3.2" + resolved "https://registry.yarnpkg.com/groq-sdk/-/groq-sdk-0.3.2.tgz#f5e64732791e25910a8f11d228f232816ef6047f" + integrity sha512-Xp1xOea7nqUcTMndpiA8VkjZ05jM/eUUeCILxhRF+c2etBz/myQwRcUrr5lpWc0euIt96AiBMa9aYa0Iqrh13g== + dependencies: + "@types/node" "^18.11.18" + "@types/node-fetch" "^2.6.4" + abort-controller "^3.0.0" + agentkeepalive "^4.2.1" + digest-fetch "^1.3.0" + form-data-encoder "1.7.2" + formdata-node "^4.3.2" + node-fetch "^2.6.7" + web-streams-polyfill "^3.2.1" + gtoken@^6.1.0: version "6.1.2" resolved "https://registry.yarnpkg.com/gtoken/-/gtoken-6.1.2.tgz#aeb7bdb019ff4c3ba3ac100bbe7b6e74dce0e8bc"