mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 15:00:57 +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
|
||||
|
||||
Reference in New Issue
Block a user