steamship.data package#

Subpackages#

Submodules#

steamship.data.block module#

class steamship.data.block.Block(*, client: Client = None, id: str = None, fileId: str = None, text: str = None, tags: Optional[List[Tag]] = [], index: Optional[int] = None, mimeType: Optional[MimeTypes] = None, publicData: bool = False, url: Optional[str] = None, contentURL: Optional[str] = None, uploadType: Optional[BlockUploadType] = None, uploadBytes: Optional[bytes] = None)[source]#

Bases: CamelModel

A Block is a chunk of content within a File. It can be plain text content, image content, video content, etc. If the content is not text, the text value may be the empty string for backwards compatibility.

class ListRequest(*, fileId: str = None)[source]#

Bases: Request

file_id: str#
class ListResponse(*, blocks: List[Block] = [])[source]#

Bases: Response

blocks: List[Block]#
as_llm_input() str[source]#
property chat_id: str#
property chat_role: Optional[RoleTag]#
client: Client#
content_url: Optional[str]#
static create(client: Client, file_id: str, text: Optional[str] = None, tags: Optional[List[Tag]] = None, content: Optional[Union[str, bytes]] = None, url: Optional[str] = None, mime_type: Optional[MimeTypes] = None, public_data: bool = False) Block[source]#

Create a new Block within a File specified by file_id.

You can create a Block in several ways: - Providing raw text as the text parameter; - Providing the content of the block as string or bytes; - Providing a publicly accessible URL where the content is stored.

delete() Block[source]#
file_id: str#
static get(client: Client, _id: Optional[str] = None) Block[source]#
id: str#
index(embedding_plugin_instance: Optional[Any] = None)[source]#

Index this block.

index_in_file: Optional[int]#
is_audio()[source]#

Return whether this is an audio Block.

is_image()[source]#

Return whether this is an image Block.

is_text() bool[source]#

Return whether this is a text Block.

is_video()[source]#

Return whether this is a video Block.

property message_id: str#
mime_type: Optional[MimeTypes]#
classmethod parse_obj(obj: Any) BaseModel[source]#
public_data: bool#
static query(client: Client, tag_filter_query: str) BlockQueryResponse[source]#
raw()[source]#
property raw_data_url: Optional[str]#

Return a URL at which the data content of this Block can be accessed. If public_data is True, this content can be accessed without an API key.

set_chat_id(chat_id: str)[source]#
set_chat_role(role: RoleTag)[source]#
set_message_id(message_id: str)[source]#
set_public_data(public_data: bool)[source]#

Set the public_data flag on this Block. If this object already exists server-side, update the flag.

tags: Optional[List[Tag]]#
text: str#
upload_bytes: Optional[bytes]#
upload_type: Optional[BlockUploadType]#
url: Optional[str]#
class steamship.data.block.BlockQueryRequest(*, tagFilterQuery: str)[source]#

Bases: Request

tag_filter_query: str#
class steamship.data.block.BlockQueryResponse(*, blocks: List[Block])[source]#

Bases: Response

blocks: List[Block]#
class steamship.data.block.BlockUploadType(value)[source]#

Bases: str, Enum

An enumeration.

BLOCKS = 'blocks'#
FILE = 'file'#
NONE = 'none'#
URL = 'url'#
steamship.data.block.get_tag_value_key(tags: Optional[List[Tag]], key: str, kind: Optional[str] = None, name: Optional[str] = None) Optional[any][source]#

Iterates through a list of tags and returns the first that contains the provided Kind/Name/ValueKey.

steamship.data.embeddings module#

class steamship.data.embeddings.EmbedAndSearchRequest(*, query: str, docs: List[str], pluginInstance: str, k: int = 1)[source]#

Bases: Request

docs: List[str]#
k: int#
plugin_instance: str#
query: str#
class steamship.data.embeddings.EmbeddedItem(*, id: str = None, indexId: str = None, fileId: str = None, blockId: str = None, tagId: str = None, value: str = None, externalId: str = None, externalType: str = None, metadata: Any = None, embedding: List[float] = None)[source]#

Bases: CamelModel

block_id: str#
clone_for_insert() EmbeddedItem[source]#

Produces a clone with a string representation of the metadata

embedding: List[float]#
external_id: str#
external_type: str#
file_id: str#
id: str#
index_id: str#
metadata: Any#
tag_id: str#
value: str#
class steamship.data.embeddings.EmbeddingIndex(*, client: Client = None, id: str = None, handle: str = None, name: str = None, plugin: str = None, externalId: str = None, externalType: str = None, metadata: str = None)[source]#

Bases: CamelModel

A persistent, read-optimized index over embeddings.

