trading_agent.tools.send_image_tool
¶
The send_image tool: shows the user a picture, in the web chat and on Telegram.
The picture is copied into the desk's uploads folder, so it stays viewable after the desk's scratch files are cleared, and is published as a message event that carries it. The web page shows it in the chat, and Telegram sends it as a photo: to the chat that asked when the user wrote from Telegram, otherwise to every paired chat when messages are pushed.
Typical usage example:
tool = SendImageTool(policy, store, event_bus, 'main')
SendImageArguments
¶
Bases: BaseModel
The arguments of send_image.
Attributes:
| Name | Type | Description |
|---|---|---|
path |
str
|
The picture; a relative path starts at your desk folder. |
caption |
str
|
A line shown with the picture, or an empty string. |
SendImageTool
¶
Bases: Tool
Sends the user a picture file.
Creates the tool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
policy
|
PathPolicy
|
The desk's read rules. |
required |
store
|
AttachmentStore
|
Keeps the copy of the picture that is shown. |
required |
event_bus
|
EventBus
|
Where the message is published. |
required |
desk_name
|
str
|
The desk sending it. |
required |
Source code in src/trading_agent/tools/send_image_tool.py
run
async
¶
Copies the picture and publishes it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arguments
|
SendImageArguments
|
The picture and its caption. |
required |
Returns:
| Type | Description |
|---|---|
ToolResult
|
A confirmation, or an error the model can act on. |