on 07-12-2019 4:16 PM
Hi,
if I send this to the chatbot:
{"conversation":{"memory":{"username":"bob"}}}
it will replace the actual memory.
I tried this but it didnt work.
{"conversation":{"memory":{"username":"bob"},"merge_memory":true}}
is it possible to merge only with the API? Or is this also possible in the webhook?
Best regards
Philipp
Hi Philipp,
Yes it is possible to merge the memory in webhooks. There is no option to keep the current memory and add new key/values, the right way to do it is to get the current memory of the conversation that is sent in the request, and add the key/value pairs you want to have in your memory.
For example:
You can access the memory of the request like so:
existing_memory = request.body.conversation.memory
When sending the response, you can merge the existing memory with something else, in Javascript it would look like:
{conversation: {memory: {...existing_memory, ...{username: "bob"}}}}
With this, the memory will not be overwritten.
Best regards
Hugo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
11 | |
11 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.