steamship.invocable.mixins package#

Submodules#

steamship.invocable.mixins.blockifier_mixin module#

class steamship.invocable.mixins.blockifier_mixin.BlockifierMixin(client: Steamship)[source]#

Bases: PackageMixin

Provides endpoints for easy Blockification of files.

blockify(file_id: str, mime_type: MimeTypes | None = None, blockifier_handle: str | None = None, after_task_id: str | None = None) Task[source]#

Blockify the file file_id using a curated set of defaults for the provided mime_type.

If no MIME Type is provided, the file’s recorded MIME Type will be used. If still no MIME Type is available, an error will be thrown.

Supported MIME Types:

  • PDF

  • Audio (MP3, MP4, WEBM)

client: Steamship#

steamship.invocable.mixins.file_importer_mixin module#

class steamship.invocable.mixins.file_importer_mixin.FileImporterMixin(client: Steamship)[source]#

Bases: PackageMixin

Provide endpoints for easy file import – both sync and async.

client: Steamship#
import_text(text: str, mime_type: str | None) File[source]#

Import the text to a Steamship File.

import_url(url: str) File[source]#

Import the URL to a Steamship File. Actual import will be scheduled async.

import_url_to_file_and_task(url: str) Tuple[File, Task | None][source]#

Import the provided URL, returning the file and optional task, if async work is required.

steamship.invocable.mixins.indexer_mixin module#

class steamship.invocable.mixins.indexer_mixin.IndexerMixin(client: Steamship, embedder_config: dict = None, context_window_size: int = 200, context_window_overlap: int = 50)[source]#

Bases: PackageMixin

Provides endpoints for easy Indexing of blockified files.

client: Steamship#
context_window_overlap: int#
context_window_size: int#
embedding_index_config: dict#
index_block(block_id: str, metadata: dict | None = None, index_handle: str | None = None)[source]#

Load a Steamship Block into an embedding index.

Optional arguments: - index_handle (uses your default index if blank) - metadata (returned on embedding results for source attribution)

index_file(file_id: str, metadata: dict | None = None, index_handle: str | None = None) bool[source]#

Load a Steamship File into an embedding index.

Optional arguments: - index_handle (uses your default index if blank) - metadata (returned on embedding results for source attribution)

index_text(text: str, metadata: dict | None = None, index_handle: str | None = None) bool[source]#

Load text into an embedding index.

Optional arguments: - index_handle (uses your default index if blank) - metadata (returned on embedding results for source attribution)

search_index(query: str, index_handle: str | None = None, k: int = 5) SearchResults[source]#

Search an embedding index.

Optional arguments: - index_handle (uses your default index if blank)

steamship.invocable.mixins.indexer_pipeline_mixin module#

class steamship.invocable.mixins.indexer_pipeline_mixin.IndexerPipelineMixin(client: Steamship, invocable: PackageService)[source]#

Bases: PackageMixin

Provides a complete set of endpoints & async workflow for Document Question Answering.

This Mixin is an async orchestrator of other mixins: - Importer Mixin: to import files, e.g. YouTube videos, PDF urls - Blockifier Mixin: to convert files to Blocks – whether that’s s2t or PDF parsing, etc. - Indexer Mixin: to convert Steamship Files to embedded sharts

blockifier_mixin: BlockifierMixin#
client: Steamship#
importer_mixin: FileImporterMixin#
index_url(url: str, metadata: dict | None = None, index_handle: str | None = None, mime_type: str | None = None) Task[source]#

Load a URL into an embedding index.

URL Types supported: - PDF (Text) - TXT and Markdown - YouTube (Though failure rate is high)

Optional arguments: - mime_type (if it can be guessed by the Content-Type header or the URL schema) - index_handle (uses your default index if blank) - metadata (returned on embedding results for source attribution)

indexer_mixin: IndexerMixin#
invocable: PackageService#
set_file_status(file_id: str, status: str) bool[source]#

Set the status bit of a file. Intended to be scheduled after import.

Module contents#