client: Client#
static create(client: Client, handle: Optional[str] = None, name: Optional[str] = None, embedder_plugin_instance_handle: Optional[str] = None, fetch_if_exists: bool = True, external_id: Optional[str] = None, external_type: Optional[str] = None, metadata: Optional[Any] = None) EmbeddingIndex[source]#
delete() EmbeddingIndex[source]#
embed() Task[IndexEmbedResponse][source]#
external_id: str#
external_type: str#
handle: str#
id: str#
insert(value: str, external_id: Optional[str] = None, external_type: Optional[str] = None, metadata: Optional[Union[int, float, bool, str, List, Dict]] = None, reindex: bool = True, allow_long_records=False) IndexInsertResponse[source]#
insert_file(file_id: str, block_type: Optional[str] = None, external_id: Optional[str] = None, external_type: Optional[str] = None, metadata: Optional[Union[int, float, bool, str, List, Dict]] = None, reindex: bool = True) IndexInsertResponse[source]#
insert_many(items: List[Union[EmbeddedItem, str]], reindex: bool = True, allow_long_records=False) IndexInsertResponse[source]#
list_items(file_id: Optional[str] = None, block_id: Optional[str] = None, span_id: Optional[str] = None, page_size: Optional[int] = None, page_token: Optional[str] = None, sort_order: Optional[SortOrder] = SortOrder.DESC) ListItemsResponse[source]#
metadata: str#
name: str#
classmethod parse_obj(obj: Any) BaseModel[source]#
plugin: str#
search(query: Union[str, List[str]], k: int = 1, include_metadata: bool = False) Task[QueryResults][source]#
class steamship.data.embeddings.IndexCreateRequest(*, handle: str = None, name: str = None, pluginInstance: str = None, fetchIfExists: bool = True, externalId: str = None, externalType: str = None, metadata: Any = None)[source]#

Bases: Request

external_id: str#
external_type: str#
fetch_if_exists: bool#
handle: str#
metadata: Any#
name: str#
plugin_instance: str#
class steamship.data.embeddings.IndexEmbedRequest(*, id: str)[source]#

Bases: Request

id: str#
class steamship.data.embeddings.IndexEmbedResponse(*, id: Optional[str] = None)[source]#

Bases: Response

id: Optional[str]#
class steamship.data.embeddings.IndexInsertRequest(*, indexId: str, items: List[EmbeddedItem] = None, value: str = None, fileId: str = None, blockType: str = None, externalId: str = None, externalType: str = None, metadata: Any = None, reindex: bool = True)[source]#

Bases: Request

block_type: str#
external_id: str#
external_type: str#
file_id: str#
index_id: str#
items: List[EmbeddedItem]#
metadata: Any#
reindex: bool#
value: str#
class steamship.data.embeddings.IndexInsertResponse(*, itemIds: List[IndexItemId] = None)[source]#

Bases: Response

item_ids: List[IndexItemId]#
class steamship.data.embeddings.IndexItemId(*, indexId: str = None, id: str = None)[source]#

Bases: CamelModel

id: str#
index_id: str#
class steamship.data.embeddings.IndexSearchRequest(*, id: str, query: str = None, queries: List[str] = None, k: int = 1, includeMetadata: bool = False)[source]#

Bases: Request

id: str#
include_metadata: bool#
k: int#
queries: List[str]#
query: str#
class steamship.data.embeddings.ListItemsRequest(*, pageSize: Optional[int] = None, pageToken: Optional[str] = None, sortOrder: Optional[SortOrder] = SortOrder.DESC, id: str = None, fileId: str = None, blockId: str = None, spanId: str = None)[source]#

Bases: ListRequest

block_id: str#
file_id: str#
id: str#
span_id: str#
class steamship.data.embeddings.ListItemsResponse(*, nextPageToken: Optional[str] = None, items: List[EmbeddedItem])[source]#

Bases: ListResponse

items: List[EmbeddedItem]#
class steamship.data.embeddings.QueryResult(*, value: Optional[Hit] = None, score: Optional[float] = None, index: Optional[int] = None, id: Optional[str] = None)[source]#

Bases: CamelModel

id: Optional[str]#
index: Optional[int]#
score: Optional[float]#
value: Optional[Hit]#
class steamship.data.embeddings.QueryResults(*, items: List[QueryResult] = None)[source]#

Bases: Request

items: List[QueryResult]#

steamship.data.file module#

class steamship.data.file.File(*, client: Client = None, id: str = None, handle: str = None, mimeType: MimeTypes = None, workspaceId: str = None, blocks: List[Block] = [], tags: List[Tag] = [], filename: str = None, publicData: bool = False)[source]#

Bases: CamelModel

A file.

class CreateResponse(data: Any = None, string: str = None, _bytes: Union[bytes, io.BytesIO] = None, json: io.BytesIO = None, mime_type: str = None)[source]#

Bases: Response

data_: Any#
mime_type: str#
classmethod parse_obj(obj: Any) Response[source]#
append_block(text: Optional[str] = None, tags: Optional[List[Tag]] = None, content: Optional[Union[str, bytes]] = None, url: Optional[str] = None, mime_type: Optional[MimeTypes] = None, public_data: bool = False) Block[source]#

Append a new block to this File. This is a convenience wrapper around Block.create(). You should provide only one of text, content, or url.

This is a server-side operation, saving the new Block to the file. The new block is appended to this client-side File as well for convenience.

blockify(plugin_instance: Optional[str] = None, wait_on_tasks: Optional[List[Task]] = None) Task[source]#
blocks: List[Block]#
client: Client#
static create(client: Client, content: Optional[Union[str, bytes]] = None, mime_type: Optional[MimeTypes] = None, handle: Optional[str] = None, blocks: Optional[List[Block]] = None, tags: Optional[List[Tag]] = None, public_data: bool = False) Any[source]#
static create_with_plugin(client: Client, plugin_instance: str, url: str = None, mime_type: str = None) Task[File][source]#
delete() File[source]#
filename: str#
generate(plugin_instance_handle: str, start_block_index: int = None, end_block_index: Optional[int] = None, block_index_list: Optional[List[int]] = None, append_output_to_file: bool = True, options: Optional[dict] = None, wait_on_tasks: List[Task] = None, make_output_public: bool = False) Task[GenerateResponse][source]#

