Skip to content

Commit 53743d8

Browse files
authored
Merge pull request FlowiseAI#698 from FlowiseAI/feature/CSVAgent
2 parents e635ca5 + 54eba92 commit 53743d8

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

packages/components/nodes/agents/CSVAgent/CSVAgent.ts

+14-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ class CSV_Agents implements INode {
3737
label: 'Language Model',
3838
name: 'model',
3939
type: 'BaseLanguageModel'
40+
},
41+
{
42+
label: 'System Message',
43+
name: 'systemMessagePrompt',
44+
type: 'string',
45+
rows: 4,
46+
additionalParams: true,
47+
optional: true,
48+
placeholder:
49+
'I want you to act as a document that I am having a conversation with. Your name is "AI Assistant". You will provide me with answers from the given info. If the answer is not included, say exactly "Hmm, I am not sure." and stop after that. Refuse to answer any question not about the info. Never break character.'
4050
}
4151
]
4252
}
@@ -49,6 +59,7 @@ class CSV_Agents implements INode {
4959
async run(nodeData: INodeData, input: string, options: ICommonObject): Promise<string> {
5060
const csvFileBase64 = nodeData.inputs?.csvFile as string
5161
const model = nodeData.inputs?.model as BaseLanguageModel
62+
const systemMessagePrompt = nodeData.inputs?.systemMessagePrompt as string
5263

5364
const loggerHandler = new ConsoleCallbackHandler(options.logger)
5465
const handler = new CustomChainHandler(options.socketIO, options.socketIOClientId)
@@ -127,7 +138,9 @@ json.dumps(my_dict)`
127138
if (finalResult) {
128139
const chain = new LLMChain({
129140
llm: model,
130-
prompt: PromptTemplate.fromTemplate(finalSystemPrompt),
141+
prompt: PromptTemplate.fromTemplate(
142+
systemMessagePrompt ? `${systemMessagePrompt}\n${finalSystemPrompt}` : finalSystemPrompt
143+
),
131144
verbose: process.env.DEBUG === 'true' ? true : false
132145
})
133146
const inputs = {

0 commit comments

Comments
 (0)