Skip to content

Commit

Permalink
Update package versions and add Groq model support
Browse files Browse the repository at this point in the history
  • Loading branch information
n4ze3m committed Mar 12, 2024
1 parent bcbbdef commit b660e3e
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "app",
"private": true,
"version": "1.7.6",
"version": "1.7.7",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
2 changes: 1 addition & 1 deletion app/ui/src/components/Settings/Model/EMForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export const EMForm: React.FC<Props> = ({ setOpenAddEmbeddingModel }) => {
{embeddingType === "openai" && (
<Form
onFinish={(value) => {
fetchLocalModels(value);
saveEmbeddingModel(value);
}}
form={embeddingForm}
layout="vertical"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
1 change: 1 addition & 0 deletions server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
27 changes: 27 additions & 0 deletions server/prisma/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
9 changes: 8 additions & 1 deletion server/src/utils/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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({
Expand Down
6 changes: 6 additions & 0 deletions server/src/utils/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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:
Expand Down
37 changes: 36 additions & 1 deletion server/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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==
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit b660e3e

Please sign in to comment.