Generate new content from this file. Assumes this file as context for input and output. May specify start and end blocks.

static get(client: Client, _id: Optional[str] = None, handle: Optional[str] = None) File[source]#
handle: str#
id: str#
index(plugin_instance: Optional[Any] = None) EmbeddingIndex[source]#

Index every block in the file.

TODO(ted): Enable indexing the results of a tag query. TODO(ted): It’s hard to load the EmbeddingIndexPluginInstance with just a handle because of the chain of things that need to be created to it to function.

static list(client: Client, page_size: Optional[int] = None, page_token: Optional[str] = None, sort_order: Optional[SortOrder] = SortOrder.DESC) ListFileResponse[source]#
mime_type: MimeTypes#
classmethod parse_obj(obj: Any) BaseModel[source]#
public_data: bool#
static query(client: Client, tag_filter_query: str) FileQueryResponse[source]#
raw()[source]#
property raw_data_url: Optional[str]#

Return a URL at which the data content of this File can be accessed. If public_data is True, this content can be accessed without an API key.

refresh() File[source]#
set_public_data(public_data: bool)[source]#

Set the public_data flag on this File. If this object already exists server-side, update the flag.

tag(plugin_instance: str = None, wait_on_tasks: List[Task] = None) Task[TagResponse][source]#
tags: List[Tag]#
workspace_id: str#
class steamship.data.file.FileClearResponse(*, id: str)[source]#

Bases: Response

id: str#
class steamship.data.file.FileQueryRequest(*, tagFilterQuery: str)[source]#

Bases: Request

tag_filter_query: str#
class steamship.data.file.FileQueryResponse(*, files: List[File])[source]#

Bases: Response

files: List[File]#
class steamship.data.file.FileUploadType(value)[source]#

Bases: str, Enum

An enumeration.

BLOCKS = 'blocks'#
FILE = 'file'#
FILE_IMPORTER = 'fileImporter'#
class steamship.data.file.ListFileRequest(*, pageSize: Optional[int] = None, pageToken: Optional[str] = None, sortOrder: Optional[SortOrder] = SortOrder.DESC)[source]#

Bases: ListRequest

class steamship.data.file.ListFileResponse(*, nextPageToken: Optional[str] = None, files: List[File])[source]#

Bases: ListResponse

files: List[File]#

steamship.data.invocable_init_status module#

class steamship.data.invocable_init_status.InvocableInitStatus(value)[source]#

Bases: str, Enum

An enumeration.

COMPLETE = 'complete'#
FAILED = 'failed'#
INITIALIZING = 'initializing'#
NOT_NEEDED = 'notNeeded'#

steamship.data.manifest module#

class steamship.data.manifest.ConfigParameter(*, type: ConfigParameterType, description: Optional[str] = None, default: Optional[Union[StrictStr, StrictBool, StrictFloat, StrictInt]] = None)[source]#

Bases: BaseModel

default: Optional[Union[StrictStr, StrictBool, StrictFloat, StrictInt]]#
description: Optional[str]#
type: ConfigParameterType#
class steamship.data.manifest.ConfigParameterType(value)[source]#

Bases: str, Enum

An enumeration.

BOOLEAN = 'boolean'#
NUMBER = 'number'#
STRING = 'string'#
static from_python_type(t: Type)[source]#
class steamship.data.manifest.DeployableType(value)[source]#

Bases: str, Enum

An enumeration.

PACKAGE = 'package'#
PLUGIN = 'plugin'#
class steamship.data.manifest.Manifest(*, type: DeployableType, handle: str, version: str, description: Optional[str] = None, author: Optional[str] = None, entrypoint: str = 'Unused', public: bool, plugin: Optional[PluginConfig] = None, build_config: Dict[str, List[str]] = {'ignore': []}, configTemplate: Optional[Dict[str, ConfigParameter]] = None, steamshipRegistry: SteamshipRegistry)[source]#

Bases: BaseModel

author: Optional[str]#
build_config: Dict[str, List[str]]#
configTemplate: Optional[Dict[str, ConfigParameter]]#
config_template_as_dict()[source]#
description: Optional[str]#
entrypoint: str#
handle: str#
static load_manifest() Manifest[source]#
plugin: Optional[PluginConfig]#
public: bool#
save()[source]#
steamshipRegistry: SteamshipRegistry#
type: DeployableType#
version: str#
class steamship.data.manifest.PluginConfig(*, isTrainable: Optional[bool] = False, transport: str = 'jsonOverHttp', type: str)[source]#

Bases: BaseModel

isTrainable: Optional[bool]#
transport: str#
type: str#
class steamship.data.manifest.SteamshipRegistry(*, tagline: Optional[str] = None, tagline2: Optional[str] = None, usefulFor: Optional[str] = None, videoUrl: Optional[str] = None, githubUrl: Optional[str] = None, demoUrl: Optional[str] = None, blogUrl: Optional[str] = None, jupyterUrl: Optional[str] = None, authorGithub: Optional[str] = None, authorName: Optional[str] = None, authorEmail: Optional[str] = None, authorTwitter: Optional[str] = None, authorUrl: Optional[str] = None, tags: List[str])[source]#

Bases: BaseModel

