The context object holds information about the currently processed message. It allows you to modify the behavior of your assistant at runtime or alter the message processing flow.
Context can be modified by middlewares during the message processing flow to implement highly flexible logic or rules (e.g., authentication, RAG, etc.).
To add typing for your custom properties to the context, create a file with the type definition and override the typing.
All custom properties must be optional, as the current context creation does not support default values for custom objects.
After setting extras, you can access them from the context object:
Next, we’ll explore the concept of plugins to understand how to modify the context.