-
Notifications
You must be signed in to change notification settings - Fork 249
Description
The Activity Protocol must support seamless sharing of context information between users and agents to improve understanding of ongoing conversations. This enables more relevant, personalized, and accurate responses, especially in multi-modal interactions. By embedding context directly in the activity message, agents can leverage contextual information such as images, custom objects, and audio/video-related context.
The Activity Protocol schema will be enhanced to include a context as entity, enabling both client and agent to exchange relevant contextual data within a conversation. This proposal is only for sharing images as context.
Context Object Properties
The context entity in an activity message can contain the following fields.
Images for context can be shared in two ways. Users can upload an image as an attachment, or the client application can take a screenshot of the page the user is currently on. In both cases, the images can be provided either as a URL or as base64-encoded data, which can then be passed in the images list.
- Type: "context"
- Properties
- screenContext: An object containing information about the screen's current state, including:
- surroundingText: Text surrounding the cursor position. Relevant for parsing out the text for context (e.g., in a code editor or document viewer).
- images: A list of base64-encoded image or a URL that points to an image which can be used as context.
- screenContext: An object containing information about the screen's current state, including:
Handling Context Information
Context Messages
- If the context contains no elements, it should be ignored.
- Only one context entity can be included in a single activity message. If multiple context objects are present, they should be ignored by the recipient.
- If the context entity contains any syntactic errors, it should be ignored by the recipient to prevent processing invalid data.
Throttling
- Outgoing activities that contain context should be throttled to a configurable interval to prevent overloading the recipient system.
Unsupported Channels
- At present, context sharing is not supported in any channels.
Example Usage
// Sending context information as part of the activity message
{
"type": "message",
"text": "What pizzas are available for $150?",
"entities": [
{
"type": "context",
"screenContext": {
"surroundingText": "Details of the product on the page",
"images": ["iVBORw0KGgoAAAANSUhEUgAAAAUA...", "https://example.com/product-page"] // a list of base64-encoded image or URL that should be used as context.
}
}
]
}