roboto.action_runtime.action_input#
Module Contents#
- class roboto.action_runtime.action_input.ActionInput#
Resolved references to input data an Action was given to operate on.
To use, access via
get_input()
.Example
From within an Action, list files passed as input and check their size:
>>> action_runtime = ActionRuntime.from_env() >>> action_input = action_runtime.get_input() >>> for file, local_path in action_input.files: >>> print(f"{file.file_id} is {local_path.stat().st_size} bytes")
- files: collections.abc.Sequence[tuple[roboto.domain.files.File, pathlib.Path | None]] = []#
Files passed as input data to an action invocation.
A file is represented as a tuple of (File, Optional[Path]) where: - File exposes metadata about the file and useful file operations - Optional[Path] is the local file path if the file has been downloaded
- classmethod from_record(record, roboto_client)#
Create an ActionInput instance from its serialized representation.
- Parameters:
record (ActionInputRecord)
roboto_client (roboto.http.RobotoClient)
- Return type:
- get_topics_by_name(topic_name)#
Return any topics in this
ActionInput
that have the provided name.- Parameters:
topic_name (str) – Topic name to look for.
- Returns:
A list of matching
Topic
instances fromself.topics
. If no topics have the provided name, the list will be empty. Otherwise, there will be one or more topics in the list, depending on the topic selectors provided to the action invocation.- Return type:
- topics: collections.abc.Sequence[roboto.domain.topics.Topic] = []#
Topics passed as input data to an action invocation.
- class roboto.action_runtime.action_input.ActionInputRecord(/, **data)#
Bases:
pydantic.BaseModel
Serializable representation of an
ActionInput
.- Parameters:
data (Any)
- files: collections.abc.Sequence[tuple[roboto.domain.files.FileRecord, pathlib.Path | None]] = None#
- topics: collections.abc.Sequence[roboto.domain.topics.TopicRecord] = None#
- roboto.action_runtime.action_input.DEFAULT_INPUT_FILE#