steamship.data.plugin package#

Submodules#

steamship.data.plugin.hosting module#

class steamship.data.plugin.hosting.HostingCpu(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: str, Enum

The amount of CPU required for deployment.

This is mapped to a value dependent on the HostingType it is combined with.

LG = 'lg'#
MAX = 'max'#
MD = 'md'#
MIN = 'min'#
SM = 'sm'#
XL = 'xl'#
XS = 'xs'#
XXL = 'xxl'#
XXS = 'xxs'#
class steamship.data.plugin.hosting.HostingEnvironment(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: str, Enum

The software environment required for deployment.

PYTHON38 = 'python38'#
STEAMSHIP_PYTORCH_CPU = 'inferenceCpu'#
class steamship.data.plugin.hosting.HostingMemory(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: str, Enum

The amount of memory required for deployment.

This is mapped to a value dependent on the HostingType it is combined with.

LG = 'lg'#
MAX = 'max'#
MD = 'md'#
MIN = 'min'#
SM = 'sm'#
XL = 'xl'#
XS = 'xs'#
XXL = 'xxl'#
XXS = 'xxs'#
class steamship.data.plugin.hosting.HostingTimeout(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: str, Enum

The request timeout required for deployment.

This is mapped to a value dependent on the HostingType it is combined with.

LG = 'lg'#
MAX = 'max'#
MD = 'md'#
MIN = 'min'#
SM = 'sm'#
XL = 'xl'#
XS = 'xs'#
XXL = 'xxl'#
XXS = 'xxs'#
class steamship.data.plugin.hosting.HostingType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: str, Enum

The type of hosting provider to deploy to.

ECS = 'ecs'#
LAMBDA = 'lambda'#

steamship.data.plugin.index_plugin_instance module#

class steamship.data.plugin.index_plugin_instance.EmbedderInvocation(*, pluginHandle: str, instanceHandle: str | None = None, config: Dict[str, Any] | None = None, version: str | None = None, fetchIfExists: bool = True)[source]#

Bases: CamelModel

The parameters capable of creating/fetching an Embedder (Tagger) Plugin Instance.

config: Dict[str, Any] | None#
fetch_if_exists: bool#
instance_handle: str | None#
plugin_handle: str#
version: str | None#
class steamship.data.plugin.index_plugin_instance.EmbeddingIndexPluginInstance(*, client: Client = None, id: str = None, handle: str = None, pluginId: str = None, pluginVersionId: str = None, pluginHandle: str | None = None, pluginVersionHandle: str | None = None, workspaceId: str | None = None, userId: str = None, config: Dict[str, Any] = None, hostingType: HostingType | None = None, hostingCpu: HostingCpu | None = None, hostingMemory: HostingMemory | None = None, hostingTimeout: HostingTimeout | None = None, hostingEnvironment: HostingEnvironment | None = None, initStatus: InvocableInitStatus | None = None, embedder: PluginInstance = None, index: EmbeddingIndex = None)[source]#

Bases: PluginInstance

A persistent, read-optimized index over embeddings.

This is currently implemented as an object which behaves like a PluginInstance even though it isn’t from an implementation perspective on the back-end.

static create(client: Any, plugin_id: str = None, plugin_handle: str = None, plugin_version_id: str = None, plugin_version_handle: str = None, handle: str = None, fetch_if_exists: bool = True, config: Dict[str, Any] = None) EmbeddingIndexPluginInstance[source]#

Create a class that simulates an embedding index re-implemented as a PluginInstance.

delete()[source]#

Delete the EmbeddingIndexPluginInstnace.

For now, we will have this correspond to deleting the index but not the embedder. This is likely a temporary design.

embedder: PluginInstance#
index: EmbeddingIndex#
insert(tags: Tag | List[Tag], allow_long_records: bool = False)[source]#

Insert tags into the embedding index.

reset()[source]#
search(query: str, k: int | None = None) Task[SearchResults][source]#

Search the embedding index.

This wrapper implementation simply projects the Hit data structure into a Tag

class steamship.data.plugin.index_plugin_instance.SearchResult(*, tag: Tag | None = None, score: float | None = None)[source]#

Bases: CamelModel

A single scored search result – which is always a tag.

This class is intended to eventually replace the QueryResult object currently used with the Embedding layer.

static from_query_result(query_result: QueryResult, client: Client) SearchResult[source]#
score: float | None#
tag: Tag | None#
class steamship.data.plugin.index_plugin_instance.SearchResults(*, items: List[SearchResult] = None)[source]#

Bases: CamelModel

Results of a search operation – which is always a list of ranked tag.

This class is intended to eventually replace the QueryResults object currently used with the Embedding layer. TODO: add in paging support.

static from_query_results(query_results: QueryResults, client: Client) SearchResults[source]#
items: List[SearchResult]#
to_ranked_blocks() List[Block][source]#

steamship.data.plugin.plugin module#

class steamship.data.plugin.plugin.CreatePluginRequest(*, trainingPlatform: HostingType | None = None, id: str = None, type: str = None, transport: str = None, isPublic: bool = None, handle: str = None, description: str = None, metadata: str = None, fetchIfExists: bool = False)[source]#

Bases: Request

description: str#
fetch_if_exists: bool#
handle: str#
id: str#
is_public: bool#
metadata: str#
training_platform: HostingType | None#
transport: str#
type: str#
class steamship.data.plugin.plugin.ListPluginsRequest(*, pageSize: int | None = None, pageToken: str | None = None, sortOrder: SortOrder | None = SortOrder.DESC, type: str | None = None)[source]#

Bases: ListRequest

type: str | None#
class steamship.data.plugin.plugin.ListPluginsResponse(*, nextPageToken: str | None = None, plugins: List[Plugin])[source]#

Bases: ListResponse

plugins: List[Plugin]#
class steamship.data.plugin.plugin.Plugin(*, client: Client = None, id: str = None, type: str = None, transport: str = None, isPublic: bool = None, trainingPlatform: HostingType | None = None, handle: str = None, description: str = None, metadata: str = None, profile: Manifest | None = None, readme: str | None = None, userId: str | None = None)[source]#

Bases: CamelModel

client: Client#
static create(client: Client, description: str, type_: str, transport: str, is_public: bool, handle: str = None, training_platform: HostingType | None = None, metadata: str | Dict | List = None, fetch_if_exists: bool = False) Plugin[source]#
delete() Plugin[source]#

Delete this plugin. If this plugin is public and another user has created an instance of it, this method will throw an error and the plugin will not be deleted. Deleting the plugin will delete any versions and instances of it that you have created.

description: str#
static get(client: Client, handle: str)[source]#
handle: str#
id: str#
is_public: bool#
static list(client: Client, t: str = None, page_size: int | None = None, page_token: str | None = None, sort_order: SortOrder | None = SortOrder.DESC) ListPluginsResponse[source]#
metadata: str#
classmethod parse_obj(obj: Any) BaseModel[source]#
profile: Manifest | None#
readme: str | None#
training_platform: HostingType | None#
transport: str#
type: str#
update(client: Client) Plugin[source]#
user_id: str | None#
class steamship.data.plugin.plugin.PluginAdapterType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: str, Enum

huggingface = 'huggingface'#
openai = 'openai'#
steamship_docker = 'steamshipDocker'#
steamship_sagemaker = 'steamshipSagemaker'#
class steamship.data.plugin.plugin.PluginTargetType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: str, Enum

FILE = 'file'#
WORKSPACE = 'workspace'#
class steamship.data.plugin.plugin.PluginType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: str, Enum

classifier = 'classifier'#
embedder = 'embedder'#
generator = 'generator'#
parser = 'parser'#
tagger = 'tagger'#
class steamship.data.plugin.plugin.PluginUpdateRequest(*, id: str | None = None, handle: str | None = None, description: str | None = None, profile: Manifest | None = None, readme: str | None = None)[source]#

Bases: UpdateRequest

description: str | None#
handle: str | None#
id: str | None#
profile: Manifest | None#
readme: str | None#

steamship.data.plugin.plugin_instance module#

class steamship.data.plugin.plugin_instance.CreatePluginInstanceRequest(*, id: str = None, pluginId: str = None, pluginHandle: str = None, pluginVersionId: str = None, pluginVersionHandle: str = None, handle: str = None, fetchIfExists: bool = None, config: Dict[str, Any] = None)[source]#

Bases: Request

config: Dict[str, Any]#
fetch_if_exists: bool#
handle: str#
id: str#
plugin_handle: str#
plugin_id: str#
plugin_version_handle: str#
plugin_version_id: str#
class steamship.data.plugin.plugin_instance.PluginInstance(*, client: Client = None, id: str = None, handle: str = None, pluginId: str = None, pluginVersionId: str = None, pluginHandle: str | None = None, pluginVersionHandle: str | None = None, workspaceId: str | None = None, userId: str = None, config: Dict[str, Any] = None, hostingType: HostingType | None = None, hostingCpu: HostingCpu | None = None, hostingMemory: HostingMemory | None = None, hostingTimeout: HostingTimeout | None = None, hostingEnvironment: HostingEnvironment | None = None, initStatus: InvocableInitStatus | None = None)[source]#

Bases: CamelModel

client: Client#
config: Dict[str, Any]#
static create(client: Client, plugin_id: str = None, plugin_handle: str = None, plugin_version_id: str = None, plugin_version_handle: str = None, handle: str = None, fetch_if_exists: bool = True, config: Dict[str, Any] = None) PluginInstance[source]#

Create a plugin instance

When handle is empty the engine will automatically assign one fetch_if_exists controls whether we want to re-use an existing plugin instance or not.

delete() PluginInstance[source]#
generate(input_file_id: str = None, input_file_start_block_index: int = None, input_file_end_block_index: int | None = None, input_file_block_index_list: List[int] | None = None, text: str | None = None, block_query: str | None = None, append_output_to_file: bool = False, output_file_id: str | None = None, make_output_public: bool | None = None, options: dict | None = None, streaming: bool | None = None, tags: List[Tag] | None = None) Task[GenerateResponse][source]#

See GenerateRequest for description of parameter options

static get(client: Client, handle: str) PluginInstance[source]#
get_training_parameters(training_request: TrainingParameterPluginInput) TrainingParameterPluginOutput[source]#
handle: str#
hosting_cpu: HostingCpu | None#
hosting_environment: HostingEnvironment | None#
hosting_memory: HostingMemory | None#
hosting_timeout: HostingTimeout | None#
hosting_type: HostingType | None#
id: str#
init_status: InvocableInitStatus | None#
classmethod parse_obj(obj: Any) BaseModel[source]#
plugin_handle: str | None#
plugin_id: str#
plugin_version_handle: str | None#
plugin_version_id: str#
refresh_init_status()[source]#
tag(doc: str | File) Task[TagResponse][source]#
train(training_request: TrainingParameterPluginInput = None, training_epochs: int | None = None, export_query: str | None = None, testing_holdout_percent: float | None = None, test_split_seed: int | None = None, training_params: Dict | None = None, inference_params: Dict | None = None) Task[TrainPluginOutput][source]#

Train a plugin instance. Please provide either training_request OR the other parameters; passing training_request ignores all other parameters, but is kept for backwards compatibility.

user_id: str#
wait_for_init(max_timeout_s: float = 180, retry_delay_s: float = 1)[source]#

Polls and blocks until the init has succeeded or failed (or timeout reached).

Parameters:
  • max_timeout_s (int) – Max timeout in seconds. Default: 180s. After this timeout, an exception will be thrown.

  • retry_delay_s (float) – Delay between status checks. Default: 1s.

workspace_id: str | None#

steamship.data.plugin.plugin_version module#

class steamship.data.plugin.plugin_version.CreatePluginVersionRequest(*, pluginId: str = None, handle: str = None, hostingMemory: HostingMemory | None = None, hostingTimeout: HostingTimeout | None = None, hostingHandler: str = None, isPublic: bool = None, isDefault: bool = None, type: str = 'file', configTemplate: str = None, streaming: bool | None = None)[source]#

Bases: Request

config_template: str#
handle: str#
hosting_handler: str#
hosting_memory: HostingMemory | None#
hosting_timeout: HostingTimeout | None#
is_default: bool#
is_public: bool#
plugin_id: str#
streaming: bool | None#
type: str#
class steamship.data.plugin.plugin_version.ListPluginVersionsRequest(*, handle: str, pluginId: str)[source]#

Bases: Request

handle: str#
plugin_id: str#
class steamship.data.plugin.plugin_version.ListPluginVersionsResponse(*, plugins: List[PluginVersion])[source]#

Bases: Response

plugins: List[PluginVersion]#
class steamship.data.plugin.plugin_version.PluginVersion(*, client: Client = None, id: str = None, pluginId: str = None, handle: str = None, hostingMemory: HostingMemory | None = None, hostingTimeout: HostingTimeout | None = None, hostingHandler: str = None, isPublic: bool = None, isDefault: bool = None, configTemplate: Dict[str, Any] = None)[source]#

Bases: CamelModel

client: Client#
config_template: Dict[str, Any]#
static create(client: Client, handle: str, plugin_id: str | None = None, filename: str | None = None, filebytes: bytes | None = None, hosting_memory: HostingMemory | None = None, hosting_timeout: HostingTimeout | None = None, hosting_handler: str | None = None, is_public: bool | None = None, is_default: bool | None = None, config_template: Dict[str, Any] | None = None, streaming: bool | None = None) PluginVersion[source]#
delete() PluginVersion[source]#

Delete this plugin version. If this plugin is public and another user has created an instance of this version, this method will throw an error and the PluginVersion will not be deleted. Deleting the PluginVersion will delete any instances of it that you have created.

handle: str#
hosting_handler: str#
hosting_memory: HostingMemory | None#
hosting_timeout: HostingTimeout | None#
id: str#
is_default: bool#
is_public: bool#
static list(client: Client, plugin_id: str = None, handle: str = None, public: bool = True) ListPluginVersionsResponse[source]#
classmethod parse_obj(obj: Any) BaseModel[source]#
plugin_id: str#

steamship.data.plugin.prompt_generation_plugin_instance module#

class steamship.data.plugin.prompt_generation_plugin_instance.PromptGenerationPluginInstance(*, client: Client = None, id: str = None, handle: str = None, pluginId: str = None, pluginVersionId: str = None, pluginHandle: str | None = None, pluginVersionHandle: str | None = None, workspaceId: str | None = None, userId: str = None, config: Dict[str, Any] = None, hostingType: HostingType | None = None, hostingCpu: HostingCpu | None = None, hostingMemory: HostingMemory | None = None, hostingTimeout: HostingTimeout | None = None, hostingEnvironment: HostingEnvironment | None = None, initStatus: InvocableInitStatus | None = None)[source]#

Bases: PluginInstance

An instance of a configured prompt completion service such as GPT-3.

The generate method synchronously invokes the prompt against a set of variables that parameterize it. The return value is a single string.

Example Usage:

llm = Steamship.use(‘prompt-generation-default’, config={ “temperature”: 0.9 }) PROMPT = “Greet {name} as if he were a {relation}.” greeting = llm.generate(PROMPT, {“name”: “Ted”, “relation”: “old friend”})

static create(client: Client, plugin_id: str = None, plugin_handle: str = None, plugin_version_id: str = None, plugin_version_handle: str = None, handle: str = None, fetch_if_exists: bool = True, config: Dict[str, Any] = None) PromptGenerationPluginInstance[source]#

Create a plugin instance

When handle is empty the engine will automatically assign one fetch_if_exists controls whether we want to re-use an existing plugin instance or not.

generate(prompt: str, variables: Dict | None = None, clean_output: bool = True) str[source]#

Complete the provided prompt, interpolating any variables.

Module contents#

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

Bases: str, Enum

The amount of CPU required for deployment.

This is mapped to a value dependent on the HostingType it is combined with.

LG = 'lg'#
MAX = 'max'#
MD = 'md'#
MIN = 'min'#
SM = 'sm'#
XL = 'xl'#
XS = 'xs'#
XXL = 'xxl'#
XXS = 'xxs'#
class steamship.data.plugin.HostingEnvironment(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: str, Enum

The software environment required for deployment.

PYTHON38 = 'python38'#
STEAMSHIP_PYTORCH_CPU = 'inferenceCpu'#
class steamship.data.plugin.HostingMemory(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: str, Enum

The amount of memory required for deployment.

This is mapped to a value dependent on the HostingType it is combined with.

LG = 'lg'#
MAX = 'max'#
MD = 'md'#
MIN = 'min'#
SM = 'sm'#
XL = 'xl'#
XS = 'xs'#
XXL = 'xxl'#
XXS = 'xxs'#
class steamship.data.plugin.HostingTimeout(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: str, Enum

The request timeout required for deployment.

This is mapped to a value dependent on the HostingType it is combined with.

LG = 'lg'#
MAX = 'max'#
MD = 'md'#
MIN = 'min'#
SM = 'sm'#
XL = 'xl'#
XS = 'xs'#
XXL = 'xxl'#
XXS = 'xxs'#
class steamship.data.plugin.HostingType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: str, Enum

The type of hosting provider to deploy to.

ECS = 'ecs'#
LAMBDA = 'lambda'#
class steamship.data.plugin.Plugin(*, client: Client = None, id: str = None, type: str = None, transport: str = None, isPublic: bool = None, trainingPlatform: HostingType | None = None, handle: str = None, description: str = None, metadata: str = None, profile: Manifest | None = None, readme: str | None = None, userId: str | None = None)[source]#

Bases: CamelModel

client: Client#
static create(client: Client, description: str, type_: str, transport: str, is_public: bool, handle: str = None, training_platform: HostingType | None = None, metadata: str | Dict | List = None, fetch_if_exists: bool = False) Plugin[source]#
delete() Plugin[source]#

Delete this plugin. If this plugin is public and another user has created an instance of it, this method will throw an error and the plugin will not be deleted. Deleting the plugin will delete any versions and instances of it that you have created.

description: str#
static get(client: Client, handle: str)[source]#
handle: str#
id: str#
is_public: bool#
static list(client: Client, t: str = None, page_size: int | None = None, page_token: str | None = None, sort_order: SortOrder | None = SortOrder.DESC) ListPluginsResponse[source]#
metadata: str#
classmethod parse_obj(obj: Any) BaseModel[source]#
profile: Manifest | None#
readme: str | None#
training_platform: HostingType | None#
transport: str#
type: str#
update(client: Client) Plugin[source]#
user_id: str | None#
class steamship.data.plugin.PluginAdapterType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: str, Enum

huggingface = 'huggingface'#
openai = 'openai'#
steamship_docker = 'steamshipDocker'#
steamship_sagemaker = 'steamshipSagemaker'#
class steamship.data.plugin.PluginInstance(*, client: Client = None, id: str = None, handle: str = None, pluginId: str = None, pluginVersionId: str = None, pluginHandle: str | None = None, pluginVersionHandle: str | None = None, workspaceId: str | None = None, userId: str = None, config: Dict[str, Any] = None, hostingType: HostingType | None = None, hostingCpu: HostingCpu | None = None, hostingMemory: HostingMemory | None = None, hostingTimeout: HostingTimeout | None = None, hostingEnvironment: HostingEnvironment | None = None, initStatus: InvocableInitStatus | None = None)[source]#

Bases: CamelModel

client: Client#
config: Dict[str, Any]#
static create(client: Client, plugin_id: str = None, plugin_handle: str = None, plugin_version_id: str = None, plugin_version_handle: str = None, handle: str = None, fetch_if_exists: bool = True, config: Dict[str, Any] = None) PluginInstance[source]#

Create a plugin instance

When handle is empty the engine will automatically assign one fetch_if_exists controls whether we want to re-use an existing plugin instance or not.

delete() PluginInstance[source]#
generate(input_file_id: str = None, input_file_start_block_index: int = None, input_file_end_block_index: int | None = None, input_file_block_index_list: List[int] | None = None, text: str | None = None, block_query: str | None = None, append_output_to_file: bool = False, output_file_id: str | None = None, make_output_public: bool | None = None, options: dict | None = None, streaming: bool | None = None, tags: List[Tag] | None = None) Task[GenerateResponse][source]#

See GenerateRequest for description of parameter options

static get(client: Client, handle: str) PluginInstance[source]#
get_training_parameters(training_request: TrainingParameterPluginInput) TrainingParameterPluginOutput[source]#
handle: str#
hosting_cpu: HostingCpu | None#
hosting_environment: HostingEnvironment | None#
hosting_memory: HostingMemory | None#
hosting_timeout: HostingTimeout | None#
hosting_type: HostingType | None#
id: str#
init_status: InvocableInitStatus | None#
classmethod parse_obj(obj: Any) BaseModel[source]#
plugin_handle: str | None#
plugin_id: str#
plugin_version_handle: str | None#
plugin_version_id: str#
refresh_init_status()[source]#
tag(doc: str | File) Task[TagResponse][source]#
train(training_request: TrainingParameterPluginInput = None, training_epochs: int | None = None, export_query: str | None = None, testing_holdout_percent: float | None = None, test_split_seed: int | None = None, training_params: Dict | None = None, inference_params: Dict | None = None) Task[TrainPluginOutput][source]#

Train a plugin instance. Please provide either training_request OR the other parameters; passing training_request ignores all other parameters, but is kept for backwards compatibility.

user_id: str#
wait_for_init(max_timeout_s: float = 180, retry_delay_s: float = 1)[source]#

Polls and blocks until the init has succeeded or failed (or timeout reached).

Parameters:
  • max_timeout_s (int) – Max timeout in seconds. Default: 180s. After this timeout, an exception will be thrown.

  • retry_delay_s (float) – Delay between status checks. Default: 1s.

workspace_id: str | None#
class steamship.data.plugin.PluginTargetType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: str, Enum

FILE = 'file'#
WORKSPACE = 'workspace'#
class steamship.data.plugin.PluginType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: str, Enum

classifier = 'classifier'#
embedder = 'embedder'#
generator = 'generator'#
parser = 'parser'#
tagger = 'tagger'#
class steamship.data.plugin.PluginVersion(*, client: Client = None, id: str = None, pluginId: str = None, handle: str = None, hostingMemory: HostingMemory | None = None, hostingTimeout: HostingTimeout | None = None, hostingHandler: str = None, isPublic: bool = None, isDefault: bool = None, configTemplate: Dict[str, Any] = None)[source]#

Bases: CamelModel

client: Client#
config_template: Dict[str, Any]#
static create(client: Client, handle: str, plugin_id: str | None = None, filename: str | None = None, filebytes: bytes | None = None, hosting_memory: HostingMemory | None = None, hosting_timeout: HostingTimeout | None = None, hosting_handler: str | None = None, is_public: bool | None = None, is_default: bool | None = None, config_template: Dict[str, Any] | None = None, streaming: bool | None = None) PluginVersion[source]#
delete() PluginVersion[source]#

Delete this plugin version. If this plugin is public and another user has created an instance of this version, this method will throw an error and the PluginVersion will not be deleted. Deleting the PluginVersion will delete any instances of it that you have created.

handle: str#
hosting_handler: str#
hosting_memory: HostingMemory | None#
hosting_timeout: HostingTimeout | None#
id: str#
is_default: bool#
is_public: bool#
static list(client: Client, plugin_id: str = None, handle: str = None, public: bool = True) ListPluginVersionsResponse[source]#
classmethod parse_obj(obj: Any) BaseModel[source]#
plugin_id: str#