authorEmail: Optional[str]#
authorGithub: Optional[str]#
authorName: Optional[str]#
authorTwitter: Optional[str]#
authorUrl: Optional[str]#
blogUrl: Optional[str]#
demoUrl: Optional[str]#
githubUrl: Optional[str]#
jupyterUrl: Optional[str]#
tagline: Optional[str]#
tagline2: Optional[str]#
tags: List[str]#
usefulFor: Optional[str]#
videoUrl: Optional[str]#

steamship.data.search module#

class steamship.data.search.Hit(*, id: str = None, index: int = None, indexSource: str = None, value: str = None, score: float = None, externalId: str = None, externalType: str = None, metadata: Any = None, query: str = None)[source]#

Bases: CamelModel

external_id: str#
external_type: str#
id: str#
index: int#
index_source: str#
metadata: Any#
query: str#
score: float#
value: str#

steamship.data.user module#

class steamship.data.user.User(*, client: Client = None, id: str = None, handle: str = None)[source]#

Bases: CamelModel

client: Client#
static current(client: Client) User[source]#
handle: str#
id: str#
classmethod parse_obj(obj: Any) BaseModel[source]#

steamship.data.workspace module#

class steamship.data.workspace.ListWorkspacesRequest(*, pageSize: Optional[int] = None, pageToken: Optional[str] = None, sortOrder: Optional[SortOrder] = SortOrder.DESC)[source]#

Bases: ListRequest

class steamship.data.workspace.ListWorkspacesResponse(*, nextPageToken: Optional[str] = None, workspaces: List[Workspace])[source]#

Bases: ListResponse

workspaces: List[Workspace]#
class steamship.data.workspace.SignedUrl[source]#

Bases: object

class Bucket(value)[source]#

Bases: str, Enum

An enumeration.

APP_DATA = 'appData'#
EXPORTS = 'exports'#
IMPORTS = 'imports'#
PLUGIN_DATA = 'pluginData'#
USER_DATA = 'userData'#
class Operation(value)[source]#

Bases: str, Enum

An enumeration.

READ = 'Read'#
WRITE = 'Write'#
class Request(*, bucket: SignedUrl.Bucket, filepath: str, operation: SignedUrl.Operation, expiresInMinutes: int = None)[source]#

Bases: Request

bucket: Bucket#
expires_in_minutes: int#
filepath: str#
operation: Operation#
class Response(*, bucket: str = None, filepath: str = None, operation: str = None, expiresInMinutes: int = None, signedUrl: str = None)[source]#

Bases: Response

bucket: str#
expires_in_minutes: int#
filepath: str#
operation: str#
signed_url: str#
class steamship.data.workspace.Workspace(*, client: Client = None, id: str = None, handle: str = None)[source]#

Bases: CamelModel

class CreateRequest(*, id: Optional[str] = None, handle: Optional[str] = None, fetchIfExists: Optional[bool] = None, externalId: Optional[str] = None, externalType: Optional[str] = None, metadata: Optional[str] = None)[source]#

Bases: Request

external_id: Optional[str]#
external_type: Optional[str]#
fetch_if_exists: Optional[bool]#
handle: Optional[str]#
id: Optional[str]#
metadata: Optional[str]#
client: Client#
static create(client: Client, handle: Optional[str] = None, external_id: Optional[str] = None, external_type: Optional[str] = None, metadata: Optional[Any] = None, fetch_if_exists: bool = True) Workspace[source]#
create_signed_url(request: Request) Response[source]#
delete() Workspace[source]#
static get(client: Client, id_: Optional[str] = None, handle: Optional[str] = None, fetch_if_exists: Optional[bool] = None) Workspace[source]#
handle: str#
id: str#
static list(client: Client, t: Optional[str] = None, page_size: Optional[int] = None, page_token: Optional[str] = None, sort_order: Optional[SortOrder] = SortOrder.DESC) ListWorkspacesResponse[source]#
classmethod parse_obj(obj: Any) BaseModel[source]#

Module contents#

class steamship.data.Block(*, client: Client = None, id: str = None, fileId: str = None, text: str = None, tags: Optional[List[Tag]] = [], index: Optional[int] = None, mimeType: Optional[MimeTypes] = None, publicData: bool = False, url: Optional[str] = None, contentURL: Optional[str] = None, uploadType: Optional[BlockUploadType] = None, uploadBytes: Optional[bytes] = None)[source]#

Bases: CamelModel

A Block is a chunk of content within a File. It can be plain text content, image content, video content, etc. If the content is not text, the text value may be the empty string for backwards compatibility.

class ListRequest(*, fileId: str = None)[source]#

Bases: Request

file_id: str#
class ListResponse(*, blocks: List[Block] = [])[source]#

Bases: Response

blocks: List[Block]#
as_llm_input() str[source]#
property chat_id: str#
property chat_role: Optional[RoleTag]#
client: Client#
content_url: Optional[str]#
static create(client: Client, file_id: str, text: Optional[str] = None, tags: Optional[List[Tag]] = None, content: Optional[Union[str, bytes]] = None, url: Optional[str] = None, mime_type: Optional[MimeTypes] = None, public_data: bool = False) Block[source]#

Create a new Block within a File specified by file_id.

You can create a Block in several ways: - Providing raw text as the text parameter; - Providing the content of the block as string or bytes; - Providing a publicly accessible URL where the content is stored.

