Events
Schemas for events emitted during LM invocation.
References
NONE
ActivityEvent
Bases: Event
Event schema for model-triggered activities (e.g. web search, MCP call, etc.).
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
The ID of the activity event. Defaults to None. |
value |
dict[str, Any]
|
The value of the activity event. |
level |
EventLevel
|
The severity level of the activity event. Defaults to EventLevel.INFO. |
type |
Literal[ACTIVITY]
|
The type of the activity event. Defaults to EventType.ACTIVITY. |
timestamp |
datetime
|
The timestamp of the activity event. Defaults to the current timestamp. |
metadata |
dict[str, Any]
|
The metadata of the activity event. Defaults to an empty dictionary. |
from_activity(id_=None, activity=None)
classmethod
Create an activity event from an Activity object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id_ |
str | None
|
The ID of the activity event. Defaults to None. |
None
|
activity |
Activity | None
|
The activity object to create the event from. Defaults to None, in which case the value will be an empty dictionary. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
ActivityEvent |
ActivityEvent
|
The activity event. |
BlockBasedEvent
Bases: Event
Event schema block-based events, which are limited by start and end events.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
The ID of the block-based event. Defaults to None. |
value |
str
|
The value of the block-based event. Defaults to an empty string. |
level |
EventLevel
|
The severity level of the block-based event. Defaults to EventLevel.INFO. |
type |
str
|
The type of the block-based event. Defaults to an empty string. |
timestamp |
datetime
|
The timestamp of the block-based event. Defaults to the current timestamp. |
metadata |
dict[str, Any]
|
The metadata of the block-based event. Defaults to an empty dictionary. |
content(id_=None, value='')
classmethod
Create a block-based content event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id_ |
str | None
|
The ID of the block-based event. Defaults to None. |
None
|
value |
str
|
The block-based content. Defaults to an empty string. |
''
|
Returns:
| Name | Type | Description |
|---|---|---|
Self |
Self
|
The block-based content event. |
end(id_=None)
classmethod
Create a block-based end event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id_ |
str | None
|
The ID of the block-based event. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Self |
Self
|
The block-based end event. |
start(id_=None)
classmethod
Create a block-based start event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id_ |
str | None
|
The ID of the block-based event. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Self |
Self
|
The block-based start event. |
CodeEvent
Bases: BlockBasedEvent
Event schema for model-generated code to be executed.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
The ID of the code event. Defaults to None. |
value |
str
|
The value of the code event. Defaults to an empty string. |
level |
EventLevel
|
The severity level of the code event. Defaults to EventLevel.INFO. |
type |
CodeEventType
|
The type of the code event. Defaults to EventType.CODE. |
timestamp |
datetime
|
The timestamp of the code event. Defaults to the current timestamp. |
metadata |
dict[str, Any]
|
The metadata of the code event. Defaults to an empty dictionary. |
ThinkingEvent
Bases: BlockBasedEvent
Event schema for model-generated thinking.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
The ID of the thinking event. Defaults to None. |
value |
str
|
The value of the thinking event. Defaults to an empty string. |
level |
EventLevel
|
The severity level of the thinking event. Defaults to EventLevel.INFO. |
type |
ThinkingEventType
|
The type of the thinking event. Defaults to EventType.THINKING. |
timestamp |
datetime
|
The timestamp of the thinking event. Defaults to the current timestamp. |
metadata |
dict[str, Any]
|
The metadata of the thinking event. Defaults to an empty dictionary. |