mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-09 22:24:05 -08:00
fix(LangChain Code Node): Add clarifying comments to the default code (no-changelog) (#10056)
This commit is contained in:
parent
9c23f7616b
commit
89d1782d3b
|
@ -40,12 +40,18 @@ const defaultCodeExecute = `const { PromptTemplate } = require('@langchain/core/
|
|||
|
||||
const query = 'Tell me a joke';
|
||||
const prompt = PromptTemplate.fromTemplate(query);
|
||||
|
||||
// If you are allowing more than one language model input connection (-1 or
|
||||
// anything greater than 1), getInputConnectionData returns an array, so you
|
||||
// will have to change the code below it to deal with that. For example, use
|
||||
// llm[0] in the chain definition
|
||||
|
||||
const llm = await this.getInputConnectionData('ai_languageModel', 0);
|
||||
let chain = prompt.pipe(llm);
|
||||
const output = await chain.invoke();
|
||||
return [ {json: { output } } ];`;
|
||||
|
||||
const defaultCodeSupplyData = `const { WikipediaQueryRun } = require('langchain/tools');
|
||||
const defaultCodeSupplyData = `const { WikipediaQueryRun } = require( '@langchain/community/tools/wikipedia_query_run');
|
||||
return new WikipediaQueryRun();`;
|
||||
|
||||
const langchainModules = ['langchain', '@langchain/*'];
|
||||
|
|
Loading…
Reference in a new issue