delete() Block[source]#
file_id: str#
static get(client: Client, _id: Optional[str] = None) Block[source]#
id: str#
index(embedding_plugin_instance: Optional[Any] = None)[source]#

Index this block.

index_in_file: Optional[int]#
is_audio()[source]#

Return whether this is an audio Block.

is_image()[source]#

Return whether this is an image Block.

is_text() bool[source]#

Return whether this is a text Block.

is_video()[source]#

Return whether this is a video Block.

property message_id: str#
mime_type: Optional[MimeTypes]#
classmethod parse_obj(obj: Any) BaseModel[source]#
public_data: bool#
static query(client: Client, tag_filter_query: str) BlockQueryResponse[source]#
raw()[source]#
property raw_data_url: Optional[str]#

Return a URL at which the data content of this Block can be accessed. If public_data is True, this content can be accessed without an API key.

set_chat_id(chat_id: str)[source]#
set_chat_role(role: RoleTag)[source]#
set_message_id(message_id: str)[source]#
set_public_data(public_data: bool)[source]#

Set the public_data flag on this Block. If this object already exists server-side, update the flag.

tags: Optional[List[Tag]]#
text: str#
upload_bytes: Optional[bytes]#
upload_type: Optional[BlockUploadType]#
url: Optional[str]#
class steamship.data.DocTag(value)[source]#

Bases: str, Enum

A set of name constants for Tags with a kind of TagKind.doc; appropriate for HTML and Markdown ideas.

ARTICLE = 'article'#
BLOCK_CODE = 'block-code'#
BLOCK_QUOTE = 'block-quote'#
CAPTION = 'caption'#
CHAPTER = 'chapter'#
CHAT = 'chat'#
DIV = 'div'#
DOCUMENT = 'document'#
EMPHASIZED = 'emphasized'#
FOOTER = 'footer'#
H1 = 'h1'#
H2 = 'h2'#
H3 = 'h3'#
H4 = 'h4'#
H5 = 'h5'#
HEADER = 'header'#
IMAGE = 'image'#
LINE = 'line'#
LIST_ITEM = 'list-item'#
MAIN = 'main'#
ORDERED_LIST = 'ordered-list'#
PAGE = 'page'#
PARAGRAPH = 'paragraph'#
PRE = 'pre'#
REGION = 'region'#
SENTENCE = 'sentence'#
SPAN = 'span'#
STRONG = 'strong'#
SUBTITLE = 'subtitle'#
TELETYPE = 'teletype'#
TEXT = 'text'#
TITLE = 'title'#
TOKEN = 'token'#
UNDERLINED = 'underlined'#
UNKNOWN = 'unknown'#
UNORDERED_LIST = 'unordered-list'#
static from_html_tag(tagname: Optional[str]) Optional[DocTag][source]#
class steamship.data.EmbeddingIndex(*, client: Client = None, id: str = None, handle: str = None, name: str = None, plugin: str = None, externalId: str = None, externalType: str = None, metadata: str = None)[source]#

Bases: CamelModel

A persistent, read-optimized index over embeddings.

client: Client#
static create(client: Client, handle: Optional[str] = None, name: Optional[str] = None, embedder_plugin_instance_handle: Optional[str] = None, fetch_if_exists: bool = True, external_id: Optional[str] = None, external_type: Optional[str] = None, metadata: Optional[Any] = None) EmbeddingIndex[source]#
delete() EmbeddingIndex[source]#
embed() Task[IndexEmbedResponse][source]#
external_id: str#
external_type: str#
handle: str#
id: str#
insert(value: str, external_id: Optional[str] = None, external_type: Optional[str] = None, metadata: Optional[Union[int, float, bool, str, List, Dict]] = None, reindex: bool = True, allow_long_records=False) IndexInsertResponse[source]#
insert_file(file_id: str, block_type: Optional[str] = None, external_id: Optional[str] = None, external_type: Optional[str] = None, metadata: Optional[Union[int, float, bool, str, List, Dict]] = None, reindex: bool = True) IndexInsertResponse[source]#
insert_many(items: List[Union[EmbeddedItem, str]], reindex: bool = True, allow_long_records=False) IndexInsertResponse[source]#
list_items(file_id: Optional[str] = None, block_id: Optional[str] = None, span_id: Optional[str] = None, page_size: Optional[int] = None, page_token: Optional[str] = None, sort_order: Optional[SortOrder] = SortOrder.DESC) ListItemsResponse[source]#
metadata: str#
name: str#
classmethod parse_obj(obj: Any) BaseModel[source]#
plugin: str#
search(query: Union[str, List[str]], k: int = 1, include_metadata: bool = False) Task[QueryResults][source]#
class steamship.data.File(*, client: Client = None, id: str = None, handle: str = None, mimeType: MimeTypes = None, workspaceId: str = None, blocks: List[Block] = [], tags: List[Tag] = [], filename: str = None, publicData: bool = False)[source]#

Bases: CamelModel

A file.

class CreateResponse(data: Any = None, string: str = None, _bytes: Union[bytes, io.BytesIO] = None, json: io.BytesIO = None, mime_type: str = None)[source]#

Bases: Response

data_: Any#
mime_type: str#
classmethod parse_obj(obj: Any) Response[source]#
append_block(text: Optional[str] = None, tags: Optional[List[Tag]] = None, content: Optional[Union[str, bytes]] = None, url: Optional[str] = None, mime_type: Optional[MimeTypes] = None, public_data: bool = False) Block[source]#

