Context injection supplies the model with additional information so it can tailor its responses without the user needing to explicitly instruct EVI.
EVI supports context injection via a Session Settings message. The context field in a Session Settings message allows you to silently add information to the conversation, guiding EVI without triggering a response.
This context is appended to the end of each user_message, ensuring that it is consistently referenced throughout the session.
Injected context can be used to remind EVI of its role, keep important details active in the conversation, or add relevant updates as needed. This method is ideal for adapting EVI’s tone or focus based on real-time changes, helping it respond more accurately without requiring repetitive input from the user.
To inject context, send a Session Settings message with a context object that includes two fields:
To tailor EVI’s responses for a travel planning scenario, you can inject context at different persistence levels based on user actions and session needs:
This context helps EVI respond appropriately to the most recent user action but does not persist beyond the next interaction.
Context you have injected can be cleared by sending a Session Settings message with a context field of null:
Injected context is only active within the current session. If a chat is resumed, any previously injected context will not be carried over and must be re-injected if necessary.