messagenode
Class info¶
Classes¶
| Name | Children | Inherits |
|---|---|---|
| ChatMessage llmling_agent.messaging.messages Common message format for all UI types. |
||
| MessageEmitter llmling_agent.messaging.messageemitter Base class for all message processing nodes. |
||
| MessageNode llmling_agent.messaging.messagenode Base class for all message processing nodes. |
||
| ToolCallInfo llmling_agent.tools.tool_call_info Information about an executed tool call. |
🛈 DocStrings¶
Base class for message processing nodes.
MessageNode
¶
Bases: MessageEmitter[TDeps, TResult]
Base class for all message processing nodes.
Source code in src/llmling_agent/messaging/messagenode.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | |
tool_used
class-attribute
instance-attribute
¶
tool_used = Signal(ToolCallInfo)
Signal emitted when node uses a tool.
get_stats
abstractmethod
async
¶
get_stats() -> MessageStats | AggregatedMessageStats
Get message statistics for this node.
Source code in src/llmling_agent/messaging/messagenode.py
153 154 155 | |
pre_run
async
¶
pre_run(
*prompt: AnyPromptType | Image | PathLike[str] | ChatMessage,
) -> tuple[ChatMessage[Any], list[Content | str]]
Hook to prepare a MessgeNode run call.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*prompt
|
AnyPromptType | Image | PathLike[str] | ChatMessage
|
The prompt(s) to prepare. |
()
|
Returns:
| Type | Description |
|---|---|
tuple[ChatMessage[Any], list[Content | str]]
|
A tuple of: - Either incoming message, or a constructed incoming message based on the prompt(s). - A list of prompts to be sent to the model. |
Source code in src/llmling_agent/messaging/messagenode.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
run
async
¶
run(
*prompt: AnyPromptType | Image | PathLike[str] | ChatMessage,
wait_for_connections: bool | None = None,
store_history: bool = True,
output_type: type[OutputTypeT] | None = None,
**kwargs: Any,
) -> ChatMessage[Any]
Execute node with prompts and handle message routing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prompt
|
AnyPromptType | Image | PathLike[str] | ChatMessage
|
Input prompts |
()
|
wait_for_connections
|
bool | None
|
Whether to wait for forwarded messages |
None
|
store_history
|
bool
|
Whether to store in conversation history |
True
|
output_type
|
type[OutputTypeT] | None
|
Type of output to expect |
None
|
**kwargs
|
Any
|
Additional arguments for _run |
{}
|
Source code in src/llmling_agent/messaging/messagenode.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |
run_iter
abstractmethod
¶
run_iter(*prompts: Any, **kwargs: Any) -> AsyncIterator[ChatMessage[Any]]
Yield messages during execution.
Source code in src/llmling_agent/messaging/messagenode.py
157 158 159 160 161 162 163 | |