Append a new block to this File. This is a convenience wrapper around Block.create(). You should provide only one of text, content, or url.

This is a server-side operation, saving the new Block to the file. The new block is appended to this client-side File as well for convenience.

blockify(plugin_instance: Optional[str] = None, wait_on_tasks: Optional[List[Task]] = None) Task[source]#
blocks: List[Block]#
client: Client#
static create(client: Client, content: Optional[Union[str, bytes]] = None, mime_type: Optional[MimeTypes] = None, handle: Optional[str] = None, blocks: Optional[List[Block]] = None, tags: Optional[List[Tag]] = None, public_data: bool = False) Any[source]#
static create_with_plugin(client: Client, plugin_instance: str, url: str = None, mime_type: str = None) Task[File][source]#
delete() File[source]#
filename: str#
generate(plugin_instance_handle: str, start_block_index: int = None, end_block_index: Optional[int] = None, block_index_list: Optional[List[int]] = None, append_output_to_file: bool = True, options: Optional[dict] = None, wait_on_tasks: List[Task] = None, make_output_public: bool = False) Task[GenerateResponse][source]#

Generate new content from this file. Assumes this file as context for input and output. May specify start and end blocks.

static get(client: Client, _id: Optional[str] = None, handle: Optional[str] = None) File[source]#
handle: str#
id: str#
index(plugin_instance: Optional[Any] = None) EmbeddingIndex[source]#

Index every block in the file.

TODO(ted): Enable indexing the results of a tag query. TODO(ted): It’s hard to load the EmbeddingIndexPluginInstance with just a handle because of the chain of things that need to be created to it to function.

static list(client: Client, page_size: Optional[int] = None, page_token: Optional[str] = None, sort_order: Optional[SortOrder] = SortOrder.DESC) ListFileResponse[source]#
mime_type: MimeTypes#
classmethod parse_obj(obj: Any) BaseModel[source]#
public_data: bool#
static query(client: Client, tag_filter_query: str) FileQueryResponse[source]#
raw()[source]#
property raw_data_url: Optional[str]#

Return a URL at which the data content of this File can be accessed. If public_data is True, this content can be accessed without an API key.

refresh() File[source]#
set_public_data(public_data: bool)[source]#

Set the public_data flag on this File. If this object already exists server-side, update the flag.

tag(plugin_instance: str = None, wait_on_tasks: List[Task] = None) Task[TagResponse][source]#
tags: List[Tag]#
workspace_id: str#
class steamship.data.GenerationTag(value)[source]#

Bases: str, Enum

A set of name constants for Tags with a kind of TagKind.generation.

GIST = 'gist'#
HEADLINE = 'headline'#
PROMPT_COMPLETION = 'prompt-completion'#
SUMMARY = 'summary'#
class steamship.data.Package(*, client: Client = None, id: str = None, handle: str = None, userId: str = None, profile: Optional[Manifest] = None, description: Optional[str] = None, readme: Optional[str] = None, isPublic: bool = False)[source]#

Bases: CamelModel

client: Client#
static create(client: Client, handle: Optional[str] = None, profile: Optional[Manifest] = None, is_public=False, fetch_if_exists=False) Package[source]#
description: Optional[str]#
static get(client: Client, handle: str) Package[source]#
handle: str#
id: str#
is_public: bool#
classmethod parse_obj(obj: Any) BaseModel[source]#
profile: Optional[Manifest]#
readme: Optional[str]#
update(client: Client) Package[source]#
user_id: str#
class steamship.data.PackageInstance(*, client: Client = None, id: str = None, handle: str = None, packageId: str = None, packageHandle: Optional[str] = None, userHandle: str = None, packageVersionId: str = None, packageVersionHandle: Optional[str] = None, userId: str = None, invocationURL: str = None, config: Dict[str, Any] = None, workspaceId: str = None, workspaceHandle: str = None, initStatus: Optional[InvocableInitStatus] = None)[source]#

Bases: CamelModel

client: Client#
config: Dict[str, Any]#
static create(client: Client, package_id: Optional[str] = None, package_handle: Optional[str] = None, package_version_id: Optional[str] = None, package_version_handle: Optional[str] = None, handle: Optional[str] = None, fetch_if_exists: Optional[bool] = None, config: Optional[Dict[str, Any]] = None) PackageInstance[source]#
delete() PackageInstance[source]#
full_url_for(path: str)[source]#
static get(client: Client, handle: str) PackageInstance[source]#
handle: str#
id: str#
init_status: Optional[InvocableInitStatus]#
invocation_url: str#
invoke(path: str, verb: Verb = Verb.POST, timeout_s: Optional[float] = None, **kwargs)[source]#
load_missing_workspace_handle()[source]#
package_handle: Optional[str]#
package_id: str#
package_version_handle: Optional[str]#
package_version_id: str#
classmethod parse_obj(obj: Any) BaseModel[source]#
refresh_init_status()[source]#
user_handle: str#
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_handle: str#
workspace_id: str#
class steamship.data.PackageVersion(*, client: Client = None, id: str = None, packageId: str = None, handle: str = None, configTemplate: Dict[str, Any] = None)[source]#

Bases: CamelModel

