Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ai 187 postgres memory sub node #2273

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/advanced-ai/examples/understand-memory.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/)

Expand Down
3 changes: 3 additions & 0 deletions docs/advanced-ai/langchain/langchain-n8n.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}.

Expand Down Expand Up @@ -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/)
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -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"
1 change: 1 addition & 0 deletions docs/integrations/builtin/credentials/postgres.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down