mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-22 11:01:22 +03:00
Feature/Add Groq for followup prompts (#3806)
Feature/Add-Groq-for-followup-prompts
This commit is contained in:
@@ -427,7 +427,8 @@ export enum FollowUpPromptProvider {
|
||||
AZURE_OPENAI = 'azureChatOpenAI',
|
||||
GOOGLE_GENAI = 'chatGoogleGenerativeAI',
|
||||
MISTRALAI = 'chatMistralAI',
|
||||
OPENAI = 'chatOpenAI'
|
||||
OPENAI = 'chatOpenAI',
|
||||
GROQ = 'groqChat'
|
||||
}
|
||||
|
||||
export type FollowUpPromptProviderConfig = {
|
||||
|
||||
@@ -7,6 +7,7 @@ import { ChatOpenAI } from '@langchain/openai'
|
||||
import { z } from 'zod'
|
||||
import { PromptTemplate } from '@langchain/core/prompts'
|
||||
import { StructuredOutputParser } from '@langchain/core/output_parsers'
|
||||
import { ChatGroq } from '@langchain/groq'
|
||||
|
||||
const FollowUpPromptType = z
|
||||
.object({
|
||||
@@ -108,6 +109,16 @@ export const generateFollowUpPrompts = async (
|
||||
const structuredResponse = await structuredLLM.invoke(followUpPromptsPrompt)
|
||||
return structuredResponse
|
||||
}
|
||||
case FollowUpPromptProvider.GROQ: {
|
||||
const llm = new ChatGroq({
|
||||
apiKey: credentialData.groqApiKey,
|
||||
model: providerConfig.modelName,
|
||||
temperature: parseFloat(`${providerConfig.temperature}`)
|
||||
})
|
||||
const structuredLLM = llm.withStructuredOutput(FollowUpPromptType)
|
||||
const structuredResponse = await structuredLLM.invoke(followUpPromptsPrompt)
|
||||
return structuredResponse
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return undefined
|
||||
|
||||
@@ -13,6 +13,7 @@ import anthropicIcon from '@/assets/images/anthropic.svg'
|
||||
import azureOpenAiIcon from '@/assets/images/azure_openai.svg'
|
||||
import mistralAiIcon from '@/assets/images/mistralai.svg'
|
||||
import openAiIcon from '@/assets/images/openai.svg'
|
||||
import groqIcon from '@/assets/images/groq.png'
|
||||
import { TooltipWithParser } from '@/ui-component/tooltip/TooltipWithParser'
|
||||
import CredentialInputHandler from '@/views/canvas/CredentialInputHandler'
|
||||
import { Input } from '@/ui-component/input/Input'
|
||||
@@ -32,6 +33,7 @@ const FollowUpPromptProviders = {
|
||||
ANTHROPIC: 'chatAnthropic',
|
||||
AZURE_OPENAI: 'azureChatOpenAI',
|
||||
GOOGLE_GENAI: 'chatGoogleGenerativeAI',
|
||||
GROQ: 'groqChat',
|
||||
MISTRALAI: 'chatMistralAI',
|
||||
OPENAI: 'chatOpenAI'
|
||||
}
|
||||
@@ -149,6 +151,42 @@ const followUpPromptsOptions = {
|
||||
}
|
||||
]
|
||||
},
|
||||
[FollowUpPromptProviders.GROQ]: {
|
||||
label: 'Groq',
|
||||
name: FollowUpPromptProviders.GROQ,
|
||||
icon: groqIcon,
|
||||
inputs: [
|
||||
{
|
||||
label: 'Connect Credential',
|
||||
name: 'credential',
|
||||
type: 'credential',
|
||||
credentialNames: ['groqApi']
|
||||
},
|
||||
{
|
||||
label: 'Model Name',
|
||||
name: 'modelName',
|
||||
type: 'asyncOptions',
|
||||
loadMethod: 'listModels'
|
||||
},
|
||||
{
|
||||
label: 'Prompt',
|
||||
name: 'prompt',
|
||||
type: 'string',
|
||||
rows: 4,
|
||||
description: promptDescription,
|
||||
optional: true,
|
||||
default: defaultPrompt
|
||||
},
|
||||
{
|
||||
label: 'Temperature',
|
||||
name: 'temperature',
|
||||
type: 'number',
|
||||
step: 0.1,
|
||||
optional: true,
|
||||
default: 0.9
|
||||
}
|
||||
]
|
||||
},
|
||||
[FollowUpPromptProviders.MISTRALAI]: {
|
||||
label: 'Mistral AI',
|
||||
name: FollowUpPromptProviders.MISTRALAI,
|
||||
|
||||
Reference in New Issue
Block a user