agentscope.message.placeholder module

The placeholder message for RpcAgent.

class agentscope.message.placeholder.PlaceholderMessage(host: str | None = None, port: int | None = None, task_id: int | None = None, client: RpcAgentClient | None = None, x: Sequence[Msg] | Msg | None = None)[source]

Bases: Msg

A placeholder for the return message of RpcAgent.

__init__(host: str | None = None, port: int | None = None, task_id: int | None = None, client: RpcAgentClient | None = None, x: Sequence[Msg] | Msg | None = None) None[source]

A placeholder message, records the address of the real message.

Parameters:
  • host (str, defaults to None) – The hostname of the rpc server where the real message is located.

  • port (int, defaults to None) – The port of the rpc server where the real message is located.

  • task_id (int, defaults to None) – The task id of the real message in the rpc server.

  • client (RpcAgentClient, defaults to None) – An RpcAgentClient instance used to connect to the generator of this placeholder.

  • x (Optional[Msg, Sequence[Msg]], defaults to None) – Input parameters used to call rpc methods on the client.

property id: str

The identity of the message.

property name: str

The name of the message sender.

property content: Any

The content of the message.

property role: Literal['system', 'user', 'assistant']

The role of the message sender, chosen from ‘system’, ‘user’, ‘assistant’.

property url: str | List[str] | None

A URL string or a list of URL strings.

property metadata: str | dict | None

The metadata of the message, which can store some additional information.

property timestamp: str

The timestamp when the message is created.

update_value() None[source]

Get attribute values from rpc agent server immediately

to_dict() dict[source]

Serialize the placeholder message.

classmethod from_dict(serialized_dict: dict) PlaceholderMessage[source]

Create a PlaceholderMessage from a dictionary.