HELP - Provide a minimal pass through example on LangChain Code node for AI model?

Describe the problem/error/question

Could you help me providing a minimal example on how to create a pass through LangChain Code node for an AI Model?

I would like to create a node that has a Language Model as both Input and Ouput, and acts as a merely passthrough, so I can study it, and try to alter the output of the Model.

What is the error message (if any)?

With the current example, I get: Problem in node ‘Summarization Chain‘ Unable to extract BaseLanguageModel from llmLike object.

Please share your workflow

This is what I currently have, but it does not work:

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hey @miguel-mconf,

I will need to check but I don’t think the LangChain code node is intended to work like that which could be why you are seeing an error.

Hi @miguel-mconf,
The problem you’re seeing is due to the LLM input configuration. If Max Connections is set to -1, the const llm = await this.getInputConnectionData('ai_languageModel', 0); would return an array inputs. So you would need to return it as llm[0]. But if you know you’re only going to use a single LLM for the passthrough, I would suggest to set it to 1 which would make your code work as expected.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.