How to Retain Buffer Memory in Lanchain for Ongoing Bot-User Conversations?

This topic was automatically generated from Slack. You can find the original thread here.

Hi @U05A7KLNALC,

I want to retain the memory of the conversation between the bot and the user for which i am using buffer memory in lanchain . But everytime when the workflow is running the new buffer memory gets created . How can i tackle this problem .

I am using pinecone and ConversationalRetrievalQAChain.

Main motive is to restore the buffer memory for the user so that bot can answer followup questions , how @U05A7KLNALC is also able to answer.

It seems like you’re trying to maintain the conversation state between the bot and the user using Pinecone and ConversationalRetrievalQAChain. To help you better, I’ll need more information about your current implementation and how you’re using Pinecone in your workflow. Could you please provide more details about your workflow, the steps involved, and any code you’re using? This will help me understand your issue and suggest a solution.

Can you show me how to use a Pipedream data store to retain data?

Sure! In Pipedream, you can use the built-in key-value store to retain data across workflow runs. You can use the this.$db.set() method to store data and this.$db.get() method to retrieve data. Here’s an example: ```
export default defineComponent({ async run({ steps, $ }) { // Storing data await this.$db.set(“exampleKey”, “exampleValue”); // Retrieving data const storedValue = await this.$db.get(“exampleKey”); console.log(“Stored value:”, storedValue); return storedValue; }, });

I don’t think that’s right. I’d also love an example in Python. Can you show me how to get and set data in a Pipedream data store in Python?

I apologize for the confusion earlier. Pipedream currently supports Python only for code steps, not for managing the built-in key-value store. The key-value store is available for Node.js components using this.$db.set() and this.$db.get() methods. If you need to work with data in Python code steps, you can pass data between steps using step exports and access them in the Python code step. However, this won’t persist the data across workflow runs like the key-value store does in Node.js components.

is there any other way other than datastore to same conversation?

If you’re looking for an alternative to the Pipedream datastore for maintaining conversation state, you can consider using an external database or storage service. For example, you can use Firebase, Redis, or a SQL database to store and retrieve conversation data. You’ll need to make API calls to interact with these services within your Pipedream workflow. Keep in mind that using an external service will require additional setup and configuration, as well as handling authentication and API calls within your Pipedream workflow.

what are the limitations on size of data that can be stored inside data store

You should visit Data Stores for the latest information on data store limitations. However, I can provide some details based on the current documentation: Data stores can hold any JSON-serializable data within the storage limits. This includes data types like strings, objects, arrays, dates, integers, and floats. However, you cannot serialize functions, classes, or other more complex objects. There’s a limit on the number of keys you can retrieve in a single query, which is currently set to 10,000 keys. If you try to retrieve more than 10,000 keys, you’ll receive a 426 error. Please note that data stores are currently in Beta, and their features and limitations may change as they’re being prepared for a full release.