client: Client#
config_template: Dict[str, Any]#
static create(client: Client, package_id: Optional[str] = None, handle: Optional[str] = None, filename: Optional[str] = None, filebytes: Optional[bytes] = None, config_template: Optional[Dict[str, Any]] = None, hosting_handler: Optional[str] = None) PackageVersion[source]#
handle: str#
id: str#
package_id: str#
classmethod parse_obj(obj: Any) BaseModel[source]#
class steamship.data.Plugin(*, client: Client = None, id: str = None, type: str = None, transport: str = None, isPublic: bool = None, trainingPlatform: Optional[HostingType] = None, handle: str = None, description: str = None, metadata: str = None, profile: Optional[Manifest] = None, readme: Optional[str] = None, userId: Optional[str] = None)[source]#

Bases: CamelModel

client: Client#
static create(client: Client, description: str, type_: str, transport: str, is_public: bool, handle: Optional[str] = None, training_platform: Optional[HostingType] = None, metadata: Optional[Union[str, Dict, List]] = None, fetch_if_exists: bool = False) Plugin[source]#
description: str#
static get(client: Client, handle: str)[source]#
handle: str#
id: str#
is_public: bool#
static list(client: Client, t: Optional[str] = None, page_size: Optional[int] = None, page_token: Optional[str] = None, sort_order: Optional[SortOrder] = SortOrder.DESC) ListPluginsResponse[source]#
metadata: str#
classmethod parse_obj(obj: Any) BaseModel[source]#
profile: Optional[Manifest]#
readme: Optional[str]#
training_platform: Optional[HostingType]#
transport: str#
type: str#
update(client: Client) Plugin[source]#
user_id: Optional[str]#
class steamship.data.PluginInstance(*, client: Client = None, id: str = None, handle: str = None, pluginId: str = None, pluginVersionId: str = None, pluginHandle: Optional[str] = None, pluginVersionHandle: Optional[str] = None, workspaceId: Optional[str] = None, userId: str = None, config: Dict[str, Any] = None, hostingType: Optional[HostingType] = None, hostingCpu: Optional[HostingCpu] = None, hostingMemory: Optional[HostingMemory] = None, hostingTimeout: Optional[HostingTimeout] = None, hostingEnvironment: Optional[HostingEnvironment] = None, initStatus: Optional[InvocableInitStatus] = None)[source]#

Bases: CamelModel

