forked from ai-shifu/ChatALL
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Groq Cloud support, close ai-shifu#716
Reference: - https://console.groq.com/docs/models - https://github.com/langchain-ai/langchainjs/tree/main/libs/langchain-groq/
- Loading branch information
1 parent
e519453
commit 544cea9
Showing
22 changed files
with
210 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import GroqAPIBot from "./GroqAPIBot"; | ||
|
||
export default class Gemma7bGroqAPIBot extends GroqAPIBot { | ||
static _className = "Gemma7bGroqAPIBot"; | ||
static _logoFilename = "gemma-7b-it-groq-logo.png"; | ||
static _model = "gemma-7b-it"; | ||
constructor() { | ||
super(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import LangChainBot from "../LangChainBot"; | ||
import store from "@/store"; | ||
import { ChatGroq } from "@langchain/groq"; | ||
|
||
export default class GroqAPIBot extends LangChainBot { | ||
static _brandId = "groqApi"; | ||
static _className = "GroqAPIBot"; | ||
|
||
constructor() { | ||
super(); | ||
} | ||
|
||
async _checkAvailability() { | ||
let available = false; | ||
|
||
if (store.state.groqApi.apiKey) { | ||
this.setupModel(); | ||
available = true; | ||
} | ||
return available; | ||
} | ||
|
||
_setupModel() { | ||
const chatModel = new ChatGroq({ | ||
apiKey: store.state.groqApi.apiKey, | ||
modelName: this.constructor._model ? this.constructor._model : "", | ||
streaming: true, | ||
temperature: store.state.groqApi.temperature, | ||
maxTokens: store.state.groqApi.maxTokens, | ||
}); | ||
|
||
return chatModel; | ||
} | ||
|
||
getPastRounds() { | ||
return store.state.groqApi.pastRounds ? store.state.groqApi.pastRounds : 1; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import GroqAPIBot from "./GroqAPIBot"; | ||
|
||
export default class Llama270bGroqAPIBot extends GroqAPIBot { | ||
static _className = "Llama270bGroqAPIBot"; | ||
static _logoFilename = "llama-2-70b-groq-logo.png"; | ||
static _model = "llama2-70b-4096"; | ||
constructor() { | ||
super(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import GroqAPIBot from "./GroqAPIBot"; | ||
|
||
export default class Mixtral8x7bGroqAPIBot extends GroqAPIBot { | ||
static _className = "Mixtral8x7bGroqAPIBot"; | ||
static _logoFilename = "mistral-8x7b-groq-logo.png"; | ||
static _model = "mixtral-8x7b-32768"; | ||
constructor() { | ||
super(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<template> | ||
<CommonBotSettings | ||
:settings="settings" | ||
:brand-id="brandId" | ||
mutation-type="setGroqApi" | ||
:watcher="watcher" | ||
></CommonBotSettings> | ||
</template> | ||
|
||
<script> | ||
import _bots from "@/bots"; | ||
import Bot from "@/bots/groq/GroqAPIBot"; | ||
import CommonBotSettings from "@/components/BotSettings/CommonBotSettings.vue"; | ||
import { Type } from "./settings.const"; | ||
const settings = [ | ||
{ | ||
type: Type.Text, | ||
name: "apiKey", | ||
title: "groqApi.apiKey", | ||
description: "settings.secretPrompt", | ||
placeholder: "gsk_...", | ||
}, | ||
{ | ||
type: Type.Slider, | ||
name: "temperature", | ||
title: "openaiApi.temperature", | ||
description: "openaiApi.temperaturePrompt", | ||
min: 0, | ||
max: 1, | ||
step: 0.1, | ||
ticks: { | ||
0: "openaiApi.temperature0", | ||
1: "openaiApi.temperature2", | ||
}, | ||
}, | ||
]; | ||
export default { | ||
components: { | ||
CommonBotSettings, | ||
}, | ||
data() { | ||
return { | ||
settings: settings, | ||
brandId: Bot._brandId, | ||
}; | ||
}, | ||
methods: { | ||
watcher() { | ||
_bots.all | ||
.filter((bot) => bot instanceof Bot) | ||
.map((bot) => bot.setupModel()); | ||
}, | ||
}, | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters