steamship.plugin.outputs package#

Submodules#

steamship.plugin.outputs.block_and_tag_plugin_output module#

class steamship.plugin.outputs.block_and_tag_plugin_output.BlockAndTagPluginOutput(*, usage: List[UsageReport] | None = None, file: File = None)[source]#

Bases: PluginOutput

file: File#

steamship.plugin.outputs.block_type_plugin_output module#

class steamship.plugin.outputs.block_type_plugin_output.BlockTypePluginOutput(*, usage: List[UsageReport] | None = None, blockTypesToCreate: List[str])[source]#

Bases: PluginOutput

block_types_to_create: List[str]#

steamship.plugin.outputs.embedded_items_plugin_output module#

class steamship.plugin.outputs.embedded_items_plugin_output.EmbeddedItemsPluginOutput(*, usage: List[UsageReport] | None = None, embeddings: List[List[float]])[source]#

Bases: PluginOutput

embeddings: List[List[float]]#

steamship.plugin.outputs.model_checkpoint module#

class steamship.plugin.outputs.model_checkpoint.ModelCheckpoint(client: Steamship, parent_directory: Path | None = None, handle: str = 'default', plugin_instance_id: str = None)[source]#

Bases: CamelModel

DEFAULT_HANDLE: ClassVar[str] = 'default'#

Represents the saved state of a trained PluginInstance.

archive_path_in_steamship(as_handle: str = None) str[source]#

Returns the path to the checkpoint archive on Steamship.

On steamship, the checkpoint is archived in the Workspace’s PluginInstance bucket as: {plugin_instance_bucket}/{plugin_instance_id}/{checkpoint_handle}.zip

Here we only return the following path since the bucket is specified separately in the required Steamship API calls: {plugin_instance_id}/{checkpoint_handle}.zip

archive_path_on_disk() Path[source]#

Returns the path to the checkpoint archive on disk.

On disk, the model checkpoint is the folder:

{parent_directory}/{checkpoint_handle}.zip

client: Client#
download_model_bundle() Path[source]#

Download’s the model from Steamship and unzips to parent_directory

folder_path_on_disk() Path[source]#

Returns the path to this checkpoint on the local disk.

On disk, the model checkpoint is the folder:

{parent_directory}/{checkpoint_handle}/

handle: str#
parent_directory: Path | None#
plugin_instance_id: str#
upload_model_bundle(set_as_default: bool = True)[source]#

Zips and uploads the Model to steamship

workspace: Workspace | None#

steamship.plugin.outputs.plugin_output module#

class steamship.plugin.outputs.plugin_output.OperationType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: str, Enum