client: Client#
config: Dict[str, Any]#
static create(client: Client, plugin_id: Optional[str] = None, plugin_handle: Optional[str] = None, plugin_version_id: Optional[str] = None, plugin_version_handle: Optional[str] = None, handle: Optional[str] = None, fetch_if_exists: bool = True, config: Optional[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: Optional[int] = None, input_file_block_index_list: Optional[List[int]] = None, text: Optional[str] = None, block_query: Optional[str] = None, append_output_to_file: bool = False, output_file_id: Optional[str] = None, make_output_public: Optional[bool] = None, options: Optional[dict] = 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: Optional[HostingCpu]#
hosting_environment: Optional[HostingEnvironment]#
hosting_memory: Optional[HostingMemory]#
hosting_timeout: Optional[HostingTimeout]#
hosting_type: Optional[HostingType]#
id: str#
init_status: Optional[InvocableInitStatus]#
classmethod parse_obj(obj: Any) BaseModel[source]#
plugin_handle: Optional[str]#
plugin_id: str#
plugin_version_handle: Optional[str]#
plugin_version_id: str#
refresh_init_status()[source]#
tag(doc: Union[str, File]) Task[TagResponse][source]#
train(training_request: TrainingParameterPluginInput = None, training_epochs: Optional[int] = None, export_query: Optional[str] = None, testing_holdout_percent: Optional[float] = None, test_split_seed: Optional[int] = None, training_params: Optional[Dict] = None, inference_params: Optional[Dict] = 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: Optional[str]#
class steamship.data.PluginVersion(*, client: Client = None, id: str = None, pluginId: str = None, handle: str = None, hostingMemory: Optional[HostingMemory] = None, hostingTimeout: Optional[HostingTimeout] = 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, filename: str = None, filebytes: bytes = None, hosting_memory: Optional[HostingMemory] = None, hosting_timeout: Optional[HostingTimeout] = None, hosting_handler: str = None, is_public: bool = None, is_default: bool = None, config_template: Dict[str, Any] = None) Task[PluginVersion][source]#
handle: str#
hosting_handler: str#
hosting_memory: Optional[HostingMemory]#
hosting_timeout: Optional[HostingTimeout]#
id: str#
is_default: bool#
is_public: bool#
static list(client: Client, plugin_id: Optional[str] = None, handle: Optional[str] = None, public: bool = True) ListPluginVersionsResponse[source]#
classmethod parse_obj(obj: Any) BaseModel[source]#
plugin_id: str#
class steamship.data.Tag(*, client: Client = None, id: str = None, fileId: str = None, blockId: Optional[str] = None, kind: Union[TagKind, str] = None, name: Optional[str] = None, value: Optional[Dict[Union[TagValueKey, str], Any]] = None, startIdx: Optional[int] = None, endIdx: Optional[int] = None, text: Optional[str] = None)[source]#

Bases: CamelModel

class DeleteRequest(*, id: str = None, fileId: str = None, blockId: str = None)[source]#

Bases: Request

block_id: str#
file_id: str#
id: str#
class ListRequest(*, fileId: str = None, blockId: str = None)[source]#

Bases: Request

block_id: str#
file_id: str#
class ListResponse(*, tags: List[Tag] = None)[source]#

Bases: Response

tags: List[Tag]#
block_id: Optional[str]#
client: Client#
static create(client: Client, file_id: Optional[str] = None, block_id: Optional[str] = None, kind: Optional[str] = None, name: Optional[str] = None, start_idx: Optional[int] = None, end_idx: Optional[int] = None, value: Optional[Dict[str, Any]] = None) Tag[source]#
delete() Tag[source]#
end_idx: Optional[int]#
file_id: str#
id: str#
index(plugin_instance: Optional[Any] = None)[source]#

Index this tag.

kind: Union[TagKind, str]#
name: Optional[str]#
classmethod parse_obj(obj: Any) BaseModel[source]#
static query(client: Client, tag_filter_query: str) TagQueryResponse[source]#
start_idx: Optional[int]#
text: Optional[str]#
value: Optional[Dict[Union[TagValueKey, str], Any]]#
class steamship.data.TagKind(value)[source]#

Bases: str, Enum

A set of kind constants for Tags.

These define broad categories of tags. Suggested name values for each category are found in separate enums. For example: kind=TagKind.DOCUMENT, name=DocTag.H1

CHAT = 'chat'#
CHAT_HISTORY_CONTEXT = 'chat-history-context'#
DEPENDENCY = 'dependency'#
DOCUMENT = 'document'#
EMBEDDING = 'embedding'#
EMOTION = 'emotion'#
ENTITY = 'entity'#
GENERATION = 'generation'#
INTENT = 'intent'#
KIND = 'summary'#
MESSAGE_ID = 'message-id'#
PART_OF_SPEECH = 'part-of-speech'#
PROVENANCE = 'provenance'#
ROLE = 'role'#
SEARCH_RESULT = 'search-result'#
SENTIMENT = 'sentiment'#
SUMMARY = 'summary'#
TIMESTAMP = 'timestamp'#
TOKEN = 'token'#
TOKENIZATION = 'tokenization'#
TOPIC = 'topic'#
class steamship.data.TagValueKey(value)[source]#

Bases: str, Enum

A set of key constants for the value object within a tag.

BOOL_VALUE = 'bool-value'#
DIRECT = 'direct'#
END_TIME_S = 'end-time-s'#
ENTITY_NAME = 'entity_name'#
NUMBER_VALUE = 'number-value'#
SCORE = 'score'#
START_TIME_S = 'start-time-s'#
STRING_VALUE = 'string-value'#
TIMESTAMP_VALUE = 'timestamp-value'#
VALUE = 'value'#
VECTOR_VALUE = 'vector-value'#
class steamship.data.TokenTag(value)[source]#

Bases: str, Enum

A set of name constants for Tags with a kind of TagKind.token; appropriate for parsing-level ideas.

ENTITY_IOB = 'entity-iob'#
ENTITY_TYPE = 'entity-type'#
HEAD = 'head'#
IS_ALPHA = 'is-alpha'#
IS_ASCII = 'is-ascii'#
IS_BRACKET = 'is-bracket'#
IS_CURRENCY = 'is-currency'#
IS_DIGIT = 'is-digit'#
IS_LEFT_PUNCT = 'is-left-punct'#
IS_OUT_OF_VOCABULARY = 'is-out-of-vocabulary'#
IS_PUNCT = 'is-punct'#
IS_QUOTE = 'is-quote'#
IS_RIGHT_PUNCT = 'is-right-punct'#
IS_SPACE = 'is-space'#
IS_STOPWORD = 'is-stopword'#
IS_TITLE = 'is-title'#
LANGUAGE = 'language'#
LEFT_EDGE = 'left-edge'#
LEMMA = 'lemma'#
LIKE_EMAIL = 'like-email'#
LIKE_NUM = 'like-num'#
LIKE_URL = 'like-url'#
NORMALIZED = 'normalized'#
PREFIX = 'prefix'#
RIGHT_EDGE = 'right-edge'#
SHAPE = 'shape'#
SUFFIX = 'suffix'#
TEXT = 'text'#
TEXT_WITH_WHITESPACE = 'text-with-whitespace'#
WHITESPACE = 'whitespace'#
class steamship.data.Workspace(*, client: Client = None, id: str = None, handle: str = None)[source]#

Bases: CamelModel

class CreateRequest(*, id: Optional[str] = None, handle: Optional[str] = None, fetchIfExists: Optional[bool] = None, externalId: Optional[str] = None, externalType: Optional[str] = None, metadata: Optional[str] = None)[source]#

Bases: Request

external_id: Optional[str]#
external_type: Optional[str]#
fetch_if_exists: Optional[bool]#
handle: Optional[str]#
id: Optional[str]#
metadata: Optional[str]#
client: Client#
static create(client: Client, handle: Optional[str] = None, external_id: Optional[str] = None, external_type: Optional[str] = None, metadata: Optional[Any] = None, fetch_if_exists: bool = True) Workspace[source]#
create_signed_url(request: Request) Response[source]#
delete() Workspace[source]#
static get(client: Client, id_: Optional[str] = None, handle: Optional[str] = None, fetch_if_exists: Optional[bool] = None) Workspace[source]#
handle: str#
id: str#
static list(client: Client, t: Optional[str] = None, page_size: Optional[int] = None, page_token: Optional[str] = None, sort_order: Optional[SortOrder] = SortOrder.DESC) ListWorkspacesResponse[source]#
classmethod parse_obj(obj: Any) BaseModel[source]#