Information sharng between threads of same assistant

Is it possible to share information between threads ?
For example, in a thread user provided some information to the assitant within a message (for example: my car is green colored) , is it possible to reach that information in another thread of the same assistant ?

I tried it and it seems that it is not transferred to other threads. But maybe there is some method to share information between threads.

Any ideas ?

I already have an AI made to write tools, which is the solution here: to have the AI emit any noteworthy element to a customer database for that assistant that your code provides, and then for the present state of memory to be placed with the additional_instructions parameters.

So lets have it ramble on to give inspiration:

Here is a new tool function specification for toolspec that allows the AI to store cross-session memories. This specification includes all necessary details and constraints to guide its use effectively.

Tool Specification for Cross-Session Memory

toolspec.extend([{
    "type": "function",
    "function": {
        "name": "store_cross_session_memory",
        "description": "Stores information in a cross-session memory, allowing the AI to recall or reference this information in future interactions with the user. The memory is stored as key-value pairs.",
        "parameters": {
            "type": "object",
            "properties": {
                "key": {
                    "type": "string",
                    "description": "A unique identifier for the memory item."
                },
                "value": {
                    "type": "string",
                    "description": "The information to be remembered across sessions."
                },
                "expires_in": {
                    "type": "number",
                    "description": "The time in days after which the memory should expire automatically. Set to 0 for no expiration.",
                    "minimum": 0
                }
            },
            "required": ["key", "value"]
        }
    }
}])

Examples of Language and Arguments for Storing Memory

Here are some example interactions where the AI might emit language and arguments to store something in cross-session memory:

Example 1: Remembering a User’s Preference

{
    "role": "assistant",
    "content": "I'll remember that you prefer shipping updates via email.",
    "tool_calls": [
        {
            "type": "function",
            "function": {
                "name": "store_cross_session_memory",
                "arguments": "{\"key\": \"user_shipping_preference\", \"value\": \"email\", \"expires_in\": 365}"
            }
        }
    ]
}

Example 2: Storing an Important Date

{
    "role": "assistant",
    "content": "I'll keep a note of your anniversary date.",
    "tool_calls": [
        {
            "type": "function",
            "function": {
                "name": "store_cross_session_memory",
                "arguments": "{\"key\": \"user_anniversary_date\", \"value\": \"2024-06-07\", \"expires_in\": 0}"
            }
        }
    ]
}

Example 3: Remembering a Frequently Asked Question

{
    "role": "assistant",
    "content": "I'll remember your usual order for quicker service next time.",
    "tool_calls": [
        {
            "type": "function",
            "function": {
                "name": "store_cross_session_memory",
                "arguments": "{\"key\": \"user_usual_order\", \"value\": \"Large coffee with cream\", \"expires_in\": 90}"
            }
        }
    ]
}

Each example shows how the AI would inform the user of what it’s remembering and then makes a corresponding tool call to store this information using the store_cross_session_memory function, specifying a key, value, and optionally expires_in to indicate when or if the memory should expire. This setup ensures the AI can maintain context and provide personalized interactions based on past data stored across sessions.

I am not sure if I understood your solution correctly. This is what I understood:

  1. write a function for assistant to call when the user asks for something to remember.
  2. assistant will return a “thread.run.requires_action” event.
  3. the App will store the key/value pair
  4. App will provide the stored key/value pair with an “additional_instruction” parameter everytime a new thread is creadted.

Is that correct ?

If yes, that might be a good solution for your purpose. But I am looking for a more natural way of remembering things. I want the assistant to remember what is said in a thread , all of them. For example, the user tells that he wants a blue necklace for his birthday and that her birthday is on July 1st. Several weeks after , when user is discussing about necklaces just before July , assistant should remember the blue necklace and tell that a blue necklace is a good present idea for the user’s birthday.
As if they are in the same thread.

Is this possible ?

Running the assistant code, you know who the user is and already keep a database on them.

The AI uses the tool to emit a memory to store. You only need to return “memory stored successfully”. This allows the AI to decide in the background what is important to remember, you don’t have to make it as interactive as seen.

Then on future runs there or other threads, you can add the set of user memories that have been constructed for that user to additional_instructions, the only place you have to alter contents every time a run is executed. Or use them in other ways.

The only way you could possibly collect all “memories” is to record everything the user has ever input, perhaps in summarized chunks of inputs, and add it to your own semantic search database for injecting past user questions similar to the latest one back in.

Present an injection "Here’s similar past chat to present topic; call instant_recall to see the whole exchange if it would be relevant: 1. [June 2] “Information sharng between threads of the smae assistant”; 2. [June 3] “I really like getting information from forums”; …

The AI doesn’t have unlimited token context or budget to have unlimited memory always.

1 Like

I am not sure if you agree with my previous post or not. I didn’t understand your point of view. What I wrote was the steps:

  1. write a function for assistant to call when the user asks for something to remember.
  2. assistant will return a “thread.run.requires_action” event.
  3. the App will store the key/value pair
  4. App will provide the stored key/value pair with an “additional_instruction” parameter everytime a new thread is creadted.

What you say is exactly this. If not, could you please correct my steps ?

On the other hand, I would assume the assistant would be able to learn from the user. if that’s not the case by default, how do we make assistant learn from us ?

Also, can we keep one large thread for this purpose ? What is the limitation of a thread ? (number of messages ?)

When we are repeating the same thing, then you have an understanding of the mechanism I present, very similar to “memory” being used in ChatGPT.

A thread can grow in length (perhaps with a limit some have reached at 100 messages), however, only a subset of a long conversation can be passed losslessly per new run by the backend, because models have a limited context length, and you likely have a budget of not paying $1.20 per question.

You also specifically asked, “between threads”.

Once you have a high understanding of how the AI language models work, which can be implementing a chat memory system yourself to provide context to a chat completions AI directly, then you’ll likely come up with more ideas of how chat memory illusion could be extended.

Probably because I am not a native English speaker, I am having hard times trying to understand what you mean.
But in principal I get that there is no way to transfer knowledge between threads. So I am still looking for a way to feed the assistant (or let’s say AI for this purpose) with some private imformation of the user. I want it to remember what has been feed into it.
Is there a way to make it act like a real assistant? As in the birthday present example in my previous post…
I get that it might cost high but even so I’d like to have an opinion.
100 messages in a thread would not be satisfying for my purpose.
Because I want to record lots of information from the user.