diff --git a/docs/advanced-ai/examples/understand-memory.md b/docs/advanced-ai/examples/understand-memory.md index 07a7e1b535a..e01dd3800e1 100644 --- a/docs/advanced-ai/examples/understand-memory.md +++ b/docs/advanced-ai/examples/understand-memory.md @@ -17,6 +17,7 @@ To add memory to your AI workflow you can use either: * One of the memory services that n8n provides nodes for. These include: * [Motorhead](/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.memorymotorhead/) * [Redis Chat Memory](/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.memoryredischat/) + * [Postgres Chat Memory](/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.memorypostgreschat/) * [Xata](/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.memoryxata/) * [Zep](/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.memoryzep/) diff --git a/docs/advanced-ai/langchain/langchain-n8n.md b/docs/advanced-ai/langchain/langchain-n8n.md index 7be03a5424f..70ae2299a40 100644 --- a/docs/advanced-ai/langchain/langchain-n8n.md +++ b/docs/advanced-ai/langchain/langchain-n8n.md @@ -36,6 +36,8 @@ Available nodes: * [Basic LLM Chain](/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.chainllm/) * [Retrieval Q&A Chain](/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.chainretrievalqa/) * [Summarization Chain](/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.chainsummarization/) +* [Sentiment Analysis](/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.sentimentanalysis/) +* [Text Classifier](/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.text-classifier/) Learn more about [Chains in LangChain](https://js.langchain.com/docs/modules/chains/){:target=_blank .external-link}. @@ -110,6 +112,7 @@ Available nodes: * [Motorhead](/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.memorymotorhead/) * [Redis Chat Memory](/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.memoryredischat/) +* [Postgres Chat Memory](/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.memorypostgreschat/) * [Window Buffer Memory](/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.memorybufferwindow/) * [Xata](/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.memoryxata/) * [Zep](/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.memoryzep/) diff --git a/docs/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.sentimentanalysis.md b/docs/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.sentimentanalysis.md new file mode 100644 index 00000000000..fc5f2ec6b87 --- /dev/null +++ b/docs/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.sentimentanalysis.md @@ -0,0 +1,62 @@ +--- +#https://www.notion.so/n8n/Frontmatter-432c2b8dff1f43d4b1c8d20075510fe4 +title: Sentiment Analysis +description: Documentation for the Sentiment Analysis node in n8n, a workflow automation platform. Includes details of operations and configuration, and links to examples and credentials information. +contentType: integration +--- + +# Sentiment Analysis + +Use the Sentiment Analysis node to analyze the sentiment of incoming text data. Using the +categories provided in the parameters (see below), each item is passed to the +language model to determine its sentiment. + +## Node parameters + +**Text to Analyze** defines the input text for sentiment analysis. This is usually an expression +that references a field from the input items. For example, this could be +`{{ $json.chatInput }}` if the input is from a chat or message source. By default, it +expects a `text` field. + +## Node options + +* **Sentiment Categories**: Define the categories that you want to classify your input as. +By default, these are "Positive, Neutral, Negative". You can customize these categories +to fit your specific use case, such as "Very Positive, Positive, Neutral, Negative, Very Negative" +for more granular analysis. + +* **Include Detailed Results**: When enabled, this option includes sentiment strength and + confidence scores in the output. Note that these scores are estimates generated by the + language model and should be interpreted as rough indicators rather than precise measurements. + +* **System Prompt Template**: This option allows you to change the system prompt that's used for the sentiment analysis. It uses the `{categories}` placeholder for the categories. + +* **Enable Auto-Fixing**: When enabled, this option allows the node to automatically fix model outputs to ensure they match the expected format. This is done by sending the schema parsing error to the LLM and asking it to fix it. + +## Usage Notes + +1. **Model Temperature Setting**: It is strongly advised to set the temperature of the connected language model to 0 or a value very close to 0. This helps ensure that the results are as deterministic as possible, providing more consistent and reliable sentiment analysis across multiple runs. + +2. **Language Considerations**: The node's performance may vary depending on the language of the input text. For best results, ensure your chosen language model supports the input language. + +3. **Processing Large Volumes**: When analyzing large amounts of text, consider splitting the input into smaller chunks to optimize processing time and resource usage. + +4. **Iterative Refinement**: For complex sentiment analysis tasks, you may need to iteratively refine the system prompt and categories to achieve the desired results. + +## Example Usage + +### Basic Sentiment Analysis +1. Connect a data source (e.g., RSS Feed, HTTP Request) to the Sentiment Analysis node. +2. Set the "Text to Analyze" field to the relevant item property (e.g., `{{ $json.content }}` for blog post content). +3. Keep the default sentiment categories. +4. Connect the node's outputs to separate paths for processing positive, neutral, and negative sentiments differently. + +### Custom Category Analysis +1. Modify the "Sentiment Categories" to "Excited, Happy, Neutral, Disappointed, Angry". +2. Adjust your workflow to handle these five output categories. +3. Use this setup to analyze customer feedback with more nuanced emotional categories. + +## Related resources + +--8<-- "_snippets/integrations/builtin/cluster-nodes/langchain-overview-link.md" +--8<-- "_glossary/ai-glossary.md" diff --git a/docs/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.memorypostgreschat.md b/docs/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.memorypostgreschat.md new file mode 100644 index 00000000000..67d3571cf0a --- /dev/null +++ b/docs/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.memorypostgreschat.md @@ -0,0 +1,33 @@ +--- +title: Postgres Chat Memory +description: Documentation for the Postgres Chat Memory node in n8n, a workflow automation platform. Includes details of operations and configuration, and links to examples and credentials information. +--- + +# Postgres Chat Memory + +Use the Postgres Chat Memory node to use Postgres as a memory server for storing chat history. + +On this page, you'll find a list of operations the Postgres Chat Memory node supports, and links to more resources. + +/// note | Credentials +You can find authentication information for this node [here](/integrations/builtin/credentials/postgres/). +/// + +--8<-- "_snippets/integrations/builtin/cluster-nodes/sub-node-expression-resolution.md" + +## Node parameters + +* **Session Key**: the key to use to store the memory in the workflow data. +* **Table Name**: the name of the table to store the chat history in. If the table does not exist, it will be created. + +## Related resources + +Refer to [LangChain's Postgres Chat Message History documentation](https://js.langchain.com/docs/modules/memory/integrations/postgres){:target=_blank .external-link} for more information about the service. + +--8<-- "_snippets/integrations/builtin/cluster-nodes/langchain-overview-link.md" + +## Single memory instance + +[[% include "_includes/integrations/cluster-nodes/memory-shared.html" %]] + +--8<-- "_glossary/ai-glossary.md" diff --git a/docs/integrations/builtin/credentials/postgres.md b/docs/integrations/builtin/credentials/postgres.md index 6bcec233826..e6d8dae0d4b 100644 --- a/docs/integrations/builtin/credentials/postgres.md +++ b/docs/integrations/builtin/credentials/postgres.md @@ -11,6 +11,7 @@ You can use these credentials to authenticate the following nodes: - [Postgres](/integrations/builtin/app-nodes/n8n-nodes-base.postgres/) - [Agent](/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent) +- [Postgres Chat Memory](/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.memorypostgreschat/) /// note | Agent node users The Agent node doesn't support SSH tunnels. diff --git a/mkdocs.yml b/mkdocs.yml index 60ec469e077..385791accbf 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -760,6 +760,7 @@ nav: - integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.chainretrievalqa.md - integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.chainsummarization.md - integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.text-classifier.md + - integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.sentimentanalysis.md - integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.code.md - integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.vectorstoreinmemory.md - integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.vectorstorepinecone.md @@ -797,6 +798,7 @@ nav: - integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.memorybufferwindow.md - integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.memorymotorhead.md - integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.memoryredischat.md + - integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.memorypostgreschat.md - integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.memoryxata.md - integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.memoryzep.md - integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.outputparserautofixing.md