CREATE = 'create'#
DELETE = 'delete'#
EXISTS = 'exists'#
EXISTS_TRAINED = 'existsTrained'#
RUN = 'run'#
TRAIN = 'train'#
class steamship.plugin.outputs.plugin_output.OperationUnit(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: str, Enum

BYTES = 'bytes'#
CHARACTERS = 'characters'#
MS = 'ms'#
PROMPT_TOKENS = 'promptTokens'#
SAMPLED_TOKENS = 'sampledTokens'#
TOKENS = 'tokens'#
UNITS = 'units'#
class steamship.plugin.outputs.plugin_output.PluginOutput(*, usage: List[UsageReport] | None = None)[source]#

Bases: CamelModel

Base class for all types of plugin output, allowing usage reporting

usage: List[UsageReport] | None#
class steamship.plugin.outputs.plugin_output.UsageReport(*, operationType: OperationType, operationUnit: OperationUnit, operationAmount: int, auditURL: str | None = None, auditId: str | None = None)[source]#

Bases: CamelModel

This is the report object that a plugin or package can send back to notify the engine how much of something was consumed

audit_id: str | None#
audit_url: str | None#
operation_amount: int#
operation_type: OperationType#
operation_unit: OperationUnit#
static run_characters(characters: int, audit_url: str | None = None, audit_id: str | None = None)[source]#
static run_tokens(tokens: int, audit_url: str | None = None, audit_id: str | None = None)[source]#
static run_units(units: int, audit_url: str | None = None, audit_id: str | None = None)[source]#

steamship.plugin.outputs.raw_block_and_tag_plugin_output module#

class steamship.plugin.outputs.raw_block_and_tag_plugin_output.RawBlockAndTagPluginOutput(*, usage: List[UsageReport] | None = None, blocks: List[Block])[source]#

Bases: PluginOutput

blocks: List[Block]#

steamship.plugin.outputs.raw_data_plugin_output module#

class steamship.plugin.outputs.raw_data_plugin_output.RawDataPluginOutput(base64string: str = None, string: str = None, _bytes: bytes | io.BytesIO = None, json: Any = None, mime_type: str = None, tags: List[Tag] | None = None, *, usage: List[UsageReport] | None = None, data: str | None = None)[source]#

Bases: PluginOutput

Represents mime-typed raw data (or a URL pointing to raw data) that can be returned to the engine.

As a few examples, you can return: - Raw text: RawDataPluginOutput(string=raw_text, MimeTypes.TXT) - Markdown text: RawDataPluginOutput(string=markdown_text, MimeTypes.MKD) - A PNG image: RawDataPluginOutput(bytes=png_bytes, MimeTypes.PNG) - A JSON-serializable Dataclass: RawDataPluginOutput(json=dataclass, MimeTypes.JSON) - Steamship Blocks: RawDataPluginOutput(json=file, MimeTypes.STEAMSHIP_BLOCK_JSON) - Data uploaded to a pre-signed URL: RawDataPluginOutput(url=presigned_url, MimeTypes.TXT)

The data field of this object will ALWAYS be Base64 encoded by the constructor. This ensures that the object is always trivially JSON-serializable over the wire, no matter what it contains.

The mimeType field of this object should always be filled in if known. The Steamship Engine makes use of it to proactively select defaults for handling the data returned.

data: str | None#
mime_type: str | None#
classmethod parse_obj(obj: Any) BaseModel[source]#
tags: List[Tag] | None#

steamship.plugin.outputs.stream_complete_plugin_output module#

class steamship.plugin.outputs.stream_complete_plugin_output.StreamCompletePluginOutput(*, usage: List[UsageReport] | None = None)[source]#

Bases: PluginOutput

steamship.plugin.outputs.train_plugin_output module#

class steamship.plugin.outputs.train_plugin_output.TrainPluginOutput(*, usage: List[UsageReport] | None = None, pluginInstanceId: str = None, archivePath: str = None, inferenceParams: dict = None, trainingProgress: dict = None, trainingResults: dict = None)[source]#

Bases: PluginOutput

This is the object produced by a completed trainable operation, stored as the output field of a train task.

archive_path: str#
inference_params: dict#
plugin_instance_id: str#
training_progress: dict#
training_results: dict#

steamship.plugin.outputs.training_parameter_plugin_output module#

class steamship.plugin.outputs.training_parameter_plugin_output.TrainingParameterPluginOutput(*, usage: List[UsageReport] | None = None, machineType: str | None = None, trainingEpochs: int = None, testingHoldoutPercent: float = None, testSplitSeed: int = None, trainingParams: Dict[str, Any] = None, inferenceParams: Dict[str, Any] = None, exportRequest: ExportPluginInput = None)[source]#

Bases: PluginOutput

export_request: ExportPluginInput#
static from_input(input: TrainingParameterPluginInput) TrainingParameterPluginOutput[source]#
inference_params: Dict[str, Any]#
machine_type: str | None#
classmethod parse_obj(obj: Any) BaseModel[source]#
test_split_seed: int#
testing_holdout_percent: float#
training_epochs: int#
training_params: Dict[str, Any]#

Module contents#